]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
lto: Don't add indirect symbols for versioned aliases in IR
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 29 Mar 2023 20:06:26 +0000 (13:06 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 11 Apr 2023 16:25:09 +0000 (09:25 -0700)
commitded035f913e4d8c989880cf5928b6b5fca9466ae
treea995ccebb2848224196f5f21c306f9fc83a2807d
parent7a06052ee66e16a95f91123f9a4c0dd23e871a7e
lto: Don't add indirect symbols for versioned aliases in IR

Linker adds indirect symbols for versioned symbol aliases, which are
created by ".symver foo, foo@FOO", by checking symbol type, value and
section so that references to foo will be replaced by references to
foo@FOO if foo and foo@FOO have the same symbol type, value and section.
But in IR, since all symbols of the same type have the same value and
section, we can't tell if a symbol is an alias of another symbol by
their types, values and sections.  We shouldn't add indirect symbols
for versioned symbol aliases in IR.

bfd/

PR ld/30281
* elflink.c (elf_link_add_object_symbols): Don't add indirect
symbols for ".symver foo, foo@FOO" aliases in IR.

ld/

PR ld/30281
* testsuite/ld-plugin/lto.exp: Add PR ld/30281 test.
* testsuite/ld-plugin/pr30281.t: New file.
* testsuite/ld-plugin/pr30281.c: Likewise.

(cherry picked from commit 79cfb928f552401e3cec7a208a87eb74aa0d2d8b)
bfd/elflink.c
ld/testsuite/ld-plugin/lto.exp
ld/testsuite/ld-plugin/pr30281.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr30281.t [new file with mode: 0644]