From 56965f4b32f6ac6234fdc59cd932d471451c0eee Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Wed, 29 Jul 2015 19:24:58 +0000 Subject: [PATCH] COFF: ARM: Fix DLL import table. The previous test was testing -flavor link. This patch correctly tests link2 and fixes a bug that we didn't emit import thunks. llvm-svn: 243559 --- lld/COFF/Symbols.cpp | 12 ++++-------- lld/test/COFF/armnt-imports.test | 7 ++++--- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/lld/COFF/Symbols.cpp b/lld/COFF/Symbols.cpp index 9b7a3fdd3fc4..5b234cf01564 100644 --- a/lld/COFF/Symbols.cpp +++ b/lld/COFF/Symbols.cpp @@ -200,14 +200,10 @@ DefinedImportThunk::DefinedImportThunk(StringRef Name, DefinedImportData *S, uint16_t Machine) : Defined(DefinedImportThunkKind, Name) { switch (Machine) { - case AMD64: - Data.reset(new ImportThunkChunkX64(S)); - return; - case I386: - Data.reset(new ImportThunkChunkX86(S)); - return; - default: - llvm_unreachable("unknown machine type"); + case AMD64: Data.reset(new ImportThunkChunkX64(S)); return; + case I386: Data.reset(new ImportThunkChunkX86(S)); return; + case ARMNT: Data.reset(new ImportThunkChunkARM(S)); return; + default: llvm_unreachable("unknown machine type"); } } diff --git a/lld/test/COFF/armnt-imports.test b/lld/test/COFF/armnt-imports.test index 01d9ebc6d19d..da2e6e9294eb 100644 --- a/lld/test/COFF/armnt-imports.test +++ b/lld/test/COFF/armnt-imports.test @@ -1,11 +1,12 @@ # RUN: yaml2obj < %s > %t.obj -# RUN: lld -flavor link /out:%t.exe /subsystem:console %t.obj %p/Inputs/library.lib +# RUN: lld -flavor link2 /out:%t.exe /subsystem:console %t.obj \ +# RUN: /entry:mainCRTStartup %p/Inputs/library.lib # RUN: llvm-readobj -coff-imports %t.exe | FileCheck %s # CHECK: Import { # CHECK: Name: library.dll -# CHECK: ImportLookupTableRVA: 0x4000 -# CHECK: ImportAddressTableRVA: 0x2000 +# CHECK: ImportLookupTableRVA: 0x2028 +# CHECK: ImportAddressTableRVA: 0x2030 # CHECK: Symbol: function (0) # CHECK: }