- XXX no comment Index: lld/ELF/LinkerScript.cpp --- lld/ELF/LinkerScript.cpp.orig +++ lld/ELF/LinkerScript.cpp @@ -954,7 +954,6 @@ void LinkerScript::assignOffsets(OutputSection *sec) { ctx->memRegion->name, sec->name); } - switchTo(sec); // ctx->lmaOffset is LMA minus VMA. If LMA is explicitly specified via AT() or // AT>, recompute ctx->lmaOffset; otherwise, if both previous/current LMA @@ -968,6 +967,8 @@ void LinkerScript::assignOffsets(OutputSection *sec) { ctx->lmaOffset = alignTo(mr->curPos, sec->alignment) - dot; else if (!sameMemRegion || !prevLMARegionIsDefault) ctx->lmaOffset = 0; + + switchTo(sec); // Propagate ctx->lmaOffset to the first "non-header" section. if (PhdrEntry *l = ctx->outSec->ptLoad)