Gentoo Archives: gentoo-user

From: Adam Carter <adamcarter3@×××××.com>
To: "gentoo-user@l.g.o" <gentoo-user@l.g.o>
Subject: [gentoo-user] gcc 6 PIE use flag
Date: Sun, 07 May 2017 22:47:12
Message-Id: CAC=wYCHyax4rTZ42HdGLtMf2aEcUi2_LEBPm8Sbdoxs5_Kydzg@mail.gmail.com
1 Since an update to the default USE flags on gcc 6 turned on PIE and SSP,
2 i'm getting these errors;
3
4 /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld:
5 atof-generic.o: relocation R_X86_64_32 against `.rodata' can not be used
6 when making a shared object; recompile with -fPIC
7 /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld:
8 dw2gencfi.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be
9 used when making a shared object; recompile with -fPIC
10 /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld:
11 frags.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used
12 when making a shared object; recompile with -fPIC
13 /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld:
14 messages.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used
15 when making a shared object; recompile with -fPIC
16 /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld:
17 subsegs.o: relocation R_X86_64_32 against `.rodata' can not be used when
18 making a shared object; recompile with -fPIC
19 /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld:
20 symbols.o: relocation R_X86_64_32S against symbol `_sch_toupper' can not be
21 used when making a shared object; recompile with -fPIC
22 /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld:
23 atof-ieee.o: relocation R_X86_64_32S against `.rodata' can not be used when
24 making a shared object; recompile with -fPIC
25 /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld:
26 symbols.o: warning: relocation against `strlen@@GLIBC_2.2.5' in readonly
27 section `.text'
28 /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../../x86_64-pc-linux-gnu/bin/ld:
29 final link failed: Nonrepresentable section on output
30 collect2: error: ld returned 1 exit status
31
32 If I add -fPIC to CFLAGS it will compile. Interestingly some packages (eg
33 PHP) will compile without the -fPIC. Also the man page says; "This option
34 makes a difference on AArch64, m68k, PowerPC and SPARC:, whereas i'm
35 running amd64.
36
37 What's going on here?

Replies

Subject Author
Re: [gentoo-user] gcc 6 PIE use flag Andrew Savchenko <bircoph@g.o>
Re: [gentoo-user] gcc 6 PIE use flag Walter Dnes <waltdnes@××××××××.org>