build: fix ASLR for LTO packages

Fix building packages with LTO when CONFIG_PKG_ASLR_PIE is enabled.

Despite comment of PR lto/80838, it seems that GCC needs -fPIC on linker
command line, even if all objects are -fPIC. This may change as PR
lto/80838 is merged into 8.1

compile-tested: ar71xx, ath79

Fix commits:
6dac92a42e
8c11133c9d
07940acc34
e7397eef69
ef16a394d2
ef96d1e34a
47b42137ce
73fc67b614
154c0c4006
804c51e1e6

Signed-off-by: Julien Dusser <julien.dusser@free.fr>
This commit is contained in:
Julien Dusser 2018-07-17 18:29:34 +02:00 committed by John Crispin
parent 84c212da44
commit 4dfa6b7a30

View file

@ -19,7 +19,7 @@ endif
ifdef CONFIG_PKG_ASLR_PIE ifdef CONFIG_PKG_ASLR_PIE
ifeq ($(strip $(PKG_ASLR_PIE)),1) ifeq ($(strip $(PKG_ASLR_PIE)),1)
TARGET_CFLAGS += $(FPIC) TARGET_CFLAGS += $(FPIC)
TARGET_LDFLAGS += -specs=$(INCLUDE_DIR)/hardened-ld-pie.specs TARGET_LDFLAGS += $(FPIC) -specs=$(INCLUDE_DIR)/hardened-ld-pie.specs
endif endif
endif endif
ifdef CONFIG_PKG_CC_STACKPROTECTOR_REGULAR ifdef CONFIG_PKG_CC_STACKPROTECTOR_REGULAR