mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 15:41:46 +00:00
[ELF] Simplify/remove LinkerScript::switchTo. NFC
This commit is contained in:
parent
01eb91fa86
commit
89c0f4553e
@ -900,22 +900,6 @@ void LinkerScript::diagnoseOrphanHandling() const {
|
||||
}
|
||||
}
|
||||
|
||||
void LinkerScript::switchTo(OutputSection *sec) {
|
||||
ctx->outSec = sec;
|
||||
|
||||
const uint64_t pos = dot;
|
||||
if (sec->addrExpr && script->hasSectionsCommand) {
|
||||
// The alignment is ignored.
|
||||
ctx->outSec->addr = pos;
|
||||
} else {
|
||||
// ctx->outSec->alignment is the max of ALIGN and the maximum of input
|
||||
// section alignments.
|
||||
dot = alignTo(dot, ctx->outSec->alignment);
|
||||
ctx->outSec->addr = dot;
|
||||
expandMemoryRegions(dot - pos);
|
||||
}
|
||||
}
|
||||
|
||||
// This function searches for a memory region to place the given output
|
||||
// section in. If found, a pointer to the appropriate memory region is
|
||||
// returned in the first member of the pair. Otherwise, a nullptr is returned.
|
||||
@ -1004,7 +988,18 @@ void LinkerScript::assignOffsets(OutputSection *sec) {
|
||||
sec->name);
|
||||
}
|
||||
|
||||
switchTo(sec);
|
||||
ctx->outSec = sec;
|
||||
if (sec->addrExpr && script->hasSectionsCommand) {
|
||||
// The alignment is ignored.
|
||||
ctx->outSec->addr = dot;
|
||||
} else {
|
||||
// ctx->outSec->alignment is the max of ALIGN and the maximum of input
|
||||
// section alignments.
|
||||
const uint64_t pos = dot;
|
||||
dot = alignTo(dot, ctx->outSec->alignment);
|
||||
ctx->outSec->addr = dot;
|
||||
expandMemoryRegions(dot - pos);
|
||||
}
|
||||
|
||||
// ctx->lmaOffset is LMA minus VMA. If LMA is explicitly specified via AT() or
|
||||
// AT>, recompute ctx->lmaOffset; otherwise, if both previous/current LMA
|
||||
@ -1316,7 +1311,7 @@ const Defined *LinkerScript::assignAddresses() {
|
||||
AddressState state;
|
||||
ctx = &state;
|
||||
errorOnMissingSection = true;
|
||||
switchTo(aether);
|
||||
ctx->outSec = aether;
|
||||
|
||||
SymbolAssignmentMap oldValues = getSymbolAssignmentValues(sectionCommands);
|
||||
for (SectionCommand *cmd : sectionCommands) {
|
||||
|
@ -292,8 +292,6 @@ class LinkerScript final {
|
||||
std::pair<MemoryRegion *, MemoryRegion *>
|
||||
findMemoryRegion(OutputSection *sec, MemoryRegion *hint);
|
||||
|
||||
void switchTo(OutputSection *sec);
|
||||
|
||||
void assignOffsets(OutputSection *sec);
|
||||
|
||||
// Ctx captures the local AddressState and makes it accessible
|
||||
|
Loading…
Reference in New Issue
Block a user