[lld] a05b694 - [ELF][NFC] Do not pass region name to expandMemoryRegion()
Igor Kudrin via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 21 23:19:23 PST 2021
Author: Igor Kudrin
Date: 2021-11-22T14:19:07+07:00
New Revision: a05b694b1e1d742d7702c1774abfaf98f502f04b
URL: https://github.com/llvm/llvm-project/commit/a05b694b1e1d742d7702c1774abfaf98f502f04b
DIFF: https://github.com/llvm/llvm-project/commit/a05b694b1e1d742d7702c1774abfaf98f502f04b.diff
LOG: [ELF][NFC] Do not pass region name to expandMemoryRegion()
The name can be easily got on-site.
Differential Revision: https://reviews.llvm.org/D114228
Added:
Modified:
lld/ELF/LinkerScript.cpp
Removed:
################################################################################
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 6657f21af6758..40127baf40d6b 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -163,23 +163,22 @@ OutputSection *LinkerScript::getOrCreateOutputSection(StringRef name) {
// Expands the memory region by the specified size.
static void expandMemoryRegion(MemoryRegion *memRegion, uint64_t size,
- StringRef regionName, StringRef secName) {
+ StringRef secName) {
memRegion->curPos += size;
uint64_t newSize = memRegion->curPos - (memRegion->origin)().getValue();
uint64_t length = (memRegion->length)().getValue();
if (newSize > length)
- error("section '" + secName + "' will not fit in region '" + regionName +
- "': overflowed by " + Twine(newSize - length) + " bytes");
+ error("section '" + secName + "' will not fit in region '" +
+ memRegion->name + "': overflowed by " + Twine(newSize - length) +
+ " bytes");
}
void LinkerScript::expandMemoryRegions(uint64_t size) {
if (ctx->memRegion)
- expandMemoryRegion(ctx->memRegion, size, ctx->memRegion->name,
- ctx->outSec->name);
+ expandMemoryRegion(ctx->memRegion, size, ctx->outSec->name);
// Only expand the LMARegion if it is
diff erent from memRegion.
if (ctx->lmaRegion && ctx->memRegion != ctx->lmaRegion)
- expandMemoryRegion(ctx->lmaRegion, size, ctx->lmaRegion->name,
- ctx->outSec->name);
+ expandMemoryRegion(ctx->lmaRegion, size, ctx->outSec->name);
}
void LinkerScript::expandOutputSection(uint64_t size) {
@@ -1026,7 +1025,7 @@ void LinkerScript::assignOffsets(OutputSection *sec) {
// between the previous section, if any, and the start of this section.
if (ctx->memRegion && ctx->memRegion->curPos < dot)
expandMemoryRegion(ctx->memRegion, dot - ctx->memRegion->curPos,
- ctx->memRegion->name, sec->name);
+ sec->name);
}
switchTo(sec);
@@ -1042,7 +1041,7 @@ void LinkerScript::assignOffsets(OutputSection *sec) {
} else if (MemoryRegion *mr = sec->lmaRegion) {
uint64_t lmaStart = alignTo(mr->curPos, sec->alignment);
if (mr->curPos < lmaStart)
- expandMemoryRegion(mr, lmaStart - mr->curPos, mr->name, sec->name);
+ expandMemoryRegion(mr, lmaStart - mr->curPos, sec->name);
ctx->lmaOffset = lmaStart - dot;
} else if (!sameMemRegion || !prevLMARegionIsDefault) {
ctx->lmaOffset = 0;
More information about the llvm-commits
mailing list