[RFC,2/3] build: CFLAGS compile with -fpie and -fno-pic

Submitted by Nicholas Piggin on July 18, 2017, 10:40 a.m.

Details

Message ID 20170718104008.9624-3-npiggin@gmail.com
State New
Headers show

Commit Message

Nicholas Piggin July 18, 2017, 10:40 a.m.
When gcc is configured with --enabled-default-pie, sets -fpic which
does not need to be enabled, so remove it. Pass -fpie explicitly as
well just to be careful. This was observed with the powerpc64le cross
compiler for Debian.

This allows the powerpc64le toolchain to compile an almost identical
binary as the powerpc64 toolchain.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 Makefile.main | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/Makefile.main b/Makefile.main
index c421cbc6..b8fed59b 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -66,7 +66,7 @@  ifeq ($(DEBUG),1)
 CPPFLAGS += -DDEBUG -DCCAN_LIST_DEBUG
 endif
 
-CFLAGS := -fno-strict-aliasing -pie -mbig-endian -m64
+CFLAGS := -fno-strict-aliasing -pie -fpie -fno-pic -mbig-endian -m64
 CFLAGS += -Wl,--oformat,elf64-powerpc
 CFLAGS += -ffixed-r13
 CFLAGS += $(call try-cflag,$(CC),-std=gnu11)