public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] i386 compiler args are wrong
Date: Sun, 07 Apr 2013 17:39:21 +0200	[thread overview]
Message-ID: <51619329.5060302@gmail.com> (raw)

-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..
 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 294 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130407/612ad3f1/attachment.pgp>

             reply	other threads:[~2013-04-07 15:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-07 15:39 Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2013-04-15 23:55 ` [U-Boot] [PATCH] i386 compiler args are wrong Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51619329.5060302@gmail.com \
    --to=phcoder@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox