This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/49950] New: GOT relocation for -fPIE is excessive
- From: "jan.kratochvil at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 2 Aug 2011 19:44:05 +0000
- Subject: [Bug target/49950] New: GOT relocation for -fPIE is excessive
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49950
Summary: GOT relocation for -fPIE is excessive
Product: gcc
Version: 4.4.7
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: target
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jan.kratochvil@redhat.com
Target: x86_64-unknown-linux-gnu
FAIL: gcc (GCC) 4.4.7 20110802 (prerelease)
FAIL: gcc (GCC) 4.5.4 20110802 (prerelease)
FAIL: gcc (GCC) 4.6.2 20110802 (prerelease)
FAIL: gcc (GCC) 4.7.0 20110802 (experimental)
echo 'int i; int f (void) { return i; }' | gcc -c -o 20.o -Wall -fPIE -x c -
readelf -Wr 20.o
0000000000000007 0000000800000009 R_X86_64_GOTPCREL 0000000000000004 i -
4
none: R_X86_64_PC32 is correct
-fPIE: R_X86_64_GOTPCREL is excessive - this Bug
-fPIC: R_X86_64_GOTPCREL is correct
Jakub:
the difference between -fPIE and -fPIC is that the former assumes that you
can't override its symbols
so if it sees some symbol defined in the current source file, it knows that it
will be the definition at runtime
for -shared libraries that is not true, other shared libraries defining the
same symbol can override it, so they need more runtime relocations