[llvm-bugs] [Bug 34836] New: --gc-sections remove relocations from --emit-relocs

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 4 12:20:14 PDT 2017


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

            Bug ID: 34836
           Summary: --gc-sections remove relocations from --emit-relocs
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: thgarnie at google.com
                CC: llvm-bugs at lists.llvm.org, phosek at chromium.org

This bug is related to Zircon/Magenta kernel where --gc-sections is used and we
would like to use --emit-relocs to generate relocations to analyze and filter.

When using --gc-sections and --emit-relocs together, all the relocations
sections are always stripped being on the small assembly I pasted below or the
Zircon kernel. Using the binutils linker, these sections are not stripped.

Output from lld with --gc-sections + --emit-relocs and --print-gc-sections:

GCC / LLD ---
removing unused section from '.rela.text' in file './test_gcc.o'
removing unused section from '.data' in file './test_gcc.o'
removing unused section from '.bss' in file './test_gcc.o'
removing unused section from '.rela.debug_line' in file './test_gcc.o'
removing unused section from '.rela.debug_info' in file './test_gcc.o'
removing unused section from '.rela.debug_aranges' in file './test_gcc.o'

readelf -r: There are no relocations in this file.
CLANG / LLD ---
removing unused section from '.rela.text' in file './test_clang.o'
removing unused section from '.rela.debug_info' in file './test_clang.o'
removing unused section from '.rela.debug_aranges' in file './test_clang.o'
removing unused section from '.rela.debug_line' in file './test_clang.o'

readelf -r: There are no relocations in this file.

The symbol assembly file I used to test:

.global _start
.text

relocs:
.quad _start

_start:
  movabs $relocs, %rax
  ret
---

-- 
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/20171004/6628c78b/attachment.html>


More information about the llvm-bugs mailing list