mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: do not specify -static and -pie at the same time
@ 2015-03-01 13:12 Lucas Stach
  2015-03-02  6:11 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Lucas Stach @ 2015-03-01 13:12 UTC (permalink / raw)
  To: barebox

PIE is a form of dynamic linking and thus inherently incompatible
with -static. It worked ok as the current behavior of ld.bfd is
to not respect -static if -pie has been specified.

ld.gold and future versions of ld.bfd will fail to link if both
of those incompatible switches are specified at the same time.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 arch/arm/Makefile     | 4 +++-
 arch/arm/pbl/Makefile | 5 +++--
 images/Makefile       | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index f0133d4..b3abcae 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -105,10 +105,12 @@ CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
 
 # Add cleanup flags
 CPPFLAGS += -fdata-sections -ffunction-sections
-LDFLAGS_barebox += -static --gc-sections
+LDFLAGS_barebox += --gc-sections
 
 ifdef CONFIG_RELOCATABLE
 LDFLAGS_barebox += -pie
+else
+LDFLAGS_barebox += -static
 endif
 
 ifdef CONFIG_IMAGE_COMPRESSION
diff --git a/arch/arm/pbl/Makefile b/arch/arm/pbl/Makefile
index 1b90b37..4c1788d 100644
--- a/arch/arm/pbl/Makefile
+++ b/arch/arm/pbl/Makefile
@@ -31,10 +31,11 @@ $(obj)/zbarebox.S: $(obj)/zbarebox FORCE
 	$(call if_changed,disasm)
 
 PBL_CPPFLAGS		+= -fdata-sections -ffunction-sections
-LDFLAGS_zbarebox	:= -Map $(obj)/zbarebox.map
-LDFLAGS_zbarebox	+= -static --gc-sections
+LDFLAGS_zbarebox	:= -Map $(obj)/zbarebox.map --gc-sections
 ifdef CONFIG_PBL_RELOCATABLE
 LDFLAGS_zbarebox += -pie
+else
+LDFLAGS_zbarebox += -static
 endif
 zbarebox-common := $(barebox-pbl-common) $(obj)/$(piggy_o)
 zbarebox-lds := $(obj)/zbarebox.lds
diff --git a/images/Makefile b/images/Makefile
index 7c3aaf7..f7e978c 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -54,7 +54,7 @@ $(pbl-lds): $(obj)/../arch/$(ARCH)/lib/pbl.lds.S FORCE
 	$(call if_changed_dep,cpp_lds_S)
 
 quiet_cmd_elf__ ?= LD      $@
-      cmd_elf__ ?= $(LD) $(LDFLAGS) -static --gc-sections -pie		\
+      cmd_elf__ ?= $(LD) $(LDFLAGS) --gc-sections -pie			\
 		-e $(2) -Map $@.map $(LDFLAGS_$(@F)) -o $@		\
 		-T $(pbl-lds)						\
 		--start-group $(barebox-pbl-common) --end-group
-- 
2.1.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM: do not specify -static and -pie at the same time
  2015-03-01 13:12 [PATCH] ARM: do not specify -static and -pie at the same time Lucas Stach
@ 2015-03-02  6:11 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2015-03-02  6:11 UTC (permalink / raw)
  To: Lucas Stach; +Cc: barebox

On Sun, Mar 01, 2015 at 02:12:37PM +0100, Lucas Stach wrote:
> PIE is a form of dynamic linking and thus inherently incompatible
> with -static. It worked ok as the current behavior of ld.bfd is
> to not respect -static if -pie has been specified.
> 
> ld.gold and future versions of ld.bfd will fail to link if both
> of those incompatible switches are specified at the same time.
> 
> Signed-off-by: Lucas Stach <dev@lynxeye.de>

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-02  6:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-01 13:12 [PATCH] ARM: do not specify -static and -pie at the same time Lucas Stach
2015-03-02  6:11 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox