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

            Bug ID: 22649
           Summary: -gc-sections preserves hidden symbols that are also
                    visible in dynamic objects
           Product: binutils
           Version: 2.30 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: amonakov at gmail dot com
  Target Milestone: ---

Consider the follow testcase with two shared libraries:

$ cat > lib1.s
.globl foo
foo:

$ cat > lib2.s
.hidden foo
.hidden bar
.globl foo
.globl bar
foo:
bar:
call foo@PLT

$ gcc -c *.s

$ ld-new -shared -o lib1.so lib1.o

$ ld-new -shared -o lib2.so lib2.o -gc-sections -print-gc-sections
ld-new: Removing unused section '.text' in file 'lib2.o'

$ ld-new -shared -o lib2.so lib2.o -gc-sections -print-gc-sections lib1.so
[no output]

This is surprising: somehow specifying lib1.so on the command line has the
effect of pinning "foo" as a GC root.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to