[PATCH] D70146: [ELF] Improve --gc-sections compatibility with GNU ld regarding section groups

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 02:04:16 PST 2019


grimar added a comment.

FTR, I also think I have no objections. A few minor nits are inline.



================
Comment at: lld/ELF/InputFiles.cpp:619
+  for (ArrayRef<Elf_Word> entries : selectedGroups) {
+    InputSectionBase *head, *prev = nullptr;
+    for (uint32_t secIndex : entries.slice(1)) {
----------------
nit: I so not think that we declare more than one variable on a line in the LLD code.
Personally I find it OK for my pet projects, but this probably violates the LLD style, so ...


================
Comment at: lld/ELF/InputFiles.cpp:621
+    for (uint32_t secIndex : entries.slice(1)) {
+      InputSectionBase *s = this->sections[secIndex];
+      if (s && s != &InputSection::discarded) {
----------------
use `continue`?


================
Comment at: lld/test/ELF/linkerscript/discard-group.s:1
+# REQUIRES: arm
+## For --gc-sections, group members are retained or discarded as a unit.
----------------
Why arm? Can this be x86?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70146





More information about the llvm-commits mailing list