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

            Bug ID: 20022
           Summary: --gc-sections is broken with __start_ and shared
                    library
           Product: binutils
           Version: 2.27 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

When a __start_ symbol is defined both .o and .so, --gc-sections
drops the definition on .o:

[hjl@gnu-6 gc-4]$ cat a.s
.globl _start
_start:
        .dc.a   __start__foo
        .dc.a   bar
        .section        _foo,"aw",%progbits
foo:
        .ascii "This is "
[hjl@gnu-6 gc-4]$ cat c.s
.globl bar
bar:
        .dc.a   __start__foo
        .section        _foo,"aw",%progbits
foo:
        .ascii "This is "
[hjl@gnu-6 gc-4]$ make
gcc  -B./ -fdata-sections -c -o a.o a.s
gcc  -B./ -fdata-sections -c -o c.o c.s
./ld -shared --gc-sections -o c.so c.o
./ld --gc-sections -o x a.o c.so
./ld: warning: type and size of dynamic symbol `__start__foo' are not defined
./ld: warning: type and size of dynamic symbol `bar' are not defined
./ld -o y a.o c.so
./ld: warning: type and size of dynamic symbol `bar' are not defined
objdump -s -j _foo y

y:     file format elf64-x86-64

Contents of section _foo:
 600338 54686973 20697320                    This is         
objdump -s -j _foo x

x:     file format elf64-x86-64

objdump: section '_foo' mentioned in a -j option, but not found in any input
file
Makefile:11: recipe for target 'all' failed
make: *** [all] Error 1
[hjl@gnu-6 gc-4]$

-- 
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