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: unassignedb...@nondot.org
          Reporter: thgar...@google.com
                CC: llvm-bugs@lists.llvm.org, pho...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to