-pie for ld can't be used w/o -fPIE to compiler. -m32 and -melf_i386
are needed to be able to use gcc-multilib/binutils-multilib.
-fPIE prevents from using some registers in constraints.

diff --git a/Makefile b/Makefile
index db7561c..6c3a8d5 100644
--- a/Makefile
+++ b/Makefile
@@ -365,7 +365,7 @@ else
 PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc
 endif
 else
-PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) 
-print-libgcc-file-name`) -lgcc
+PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CPPFLAGS) $(CFLAGS) 
-print-libgcc-file-name`) -lgcc
 endif
 PLATFORM_LIBS += $(PLATFORM_LIBGCC)
 export PLATFORM_LIBS
diff --git a/arch/x86/config.mk b/arch/x86/config.mk
index 168dc24..4dfe7e8 100644
--- a/arch/x86/config.mk
+++ b/arch/x86/config.mk
@@ -25,7 +25,7 @@ CONFIG_STANDALONE_LOAD_ADDR ?= 0x40000
 
 PLATFORM_CPPFLAGS += -fno-strict-aliasing
 PLATFORM_CPPFLAGS += -Wstrict-prototypes
-PLATFORM_CPPFLAGS += -mregparm=3
+PLATFORM_CPPFLAGS += -mregparm=3 -m32 -fPIE
 PLATFORM_CPPFLAGS += -fomit-frame-pointer
 PF_CPPFLAGS_X86   := $(call cc-option, -ffreestanding) \
                     $(call cc-option, -fno-toplevel-reorder, \
@@ -41,7 +41,7 @@ __HAVE_ARCH_GENERIC_BOARD := y
 
 PLATFORM_RELFLAGS += -ffunction-sections -fvisibility=hidden
 
-PLATFORM_LDFLAGS += --emit-relocs -Bsymbolic -Bsymbolic-functions
+PLATFORM_LDFLAGS += --emit-relocs -Bsymbolic -Bsymbolic-functions -melf_i386
 
 LDFLAGS_FINAL += --gc-sections -pie
 LDFLAGS_FINAL += --wrap=__divdi3 --wrap=__udivdi3
diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index 4e9e1f7..629994c 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -299,11 +299,12 @@ void boot_zimage(void *setup_base, void *load_address)
         */
        __asm__ __volatile__ (
        "movl $0, %%ebp\n"
+       "movl $0, %%ebx\n"
+       "movl $0, %%edi\n"
        "cli\n"
        "jmp *%[kernel_entry]\n"
        :: [kernel_entry]"a"(load_address),
-          [boot_params] "S"(setup_base),
-          "b"(0), "D"(0)
+          [boot_params] "S"(setup_base)
        :  "%ebp"
        );
 }
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index baaa2fb..2fb50f5 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -68,7 +68,7 @@ ELF   := $(addprefix $(obj),$(ELF))
 BIN    := $(addprefix $(obj),$(BIN))
 SREC   := $(addprefix $(obj),$(SREC))
 
-gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
+gcclibdir := $(shell dirname `$(CC) $(CPPFLAGS) -print-libgcc-file-name`)
 
 CPPFLAGS += -I..
 

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to