diff options
author | Ed Maste <emaste@FreeBSD.org> | 2018-01-29 13:51:13 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2018-01-29 13:51:13 +0000 |
commit | 5a2ea378293c326f57887af181348b54a461ebe3 (patch) | |
tree | c7a4411c129fe80678a648f234c861ecf54b909f /contrib/llvm | |
parent | 6fcb8605eff70d59ffa94679695b8cec10b2aee1 (diff) | |
download | src-5a2ea378293c326f57887af181348b54a461ebe3.tar.gz src-5a2ea378293c326f57887af181348b54a461ebe3.zip |
lld: Simplify. NFC.
Obtained from: LLVM r323440 by Rafael Espindola
Notes
Notes:
svn path=/head/; revision=328545
Diffstat (limited to 'contrib/llvm')
-rw-r--r-- | contrib/llvm/tools/lld/ELF/LinkerScript.cpp | 14 | ||||
-rw-r--r-- | contrib/llvm/tools/lld/ELF/LinkerScript.h | 2 |
2 files changed, 6 insertions, 10 deletions
diff --git a/contrib/llvm/tools/lld/ELF/LinkerScript.cpp b/contrib/llvm/tools/lld/ELF/LinkerScript.cpp index 6bd5d0ff7b21..86932736b786 100644 --- a/contrib/llvm/tools/lld/ELF/LinkerScript.cpp +++ b/contrib/llvm/tools/lld/ELF/LinkerScript.cpp @@ -656,22 +656,18 @@ void LinkerScript::assignOffsets(OutputSection *Sec) { switchTo(Sec); - if (Sec->LMAExpr) { - uint64_t D = Dot; - Ctx->LMAOffset = [=] { return Sec->LMAExpr().getValue() - D; }; - } + if (Sec->LMAExpr) + Ctx->LMAOffset = Sec->LMAExpr().getValue() - Dot; - if (MemoryRegion *MR = Sec->LMARegion) { - uint64_t Offset = MR->Origin - Dot; - Ctx->LMAOffset = [=] { return Offset; }; - } + if (MemoryRegion *MR = Sec->LMARegion) + Ctx->LMAOffset = MR->Origin - Dot; // If neither AT nor AT> is specified for an allocatable section, the linker // will set the LMA such that the difference between VMA and LMA for the // section is the same as the preceding output section in the same region // https://sourceware.org/binutils/docs-2.20/ld/Output-Section-LMA.html if (Ctx->LMAOffset) - Ctx->OutSec->LMAOffset = Ctx->LMAOffset(); + Ctx->OutSec->LMAOffset = Ctx->LMAOffset; // The Size previously denoted how many InputSections had been added to this // section, and was used for sorting SHF_LINK_ORDER sections. Reset it to diff --git a/contrib/llvm/tools/lld/ELF/LinkerScript.h b/contrib/llvm/tools/lld/ELF/LinkerScript.h index f23da42e359a..ea8b7098163a 100644 --- a/contrib/llvm/tools/lld/ELF/LinkerScript.h +++ b/contrib/llvm/tools/lld/ELF/LinkerScript.h @@ -206,7 +206,7 @@ class LinkerScript final { uint64_t ThreadBssOffset = 0; OutputSection *OutSec = nullptr; MemoryRegion *MemRegion = nullptr; - std::function<uint64_t()> LMAOffset; + uint64_t LMAOffset = 0; }; llvm::DenseMap<StringRef, OutputSection *> NameToOutputSection; |