[PATCH] D84129: [ELF] -r: rewrite SHT_GROUP content if some members are combined or discarded
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 21 08:47:28 PDT 2020
MaskRay added inline comments.
================
Comment at: lld/ELF/OutputSections.cpp:393
+ seen.insert(osec->sectionIndex);
+ }
+ os->size = (1 + seen.size()) * sizeof(uint32_t);
----------------
grimar wrote:
> 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);
> ```
>
Thanks.
`for (const uint32_t &idx : section->getDataAs<uint32_t>().slice(1))`
works.
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