All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/5] MIPS: do not build position-independent executables for SPL
Date: Sat, 19 Dec 2015 20:20:47 +0100	[thread overview]
Message-ID: <1450552849-10813-4-git-send-email-daniel.schwierzeck@gmail.com> (raw)
In-Reply-To: <1450552849-10813-1-git-send-email-daniel.schwierzeck@gmail.com>

SPL binaries are usually linked to a fixed address in SRAM.
Furthermore SPL binaries do not need to relocate itself. Thus
do not build them as position-independent binaries which helps
to largely reduce the size of SPL binaries.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
---

 arch/mips/config.mk | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/arch/mips/config.mk b/arch/mips/config.mk
index 52e28f2..415ec8a 100644
--- a/arch/mips/config.mk
+++ b/arch/mips/config.mk
@@ -63,10 +63,20 @@ PLATFORM_CPPFLAGS += -D__MIPS__
 # On the other hand, we want PIC in the U-Boot code to relocate it from ROM
 # to RAM. $28 is always used as gp.
 #
-PLATFORM_CPPFLAGS		+= -G 0 -mabicalls -fpic
+ifdef CONFIG_SPL_BUILD
+PF_ABICALLS			:= -mno-abicalls
+PF_PIC				:= -fno-pic
+PF_PIE				:=
+else
+PF_ABICALLS			:= -mabicalls
+PF_PIC				:= -fpic
+PF_PIE				:= -pie
+PF_OBJCOPY			:= -j .got -j .u_boot_list -j .rel.dyn -j .padding
+endif
+
+PLATFORM_CPPFLAGS		+= -G 0 $(PF_ABICALLS) $(PF_PIC)
 PLATFORM_CPPFLAGS		+= -msoft-float
 PLATFORM_LDFLAGS		+= -G 0 -static -n -nostdlib
 PLATFORM_RELFLAGS		+= -ffunction-sections -fdata-sections
-LDFLAGS_FINAL			+= --gc-sections -pie
-OBJCOPYFLAGS			+= -j .text -j .rodata -j .data -j .got
-OBJCOPYFLAGS			+= -j .u_boot_list -j .rel.dyn -j .padding
+LDFLAGS_FINAL			+= --gc-sections $(PF_PIE)
+OBJCOPYFLAGS			+= -j .text -j .rodata -j .data $(PF_OBJCOPY)
-- 
2.5.0

  parent reply	other threads:[~2015-12-19 19:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-19 19:20 [U-Boot] [PATCH 0/5] MIPS updates Daniel Schwierzeck
2015-12-19 19:20 ` [U-Boot] [PATCH 1/5] MIPS: fix annotation of _start and relocate_code Daniel Schwierzeck
2015-12-19 19:20 ` [U-Boot] [PATCH 2/5] MIPS: create .text sub-sections for assembler functions Daniel Schwierzeck
2015-12-19 19:20 ` Daniel Schwierzeck [this message]
2015-12-19 19:20 ` [U-Boot] [PATCH 4/5] MIPS: add initial infrastructure for device-tree files Daniel Schwierzeck
2015-12-19 22:43   ` [U-Boot] [PATCH v2 " Daniel Schwierzeck
2016-01-11 11:25     ` Purna Chandra Mandal
2016-01-11 16:40       ` Daniel Schwierzeck
2016-01-11 16:48     ` [U-Boot] [PATCH v3] " Daniel Schwierzeck
2016-01-12 19:05       ` [U-Boot] [PATCH v4] " Daniel Schwierzeck
2015-12-19 19:20 ` [U-Boot] [PATCH 5/5] Kconfig: create symbolic link on MIPS Daniel Schwierzeck

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=1450552849-10813-4-git-send-email-daniel.schwierzeck@gmail.com \
    --to=daniel.schwierzeck@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.