summaryrefslogtreecommitdiffstats
path: root/lld/ELF/LinkerScript.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2017-04-06 21:31:24 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2017-04-06 21:31:24 +0000
commitfeed7506767533338c0f990237452e3f69de0eae (patch)
tree0f625caa07b8572976b839e1ab26c10976a095f1 /lld/ELF/LinkerScript.cpp
parenta521c30dc6a6a81040a02e405aa1b671e8687059 (diff)
downloadbcm5719-llvm-feed7506767533338c0f990237452e3f69de0eae.tar.gz
bcm5719-llvm-feed7506767533338c0f990237452e3f69de0eae.zip
Move call to findMemoryRegion before assignAddresses.
This removes a bit more work from assignAddresses. llvm-svn: 299716
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
-rw-r--r--lld/ELF/LinkerScript.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index f20dbff3f31..d97db847304 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -583,8 +583,7 @@ void LinkerScript::assignOffsets(OutputSectionCommand *Cmd) {
if (Cmd->AlignExpr)
Sec->updateAlignment(Cmd->AlignExpr().getValue());
- // Try and find an appropriate memory region to assign offsets in.
- CurMemRegion = findMemoryRegion(Cmd);
+ CurMemRegion = Cmd->MemRegion;
if (CurMemRegion)
Dot = CurMemRegion->Offset;
switchTo(Sec);
@@ -657,6 +656,11 @@ void LinkerScript::adjustSectionsBeforeSorting() {
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))
+ Cmd->MemRegion = findMemoryRegion(Cmd);
+
// If output section command doesn't specify any segments,
// and we haven't previously assigned any section to segment,
// then we simply assign section to the very first load segment.
OpenPOWER on IntegriCloud