diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2024-08-02 19:52:00 -0700 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2024-08-03 13:52:38 +0930 |
commit | 3221c470f0765886a49a1a3d2ec602e4104a377b (patch) | |
tree | cd436021bde09b757c720f42eb1c1604a10e3971 /gas/ChangeLog | |
parent | 7ff899ed54e4f1ee89876fe43cce9d5068ea2aea (diff) | |
download | binutils-3221c470f0765886a49a1a3d2ec602e4104a377b.zip binutils-3221c470f0765886a49a1a3d2ec602e4104a377b.tar.gz binutils-3221c470f0765886a49a1a3d2ec602e4104a377b.tar.bz2 |
LTO: Restore the wrapper symbol check for standard function
Call unwrap_hash_lookup to restore the wrapper symbol check for standard
function since reference to standard function may not show up in LTO
symbol table:
[hjl@gnu-tgl-3 pr31956-3]$ nm foo.o
00000000 T main
U __real_malloc
00000000 T __wrap_malloc
[hjl@gnu-tgl-3 pr31956-3]$ lto-dump -list foo.o
Type Visibility Size Name
function default 0 malloc
function default 0 __real_malloc
function default 3 main
function default 5 __wrap_malloc
[hjl@gnu-tgl-3 pr31956-3]$ make
gcc -O2 -flto -Wall -c -o foo.o foo.c
gcc -Wl,--wrap=malloc -O2 -flto -Wall -o x foo.o
/usr/local/bin/ld: /tmp/ccsPW0a9.ltrans0.ltrans.o: in function `main':
<artificial>:(.text.startup+0xa): undefined reference to `__wrap_malloc'
collect2: error: ld returned 1 exit status
make: *** [Makefile:22: x] Error 1
[hjl@gnu-tgl-3 pr31956-3]$
Also add a test to verify that the unused wrapper is removed.
PR ld/31956
* plugin.c (get_symbols): Restore the wrapper symbol check for
standard function.
* testsuite/ld-plugin/lto.exp: Run the malloc test and the
unused test.
* testsuite/ld-plugin/pr31956c.c: New file.
* testsuite/ld-plugin/pr31956d.c: New file.
* testsuite/ld-plugin/pr31956d.d: New file.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'gas/ChangeLog')
0 files changed, 0 insertions, 0 deletions