blob: 43504eaab9c1a42bd5f9c46d62f852b1410364f0 [file] [log] [blame]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001From b5545c08e6c674c49aef14b47a56a3e92df4d2a7 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 17 Feb 2016 07:36:34 +0000
4Subject: [pseudo][PATCH] configure: Prune PIE flags
5
6LDFLAGS are not taken from environment and CFLAGS is used for LDFLAGS
7however when using security options -fpie and -pie options are coming
8as part of ARCH_FLAGS and they get into LDFLAGS of shared objects as
9well so we end up with conflicting options -shared -pie, which gold
10rejects outright and bfd linker lets the one appearning last in cmdline
11take effect. This create quite a unpleasant situation in OE when
12security flags are enabled and gold or not-gold options are used
13it errors out but errors are not same.
14
15Anyway, with this patch we filter pie options from ARCH_FLAGS
16ouright and take control of generating PIC objects
17
18Helps with errors like
19
20| /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
21| /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
22| collect2: error: ld returned 1 exit status
23| make: *** [lib/pseudo/lib64/libpseudo.so] Error 1
24
25Signed-off-by: Khem Raj <raj.khem@gmail.com>
26---
27Upstream-Status: Submitted
28
29 configure | 2 ++
30 1 file changed, 2 insertions(+)
31
32diff --git a/configure b/configure
33index e5ef9ce..83b0890 100755
34--- a/configure
35+++ b/configure
36@@ -339,3 +339,5 @@ sed -e '
37 s,@ARCH@,'"$opt_arch"',g
38 s,@BITS@,'"$opt_bits"',g
39 ' < Makefile.in > Makefile
40+
41+sed -i -e 's/\-[f]*pie//g' Makefile
42--
431.8.3.1
44