Skip to content

Commit fc4c2c7

Browse files
committed
Use firstInOverlay instead of lastInOverlay
1 parent 48e75b7 commit fc4c2c7

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

lld/ELF/LinkerScript.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,8 @@ bool LinkerScript::assignOffsets(OutputSection *sec) {
12291229
// We can call this method multiple times during the creation of
12301230
// thunks and want to start over calculation each time.
12311231
sec->size = 0;
1232+
if (sec->firstInOverlay)
1233+
state->overlaySize = 0;
12321234

12331235
// We visited SectionsCommands from processSectionCommands to
12341236
// layout sections. Now, we visit SectionsCommands again to fix
@@ -1284,8 +1286,6 @@ bool LinkerScript::assignOffsets(OutputSection *sec) {
12841286
// NOBITS TLS sections are similar. Additionally save the end address.
12851287
state->tbssAddr = dot;
12861288
dot = savedDot;
1287-
} else if (sec->lastInOverlay) {
1288-
state->overlaySize = 0;
12891289
}
12901290
return addressChanged;
12911291
}

lld/ELF/LinkerScript.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ class LinkerScript final {
311311
MemoryRegion *lmaRegion = nullptr;
312312
uint64_t lmaOffset = 0;
313313
uint64_t tbssAddr = 0;
314-
uint64_t overlaySize = 0;
314+
uint64_t overlaySize;
315315
};
316316

317317
Ctx &ctx;

lld/ELF/OutputSections.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class OutputSection final : public SectionBase {
102102
bool expressionsUseSymbols = false;
103103
bool usedInExpression = false;
104104
bool inOverlay = false;
105-
bool lastInOverlay = false;
105+
bool firstInOverlay = false;
106106

107107
// Tracks whether the section has ever had an input section added to it, even
108108
// if the section was later removed (e.g. because it is a synthetic section

lld/ELF/ScriptParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ SmallVector<SectionCommand *, 0> ScriptParser::readOverlay() {
588588
prev = &osd->osec;
589589
}
590590
if (!v.empty())
591-
static_cast<OutputDesc *>(v.back())->osec.lastInOverlay = true;
591+
static_cast<OutputDesc *>(v.front())->osec.firstInOverlay = true;
592592
if (consume(">")) {
593593
StringRef regionName = readName();
594594
for (SectionCommand *od : v)

0 commit comments

Comments
 (0)