Skip to content

Commit 86d2abe

Browse files
authored
[LLD][COFF] Store __imp_ symbols as Defined in InputFile (#109115)
1 parent e06f321 commit 86d2abe

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

lld/COFF/InputFiles.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ class ImportFile : public InputFile {
349349
MachineTypes getMachineType() const override;
350350

351351
DefinedImportData *impSym = nullptr;
352-
Symbol *thunkSym = nullptr;
352+
Defined *thunkSym = nullptr;
353353
ImportThunkChunkARM64EC *impchkThunk = nullptr;
354354
std::string dllName;
355355

@@ -365,7 +365,7 @@ class ImportFile : public InputFile {
365365
// Auxiliary IAT symbols and chunks on ARM64EC.
366366
DefinedImportData *impECSym = nullptr;
367367
Chunk *auxLocation = nullptr;
368-
Symbol *auxThunkSym = nullptr;
368+
Defined *auxThunkSym = nullptr;
369369
DefinedImportData *auxImpCopySym = nullptr;
370370
Chunk *auxCopyLocation = nullptr;
371371

lld/COFF/MapFile.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,7 @@ static void getSymbols(const COFFLinkerContext &ctx,
128128
if (!file->thunkSym->isLive())
129129
continue;
130130

131-
if (auto *thunkSym = dyn_cast<Defined>(file->thunkSym))
132-
syms.push_back(thunkSym);
131+
syms.push_back(file->thunkSym);
133132

134133
if (auto *impSym = dyn_cast_or_null<Defined>(file->impSym))
135134
syms.push_back(impSym);

lld/COFF/SymbolTable.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -823,13 +823,13 @@ DefinedImportData *SymbolTable::addImportData(StringRef n, ImportFile *f,
823823
return nullptr;
824824
}
825825

826-
Symbol *SymbolTable::addImportThunk(StringRef name, DefinedImportData *id,
827-
ImportThunkChunk *chunk) {
826+
Defined *SymbolTable::addImportThunk(StringRef name, DefinedImportData *id,
827+
ImportThunkChunk *chunk) {
828828
auto [s, wasInserted] = insert(name, nullptr);
829829
s->isUsedInRegularObj = true;
830830
if (wasInserted || isa<Undefined>(s) || s->isLazy()) {
831831
replaceSymbol<DefinedImportThunk>(s, ctx, name, id, chunk);
832-
return s;
832+
return cast<Defined>(s);
833833
}
834834

835835
reportDuplicate(s, id->file);

lld/COFF/SymbolTable.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ class SymbolTable {
105105
CommonChunk *c = nullptr);
106106
DefinedImportData *addImportData(StringRef n, ImportFile *f,
107107
Chunk *&location);
108-
Symbol *addImportThunk(StringRef name, DefinedImportData *s,
109-
ImportThunkChunk *chunk);
108+
Defined *addImportThunk(StringRef name, DefinedImportData *s,
109+
ImportThunkChunk *chunk);
110110
void addLibcall(StringRef name);
111111
void addEntryThunk(Symbol *from, Symbol *to);
112112
void addExitThunk(Symbol *from, Symbol *to);

0 commit comments

Comments
 (0)