LTO: Properly handle wrapper symbols in IR
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 25 Apr 2019 14:53:46 +0000 (07:53 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 25 Apr 2019 14:54:00 +0000 (07:54 -0700)
commit6fe014bcd33686cb75e6355f9c36ce483a64ec62
treed1ff965badb244f102cee2bb1f3f9e6df38c84e5
parent723adb650a31859d7cc45832cb8adca0206455ed
LTO: Properly handle wrapper symbols in IR

When a wrapper symbol, __wrap_FOO, is defined in IR, its resolution
should be LDPR_PREVAILING_DEF, not PREVAILING_DEF_IRONLY, since LTO
doesn't know that __wrap_FOO provides definition of FOO.  And resolution
of FOO should be LDPR_RESOLVED_IR since it is resolved by __wrap_FOO in
IR.

PR ld/24406
* ld.texi: Remove LTO warning from --wrap.
* plugin.c (get_symbols): Update resolution for wrapper and
wrapped symbols.
* testsuite/ld-plugin/lto.exp: Run ld/24406 tests.
* testsuite/ld-plugin/pr24406-1.c: New file.
* testsuite/ld-plugin/pr24406-2a.c: Likewise.
* testsuite/ld-plugin/pr24406-2b.c: Likewise.
ld/ChangeLog
ld/ld.texi
ld/plugin.c
ld/testsuite/ld-plugin/lto.exp
ld/testsuite/ld-plugin/pr24406-1.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr24406-2a.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr24406-2b.c [new file with mode: 0644]