Skip to content

Commit 4beffdd

Browse files
committed
[LLD][COFF] Store __imp_ symbols as Defined in InputFile
1 parent 43c9203 commit 4beffdd

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(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
@@ -815,13 +815,13 @@ DefinedImportData *SymbolTable::addImportData(StringRef n, ImportFile *f,
815815
return nullptr;
816816
}
817817

818-
Symbol *SymbolTable::addImportThunk(StringRef name, DefinedImportData *id,
819-
ImportThunkChunk *chunk) {
818+
Defined *SymbolTable::addImportThunk(StringRef name, DefinedImportData *id,
819+
ImportThunkChunk *chunk) {
820820
auto [s, wasInserted] = insert(name, nullptr);
821821
s->isUsedInRegularObj = true;
822822
if (wasInserted || isa<Undefined>(s) || s->isLazy()) {
823823
replaceSymbol<DefinedImportThunk>(s, ctx, name, id, chunk);
824-
return s;
824+
return cast<Defined>(s);
825825
}
826826

827827
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)