[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/26324] New: Unused symbols in dynamic symbol table
From: |
hjl.tools at gmail dot com |
Subject: |
[Bug ld/26324] New: Unused symbols in dynamic symbol table |
Date: |
Fri, 31 Jul 2020 11:41:28 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=26324
Bug ID: 26324
Summary: Unused symbols in dynamic symbol table
Product: binutils
Version: 2.36 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: hjl.tools at gmail dot com
Target Milestone: ---
Created attachment 12736
--> https://sourceware.org/bugzilla/attachment.cgi?id=12736&action=edit
A patch
A testcase is on pr96385 branch at:
https://gitlab.com/x86-gcc/gcc-bugs
[hjl@gnu-cfl-2 gcc-bugs]$ make
gcc -B./ -O2 -g -o ar -Wl,--as-needed arparse.o arlex.o ar.o not-ranlib.o
arsup.o rename.o binemul.o emul_vanilla.o bucomm.o version.o filemode.o
libbfd-2.35-3.fc33.so libiberty.a -Wl,-R,.
./ar rc libfoo.a not-ranlib.o
[hjl@gnu-cfl-2 gcc-bugs]$ readelf --dyn-syms -rW ar | grep bfd_scan_vma
5: 0000000000000000 0 FUNC GLOBAL DEFAULT UND bfd_scan_vma
[hjl@gnu-cfl-2 gcc-bugs]$
LTO removes the reference to fd_scan_vma. But ld puts it in dynamic symbol
table. The reference is generated by GCC bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96385
Remove -g fixes the GCC bug:
[hjl@gnu-cfl-2 gcc-bugs]$ gcc -B./ -O2 -g0 -o ar -Wl,--as-needed arparse.o
arlex.o ar.o not-ranlib.o arsup.o rename.o binemul.o emul_vanilla.o bucomm.o
version.o filemode.o libbfd-2.35-3.fc33.so libiberty.a -Wl,-R,.
[hjl@gnu-cfl-2 gcc-bugs]$ readelf --dyn-syms -rW ar | grep bfd_scan_vma
[hjl@gnu-cfl-2 gcc-bugs]$
Here is the patch to remove these symbols from dynamic symbol table.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/26324] New: Unused symbols in dynamic symbol table,
hjl.tools at gmail dot com <=