[PATCH] D70020: [lld] Better support for group semantic wrt. notes

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 12 11:23:37 PST 2019


MaskRay added a comment.

I think this approach may have a problem when we consider `/DISCARD/` in a linker script. I'll propose an alternative fix which I believe will improve the case and improve the compatibility with GNU ld, in the hope that you won't mind :)



================
Comment at: lld/ELF/MarkLive.cpp:362
+    bool isDependentNote =
+        (sec->type == SHT_NOTE && !sec->dependentSections.empty());
 
----------------
This is not specific to SHT_NOTE. Delete `sec->type == SHT_NOTE && `


================
Comment at: lld/test/ELF/sht-group-note.test:1
+# RUN: yaml2obj %s -o %t.o
+# RUN: ld.lld %t.o -o %t0 --gc-sections
----------------
MaskRay wrote:
> A file-level comment that describes the purpose.
> 
> Perhaps rename the test to `gc-sections-group.s`
I still think a test named `gc-sections-*.s` will be more appropriate.


================
Comment at: lld/test/ELF/sht-group-note.test:51
+    Size:            0x08
+
----------------
(Aside: is double-dot `..` in .note..text.foo intentional?)

Add at least 3 members to the group: SHT_NOTE (non-SHF_ALLOC), SHT_PROGBITS, SHT_NOBITS. Attach a symbol to each section. Add a test case for each symbol, that checks `-e sym` can retain all 3 sections.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70020





More information about the llvm-commits mailing list