summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/tools/lld/ELF/LinkerScript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/llvm/tools/lld/ELF/LinkerScript.cpp')
-rw-r--r--gnu/llvm/tools/lld/ELF/LinkerScript.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/gnu/llvm/tools/lld/ELF/LinkerScript.cpp b/gnu/llvm/tools/lld/ELF/LinkerScript.cpp
index 8bdbd8db20a..468c2ba80ce 100644
--- a/gnu/llvm/tools/lld/ELF/LinkerScript.cpp
+++ b/gnu/llvm/tools/lld/ELF/LinkerScript.cpp
@@ -732,6 +732,10 @@ void LinkerScript::adjustSectionsBeforeSorting() {
continue;
if (OutputSection *Sec = Cmd->Sec) {
Flags = Sec->Flags;
+
+ // Handle align (e.g. ".foo : ALIGN(16) { ... }").
+ if (Cmd->AlignExpr)
+ Sec->updateAlignment(Cmd->AlignExpr().getValue());
continue;
}
@@ -742,18 +746,18 @@ void LinkerScript::adjustSectionsBeforeSorting() {
OutSec->SectionIndex = I;
Cmd->Sec = OutSec;
SecToCommand[OutSec] = Cmd;
+
+ // Handle align (e.g. ".foo : ALIGN(16) { ... }").
+ if (Cmd->AlignExpr)
+ Cmd->Sec->updateAlignment(Cmd->AlignExpr().getValue());
}
}
void LinkerScript::adjustSectionsAfterSorting() {
// Try and find an appropriate memory region to assign offsets in.
for (BaseCommand *Base : Opt.Commands) {
- if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base)) {
+ if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base))
Cmd->MemRegion = findMemoryRegion(Cmd);
- // Handle align (e.g. ".foo : ALIGN(16) { ... }").
- if (Cmd->AlignExpr)
- Cmd->Sec->updateAlignment(Cmd->AlignExpr().getValue());
- }
}
// If output section command doesn't specify any segments,