[PATCH 1/1] sandbox: move ELFCLASS detection to asm/elf.h

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Thu Oct 27 02:50:14 EDT 2011


now we can detect the host build from gcc macro
and cross compile the sandbox

for 64bit today we just detect x86_64 and powerpc64
by default barebox will use 32bit elf class

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
Cc: Loïc Minier <loic.minier at linaro.org>
---
Loïc

	to build on most of arch you need this fix and 3 others
	already in the next

	commit	9a5898e5: sandbox: simplify linker script
	commit	15f87657: sandbox: remove duplicate barebox.lds.S
	ommit	e3e71f5e: sandbox: move __SANDBOX__ to Makefile

	Sacha those 4 patches could go to the master as they fix the sandbox

Best Regards,
J.
 arch/sandbox/Makefile          |   13 -------------
 arch/sandbox/include/asm/elf.h |   14 +++++++++++++-
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
index b88f1f6..9fd18a2 100644
--- a/arch/sandbox/Makefile
+++ b/arch/sandbox/Makefile
@@ -36,19 +36,6 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
 				  -e s/s390x/s390/ -e s/parisc64/parisc/ \
 				  -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
 
-ifeq ($(SUBARCH),x86_64)
-ELF_CLASS := ELFCLASS64
-endif
-ifeq ($(SUBARCH),i386)
-ELF_CLASS  := ELFCLASS32
-endif
-ifeq ($(SUBARCH),powerpc)
-ELF_CLASS  := ELFCLASS32
-endif
-
-CPPFLAGS += -DELF_CLASS="$(ELF_CLASS)"
-export ELF_CLASS
-
 archprepare: maketools
 
 PHONY += maketools
diff --git a/arch/sandbox/include/asm/elf.h b/arch/sandbox/include/asm/elf.h
index b60d248..615b48f 100644
--- a/arch/sandbox/include/asm/elf.h
+++ b/arch/sandbox/include/asm/elf.h
@@ -1,2 +1,14 @@
+#ifndef __ASM_SANDBOX_ELF_H__
+#define __ASM_SANDBOX_ELF_H__
 
-/* nothing yet */
+#if defined(__x86_64__)
+#define ELF_CLASS	ELFCLASS64
+#define CONFIG_PHYS_ADDR_T_64BIT
+#elif defined(__powerpc64__)
+#define ELF_CLASS	ELFCLASS64
+#define CONFIG_PHYS_ADDR_T_64BIT
+#else /* 32bit: i386, powerpc, arm, etc... */
+#define ELF_CLASS	ELFCLASS32
+#endif
+
+#endif /* __ASM_SANDBOX_ELF_H__ */
-- 
1.7.7




More information about the barebox mailing list