https://sourceware.org/bugzilla/show_bug.cgi?id=22566
Bug ID: 22566
Summary: --gc-sections preserves hidden symbols if initial
definition has default visibility
Product: binutils
Version: 2.30 (HEAD)
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gold
Assignee: ccoutant at gmail dot com
Reporter: amonakov at gmail dot com
CC: ian at airs dot com
Target Milestone: ---
ELF spec states that the most constraining visibility is taken from all
definitions and references to the symbol to find the final visibility status.
In the following example, Gold correctly computes the final visibility (hidden,
taken from t2.o), but if t1.o comes first on the command line, Gold marks foo
as a GC root too early. The BFD linker gets this right in both cases.
t1.s:
.globl foo
foo:
.zero 4096
t2.s:
.hidden foo
.int foo-.
$ ld.gold -shared -gc-sections t2.o t1.o && size -A a.out | grep text
[no output, -gc-sections works as expected]
$ ld.gold -shared -gc-sections t1.o t2.o && size -A a.out | grep text
.text 4096 464
$ readelf -a a.out |grep foo
1: 00000000000001d0 0 NOTYPE LOCAL HIDDEN 4 foo
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-binutils