https://sourceware.org/bugzilla/show_bug.cgi?id=31956

--- Comment #20 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The binutils-2_43-branch branch has been updated by Alan Modra
<amo...@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2fbb863136724cfef2fc2f4c2b7f51be36f132c7

commit 2fbb863136724cfef2fc2f4c2b7f51be36f132c7
Author: H.J. Lu <hjl.to...@gmail.com>
Date:   Fri Aug 2 19:52:00 2024 -0700

    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.to...@gmail.com>
    (cherry picked from commit 3221c470f0765886a49a1a3d2ec602e4104a377b)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to