PR27311, ld.bfd (symbol from plugin): undefined reference
authorAlan Modra <amodra@gmail.com>
Tue, 2 Feb 2021 04:35:14 +0000 (15:05 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 2 Feb 2021 09:39:42 +0000 (20:09 +1030)
commit9918bff7cf2a566aaa2036d2242a61c140652dc7
treeb2498f984c21d1aa2ef837e1dab0e281fd392a43
parent2bd3e4b8d2580839a457e221d4e1e09105248215
PR27311, ld.bfd (symbol from plugin): undefined reference

A default versioned symbol definition in a shared library is
overridden by an unversioned definition in a regular object file, and
thus should not be reason to make an as-needed library needed.

bfd/
PR 27311
* elflink.c (_bfd_elf_add_default_symbol): Add override parameter.
Use when handling default versioned symbol.  Rename existing
override variable to nondef_override and use for non-default
versioned symbol.
(elf_link_add_object_symbols): Adjust call to suit.  Don't
pull in as-needed libraries when override is set.
ld/
* testsuite/ld-plugin/pr27311.d,
* testsuite/ld-plugin/pr27311.ver,
* testsuite/ld-plugin/pr27311a.c,
* testsuite/ld-plugin/pr27311b.c,
* testsuite/ld-plugin/pr27311c.c: New testcase.
* testsuite/ld-plugin/lto.exp: Run it.  Correct PR14918 and
PR12982 entries.
bfd/ChangeLog
bfd/elflink.c
ld/ChangeLog
ld/testsuite/ld-plugin/lto.exp
ld/testsuite/ld-plugin/pr27311.d [new file with mode: 0644]
ld/testsuite/ld-plugin/pr27311.ver [new file with mode: 0644]
ld/testsuite/ld-plugin/pr27311a.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr27311b.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr27311c.c [new file with mode: 0644]