Using .eh_frame input section pattern in linker script currently causes a crash; this is because .eh_frame input sections require special handling since they're all combined into a synthetic section rather than regular output section.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
SHF_MERGE sections are also handled in a special way because they are aggregated one synthetic section (which is done in combineMergableSections in Writer.cpp). Maybe we should do the same thing for .eh_frame? At least they need to be consistent.
I tried to use the same handling as in case of combineMergableSections, let me know if this makes sense.
ELF/SyntheticSections.cpp | ||
---|---|---|
507–508 ↗ | (On Diff #90783) | But when the control reached Writer::run function, all garbage has already been gc'ed, no? |
ELF/SyntheticSections.cpp | ||
---|---|---|
507–508 ↗ | (On Diff #90783) | Not necessarily, for example you can have /DISCARD/ : { *(.eh_frame) } in the linker script which only gets processed in LinkerScript::processCommands. |
LGTM
ELF/SyntheticSections.cpp | ||
---|---|---|
507–508 ↗ | (On Diff #90783) | Ah, that's right. Somewhat orthogonal, but can you avoid using std::move and just copy? I don't think we need memory here. |
This patch causes crash, when creating PT_GNU_EH_FRAME segment in Writer<ELFT>::createPhdrs (OutSec is nullptr) in case .eh_frame section is discarded in linker script.