[llvm-bugs] [Bug 37782] New: --discard-all is not supported with -r output

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 12 07:25:27 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37782

            Bug ID: 37782
           Summary: --discard-all is not supported with -r output
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: jh7370.2008 at my.bristol.ac.uk
                CC: llvm-bugs at lists.llvm.org

In normal links, the --discard* family of options throws away certain symbols,
depending on the nature of the output and which exact switch is specified. We
do not support this switch at all for relocatable output. At least for some
situations, there is no reason not to, that I'm aware of.

This seems to have been implemented as the fix to bug 31252, which prevents any
discarding for relocatable output, to prevent discarding of certain temporary
symbols. Whilst this behaviour should be the default, it shouldn't, in my
opinion, be the behaviour when --discard* switches are explicitly specified.
Note that ld.bfd follows a different approach:

// test.s
.local local
local:
        ret

.global global
global:
        ret

> clang -c test.s
> ld.lld -r --discard-all test.o -o test.ro
> llvm-objdump -t test.ro
test.ro:        file format ELF64-x86-64

SYMBOL TABLE:
0000000000000000         *UND*           00000000 
0000000000000000         .text           00000000 local
0000000000000000 l    d  .text           00000000 .text
0000000000000000 l    d  .data           00000000 .data
0000000000000000 l    d  .bss            00000000 .bss
0000000000000001         .text           00000000 global

> ld.bfd -r --discard-all test.o -o test.ro
> llvm-objdump -t test.ro
test.ro:        file format ELF64-x86-64

SYMBOL TABLE:
0000000000000000         *UND*           00000000 
0000000000000000 l    d  .text           00000000 .text
0000000000000000 l    d  .data           00000000 .data
0000000000000000 l    d  .bss            00000000 .bss
0000000000000001         .text           00000000 global

Note that "local" has not been discarded.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180612/2509a605/attachment-0001.html>


More information about the llvm-bugs mailing list