echo 'call foo' > ./a.s echo 'call foo@PLT' > ./b.s gcc -c a.s b.s % readelf -Ws a.o b.o File: a.o Symbol table '.symtab' contains 5 entries: Num: Value Size Type Bind Vis Ndx Name 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND 1: 0000000000000000 0 SECTION LOCAL DEFAULT 1 2: 0000000000000000 0 SECTION LOCAL DEFAULT 3 3: 0000000000000000 0 SECTION LOCAL DEFAULT 4 4: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND foo File: b.o Symbol table '.symtab' contains 6 entries: Num: Value Size Type Bind Vis Ndx Name 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND 1: 0000000000000000 0 SECTION LOCAL DEFAULT 1 2: 0000000000000000 0 SECTION LOCAL DEFAULT 3 3: 0000000000000000 0 SECTION LOCAL DEFAULT 4 4: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND _GLOBAL_OFFSET_TABLE_ 5: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND foo _GLOBAL_OFFSET_TABLE_ is not needed.
The master branch has been updated by H.J. Lu <hjl@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=844bf810cf9feebe50772c29d72256ec3c872270 commit 844bf810cf9feebe50772c29d72256ec3c872270 Author: H.J. Lu <hjl.tools@gmail.com> Date: Wed Jan 13 05:42:11 2021 -0800 x86: Don't generate GOT_symbol for PLT relocations Don't generate the _GLOBAL_OFFSET_TABLE_ symbol for PLT relocations since it isn't needed. PR gas/27178 * config/tc-i386.c (lex_got::gotrel): Add need_GOT_symbol. Don't generate GOT_symbol for PLT relocations. * testsuite/gas/i386/i386.exp: Run PR gas/27178 tests. * testsuite/gas/i386/no-got.d: New file. * testsuite/gas/i386/no-got.s: Likewise. * testsuite/gas/i386/x86-64-no-got.d: Likewise. * testsuite/gas/i386/x86-64-no-got.s: Likewise.
Fixed for 2.37.
Shouldn't some of the TLS relocs be similarly marked as not requiring GOT_symbol?
(In reply to Jan Beulich from comment #3) > Shouldn't some of the TLS relocs be similarly marked as not requiring > GOT_symbol? Maybe.