[PATCH] D84129: [ELF] -r: rewrite SHT_GROUP content if some members are combined or discarded

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 21 01:44:06 PDT 2020


grimar added inline comments.


================
Comment at: lld/ELF/OutputSections.cpp:393
+        seen.insert(osec->sectionIndex);
+  }
+  os->size = (1 + seen.size()) * sizeof(uint32_t);
----------------
I'd suggest

```
for (uint32_t idx : section->getDataAs<uint32_t>().slice(1))
    if (OutputSection *osec = sections[read32(&idx)]->getOutputSection())
      seen.insert(osec->sectionIndex);
```

or more explicit, but a bit longer version:

```
  for (uint32_t idx : section->getDataAs<uint32_t>().slice(1))
    if (OutputSection *osec =
            sections[byte_swap(idx, config->endianness)]->getOutputSection())
      seen.insert(osec->sectionIndex);
```



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84129





More information about the llvm-commits mailing list