- If two group members are combined, we should leave just one index in the SHT_GROUP content.
- If a group member is discarded (/DISCARD/ or upcoming -r --gc-sections combination), we should drop its index in the SHT_GROUP content. LLD currently crashes (getOutputSection() is null).
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
This looks good to me. Regardless of whether we allow --gc-sections it will be worth getting this right for /DISCARD/. Will be worth waiting to see if there are any further comments from other reviewers.
lld/ELF/OutputSections.cpp | ||
---|---|---|
393 | 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); |
Comment Actions
Simplify endianness code with read32
lld/ELF/OutputSections.cpp | ||
---|---|---|
393 | Thanks. for (const uint32_t &idx : section->getDataAs<uint32_t>().slice(1)) works. |
I'd suggest
or more explicit, but a bit longer version: