Fix PR48357: If .rela.dyn appears as an output section description, its type may
be SHT_RELA (due to the empty synthetic .rela.plt) while there is no input
section. The empty .rela.dyn may be retained due to a reference in a linker
script. Don't crash.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
lld/ELF/OutputSections.cpp | ||
---|---|---|
406 | I wonder if the same crash can happen here with an empty .ARM.exidx? |
lld/ELF/OutputSections.cpp | ||
---|---|---|
406 | It can't (I believe flags & SHF_LINK_ORDER ensures there is at least one input section but it is very late for me and I don't think carefully though:( ) There are many arm-exidx-* tests and someone may need to check whether this is missing test coverage. |
lld/ELF/OutputSections.cpp | ||
---|---|---|
406 | SHF_LINK_ORDER case seems is fine. We don't keep any special flags for empty output // We do not want to keep any special flags for output section // in case it is empty. bool isEmpty = (getFirstInputSection(sec) == nullptr); if (isEmpty) sec->flags = flags & ((sec->nonAlloc ? 0 : (uint64_t)SHF_ALLOC) | SHF_WRITE | SHF_EXECINSTR); |
I wonder if the same crash can happen here with an empty .ARM.exidx?