Skip to contentSkip to conversation

configure: Prune PIE flags

PATCH New Khem Raj 1 participant 1 message Feb 17, 2016

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 configure: Prune PIE flags

LDFLAGS are not taken from environment and CFLAGS is used for LDFLAGS however when using security options -fpie and -pie options are coming as part of ARCH_FLAGS and they get into LDFLAGS of shared objects as well so we end up with conflicting options -shared -pie, which gold rejects outright and bfd linker lets the one appearning last in cmdline take effect. This create quite a unpleasant situation in OE when security flags are enabled and gold or not-gold options are used it errors out but errors are not same.

Anyway, with this patch we filter pie options from ARCH_FLAGS ouright and take control of generating PIC objects

Helps with errors like

| /mnt/oe/build/tmp-glibc/sysroots/x86_64-linux/usr/libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/5.3.0/ld: pseudo_client.o: relocation R_X86_64_PC32 against symbol `pseudo_util_debug_flags' can not be used when making a shared object; recompile with -fPIC
| /mnt/oe/build/tmp-glibc/sysroots/x86_64-linux/usr/libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/5.3.0/ld: final link failed: Bad value
| collect2: error: ld returned 1 exit status
| make: *** [lib/pseudo/lib64/libpseudo.so] Error 1

---
Upstream-Status: Submitted

 configure | 2 ++
 1 file changed, 2 insertions(+)
configure +2 -0
index e5ef9ce..83b0890 100755
@@ -339,3 +339,5 @@ sed -e '
   s,@ARCH@,'"$opt_arch"',g
   s,@BITS@,'"$opt_bits"',g
 ' < Makefile.in > Makefile
+
+sed -i -e 's/\-[f]*pie//g' Makefile
Signature · 1 line
1.8.3.1