Skip to content

Commit

Permalink
[ELF] Simplify assignOffsets. NFC
Browse files Browse the repository at this point in the history
  • Loading branch information
MaskRay committed May 30, 2024
1 parent 215f92b commit d5f077c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lld/ELF/LinkerScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1061,17 +1061,14 @@ void LinkerScript::assignOffsets(OutputSection *sec) {
}

state->outSec = sec;
if (sec->addrExpr && script->hasSectionsCommand) {
// The alignment is ignored.
sec->addr = dot;
} else {
// sec->alignment is the max of ALIGN and the maximum of input
// section alignments.
if (!(sec->addrExpr && script->hasSectionsCommand)) {
// ALIGN is respected. sec->alignment is the max of ALIGN and the maximum of
// input section alignments.
const uint64_t pos = dot;
dot = alignToPowerOf2(dot, sec->addralign);
sec->addr = dot;
expandMemoryRegions(dot - pos);
}
sec->addr = dot;

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

0 comments on commit d5f077c

Please sign in to comment.