Skip to content

Commit d5f077c

Browse files
committed
[ELF] Simplify assignOffsets. NFC
1 parent 215f92b commit d5f077c

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

lld/ELF/LinkerScript.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,17 +1061,14 @@ void LinkerScript::assignOffsets(OutputSection *sec) {
10611061
}
10621062

10631063
state->outSec = sec;
1064-
if (sec->addrExpr && script->hasSectionsCommand) {
1065-
// The alignment is ignored.
1066-
sec->addr = dot;
1067-
} else {
1068-
// sec->alignment is the max of ALIGN and the maximum of input
1069-
// section alignments.
1064+
if (!(sec->addrExpr && script->hasSectionsCommand)) {
1065+
// ALIGN is respected. sec->alignment is the max of ALIGN and the maximum of
1066+
// input section alignments.
10701067
const uint64_t pos = dot;
10711068
dot = alignToPowerOf2(dot, sec->addralign);
1072-
sec->addr = dot;
10731069
expandMemoryRegions(dot - pos);
10741070
}
1071+
sec->addr = dot;
10751072

10761073
// state->lmaOffset is LMA minus VMA. If LMA is explicitly specified via AT()
10771074
// or AT>, recompute state->lmaOffset; otherwise, if both previous/current LMA

0 commit comments

Comments
 (0)