COFF: ARM: Fix DLL import table.
authorRui Ueyama <ruiu@google.com>
Wed, 29 Jul 2015 19:24:58 +0000 (19:24 +0000)
committerRui Ueyama <ruiu@google.com>
Wed, 29 Jul 2015 19:24:58 +0000 (19:24 +0000)
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
lld/test/COFF/armnt-imports.test

index 9b7a3fd..5b234cf 100644 (file)
@@ -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");
   }
 }
 
index 01d9ebc..da2e6e9 100644 (file)
@@ -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: }