Commit dbb7234b2a5e7d2cdb6658156de8d2d5b54033d7

Authored by Vasili Galka
Committed by Simon Glass
1 parent 038380597b

x86: Enable 32-bit build using x86_64 multilib toolchain

Until now building the x86 arch boards required 32-bit toolchain. As
many x86_64 toolchains come with 32-bit support (multilib) that's a
good idea to enable build with such toolchains.

The change required was to specify the usage of 32-bit explicitly to
the compiler and the linker (-m32 and -m elf_i386 flags) and locate
the right libgcc path.

Signed-off-by: Vasili Galka <vvv444@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>

Showing 2 changed files with 4 additions and 3 deletions Side-by-side Diff

... ... @@ -16,18 +16,19 @@
16 16 PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_X86)
17 17 PLATFORM_CPPFLAGS += -fno-dwarf2-cfi-asm
18 18 PLATFORM_CPPFLAGS += -DREALMODE_BASE=0x7c0
  19 +PLATFORM_CPPFLAGS += -march=i386 -m32
19 20  
20 21 # Support generic board on x86
21 22 __HAVE_ARCH_GENERIC_BOARD := y
22 23  
23 24 PLATFORM_RELFLAGS += -ffunction-sections -fvisibility=hidden
24 25  
25   -PLATFORM_LDFLAGS += --emit-relocs -Bsymbolic -Bsymbolic-functions
  26 +PLATFORM_LDFLAGS += --emit-relocs -Bsymbolic -Bsymbolic-functions -m elf_i386
26 27  
27 28 LDFLAGS_FINAL += --gc-sections -pie
28 29 LDFLAGS_FINAL += --wrap=__divdi3 --wrap=__udivdi3
29 30 LDFLAGS_FINAL += --wrap=__moddi3 --wrap=__umoddi3
30 31  
31   -export NORMAL_LIBGCC = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
  32 +export NORMAL_LIBGCC = $(shell $(CC) $(PLATFORM_CPPFLAGS) -print-libgcc-file-name)
32 33 CONFIG_USE_PRIVATE_LIBGCC := arch/x86/lib
arch/x86/cpu/config.mk
... ... @@ -7,7 +7,7 @@
7 7  
8 8 CROSS_COMPILE ?= i386-linux-
9 9  
10   -PLATFORM_CPPFLAGS += -DCONFIG_X86 -D__I386__ -march=i386 -Werror
  10 +PLATFORM_CPPFLAGS += -DCONFIG_X86 -D__I386__ -Werror
11 11  
12 12 # DO NOT MODIFY THE FOLLOWING UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!
13 13 LDPPFLAGS += -DRESET_SEG_START=0xffff0000