[PATCH] D78389: [ELF] Keep local symbols when both --emit-relocs and --discard-all are specified

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 21 08:37:14 PDT 2020


MaskRay added inline comments.


================
Comment at: lld/test/ELF/emit-relocs-discard-locals.s:26-27
+# SYM-NOGC-NEXT: SECTION LOCAL  DEFAULT    3 unreferenced
+# SYM-NEXT:      SECTION LOCAL  DEFAULT    {{.*}} .comment
+# SYM-NEXT:      NOTYPE  GLOBAL DEFAULT    1 _start
+
----------------
ikudrin wrote:
> MaskRay wrote:
> > ikudrin wrote:
> > > Do we really need to check the symbols which are not important to the fix? Unnecessary details make the test fragile.
> > The STT_SECTION symbols (also STB_LOCAL) are actually an interesting cast which was neglected. I add them for coverage. I am careful and will not intentionally add useless tests.
> I meant `.text`, `.comment` and `_start`, not `text` and `unreferenced`. And I would have probably removed the section indexes for all symbols.
`unreferenced` demonstrates that `--discard-locals` does not discard the STT_SECTION symbol associated with a GCed section.`--gc-sections` can discard such symbols.

`text` represents a subset of STB_LOCAL symbols (STT_SECTION).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78389/new/

https://reviews.llvm.org/D78389





More information about the llvm-commits mailing list