summaryrefslogtreecommitdiff
path: root/COFF/Symbols.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-05-29 16:26:20 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-05-29 16:26:20 +0000
commitbef2946c219dc621608bcc9e47f8b973e5ef5c70 (patch)
tree1e4dfae199fc27167ed7496693938fec2dab65c2 /COFF/Symbols.cpp
parentc53addf38e24e4dafe992aafb3ae928bfa8fdb0a (diff)
Notes
Diffstat (limited to 'COFF/Symbols.cpp')
-rw-r--r--COFF/Symbols.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/COFF/Symbols.cpp b/COFF/Symbols.cpp
index 993e920ce7f7..5c185a511dd7 100644
--- a/COFF/Symbols.cpp
+++ b/COFF/Symbols.cpp
@@ -61,16 +61,19 @@ COFFSymbolRef DefinedCOFF::getCOFFSymbol() {
return COFFSymbolRef(reinterpret_cast<const coff_symbol32 *>(Sym));
}
+static Chunk *makeImportThunk(DefinedImportData *S, uint16_t Machine) {
+ if (Machine == AMD64)
+ return make<ImportThunkChunkX64>(S);
+ if (Machine == I386)
+ return make<ImportThunkChunkX86>(S);
+ assert(Machine == ARMNT);
+ return make<ImportThunkChunkARM>(S);
+}
+
DefinedImportThunk::DefinedImportThunk(StringRef Name, DefinedImportData *S,
uint16_t Machine)
- : Defined(DefinedImportThunkKind, Name) {
- switch (Machine) {
- case AMD64: Data = make<ImportThunkChunkX64>(S); return;
- case I386: Data = make<ImportThunkChunkX86>(S); return;
- case ARMNT: Data = make<ImportThunkChunkARM>(S); return;
- default: llvm_unreachable("unknown machine type");
- }
-}
+ : Defined(DefinedImportThunkKind, Name), WrappedSym(S),
+ Data(makeImportThunk(S, Machine)) {}
Defined *Undefined::getWeakAlias() {
// A weak alias may be a weak alias to another symbol, so check recursively.