[lld] [lld][ELF] Fix crash when relaxation pass encounters synthetic sections (PR #184758)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 6 00:22:00 PST 2026
wangleiat wrote:
> Do we ever get a SyntheticSection with symbols in it? Presumably if so, it would need an auxRelax to record that the symbols have moved during relaxation.
Thanks for the review!
Even if a SyntheticSection contains symbols, it doesn't need a relaxAux. The relaxAux (and specifically its anchors) is used to adjust the relative offsets of symbols within the same InputSection when some bytes/instructions inside that section are deleted/relaxed.
For a SyntheticSection, its internal content is never shrunk during the relaxation pass, so the relative offsets of any symbols defined in it remain constant. If an ordinary InputSection preceding it shrinks, the entire SyntheticSection shifts. This whole-section shift is naturally handled by the linker when it recalculates the section's outSecOff, which automatically updates the final VAs of the symbols within it. Therefore, no relaxAux is needed to record intra-section symbol movements for synthetic sections.
https://github.com/llvm/llvm-project/pull/184758
More information about the llvm-commits
mailing list