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: unassig...@gcc.gnu.org ReportedBy: jan.kratoch...@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