summaryrefslogtreecommitdiffstats
path: root/lld/ELF/LinkerScript.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2017-04-06 21:40:22 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2017-04-06 21:40:22 +0000
commitd1960dc097f76fdb61bffb14bcee48048a2998cd (patch)
treeaa997eba74df84dfa496be5ad066e512ff6eec7a /lld/ELF/LinkerScript.cpp
parentfeed7506767533338c0f990237452e3f69de0eae (diff)
downloadbcm5719-llvm-d1960dc097f76fdb61bffb14bcee48048a2998cd.tar.gz
bcm5719-llvm-d1960dc097f76fdb61bffb14bcee48048a2998cd.zip
Call updateAlignment before assignAddresses.
The alignment expression cannot depend on '.', so we can compute it early. llvm-svn: 299717
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
-rw-r--r--lld/ELF/LinkerScript.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index d97db847304..019c4e8df2b 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -579,10 +579,6 @@ void LinkerScript::assignOffsets(OutputSectionCommand *Cmd) {
LMAOffset = [=] { return Cmd->LMAExpr().getValue() - D; };
}
- // Handle align (e.g. ".foo : ALIGN(16) { ... }").
- if (Cmd->AlignExpr)
- Sec->updateAlignment(Cmd->AlignExpr().getValue());
-
CurMemRegion = Cmd->MemRegion;
if (CurMemRegion)
Dot = CurMemRegion->Offset;
@@ -657,9 +653,14 @@ void LinkerScript::adjustSectionsAfterSorting() {
placeOrphanSections();
// Try and find an appropriate memory region to assign offsets in.
- for (BaseCommand *Base : Opt.Commands)
- if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base))
+ for (BaseCommand *Base : Opt.Commands) {
+ 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,
// and we haven't previously assigned any section to segment,
OpenPOWER on IntegriCloud