[ELF] - Do not set output section flags except SHF_{ALLOC,WRITE,EXECINSTR}.
This is PR34546. Currently LLD creates output sections even if it has no input sections, but its command contains an assignment. Committed code just assigns the same flag that was used in previous live section. That does not work sometimes. For example if we have following script: .ARM.exidx : { *(.ARM.exidx*) } .foo : { _foo = 0; } } Then first section has SHF_LINK_ORDER flag. But section foo should not. That was a reason of crash in OutputSection::finalize(). LLD tried to calculate Link value, calling front() on empty input sections list. We should only keep access flags and omit all others when creating such sections. Patch fixes the crash observed. Differential revision: https://reviews.llvm.org/D37736 llvm-svn: 315441
Loading
Please register or sign in to comment