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

            Bug ID: 31158
           Summary: ld: Should --gc-sections respect RHS of a symbol
                    assignment?
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: i at maskray dot me
  Target Milestone: ---

cat > a.s <<e
.globl _start; _start: ret
.section .rodata.bar, "a"
.global bar; bar: .quad 0x1122334455667788
e
echo 'x = bar;' > a.t
echo 'PROVIDE(x = bar);' > b.t  # not used, but worth testing
as a.s -o a.o
ld.lld --gc-sections a.o a.t -o a.lld
ld.bfd --gc-sections a.o a.t -o a.bfd
ld.gold --gc-sections a.o a.t -o a.gold

In gold and lld, the symbol assignment `x = bar;` retains .rodata.bar while BFD
doesn't:

ld.bfd: removing unused section '.rodata.bar' in file 'a.o'


Perhaps gold and lld's behavior make more sense?

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

Reply via email to