mirror of
https://github.com/intel/llvm.git
synced 2026-01-25 01:07:04 +08:00
[Object] Use COFF archive format for import libraries.
This is similar to D143540 for import libraries. ARM64EC will need it for EC symbol table, but it should be fine for other targets as well and it improves MSVC compatibility. I left mingw case unchanged to be safe, although I think that it wouldn't hurt to change that as well. The visible effect in tests is a sorted symbol map. Revieved By: mstorsjo Differential Revision: https://reviews.llvm.org/D156473
This commit is contained in:
@@ -68,10 +68,10 @@ CHECK6-NOT: duplicate /export option: exportfn1
|
||||
# RUN: llvm-nm -M %t.lib | FileCheck --check-prefix=SYMTAB %s
|
||||
|
||||
SYMTAB: __imp_exportfn1 in export.test.tmp.DLL
|
||||
SYMTAB: exportfn1 in export.test.tmp.DLL
|
||||
SYMTAB: __imp_exportfn2 in export.test.tmp.DLL
|
||||
SYMTAB: exportfn2 in export.test.tmp.DLL
|
||||
SYMTAB: __imp_exportfn3 in export.test.tmp.DLL
|
||||
SYMTAB: exportfn1 in export.test.tmp.DLL
|
||||
SYMTAB: exportfn2 in export.test.tmp.DLL
|
||||
SYMTAB: exportfn3 in export.test.tmp.DLL
|
||||
|
||||
# RUN: lld-link /out:%t.dll /dll %t.obj /export:foo=kernel32.foobar
|
||||
|
||||
@@ -611,7 +611,7 @@ Error writeImportLibrary(StringRef ImportName, StringRef Path,
|
||||
}
|
||||
|
||||
return writeArchive(Path, Members, /*WriteSymtab*/ true,
|
||||
object::Archive::K_GNU,
|
||||
MinGW ? object::Archive::K_GNU : object::Archive::K_COFF,
|
||||
/*Deterministic*/ true, /*Thin*/ false);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
; RUN: llvm-dlltool -m i386:x86-64 --input-def %s --output-lib %t.a
|
||||
; RUN: llvm-readobj %t.a | FileCheck %s
|
||||
; RUN: llvm-nm --print-armap %t.a | FileCheck --check-prefix=SYMTAB %s
|
||||
; RUN: llvm-dlltool -m arm64 --input-def %s --output-lib %t.a
|
||||
; RUN: llvm-readobj %t.a | FileCheck %s
|
||||
; RUN: llvm-nm --print-armap %t.a | FileCheck --check-prefix=SYMTAB %s
|
||||
|
||||
LIBRARY test.dll
|
||||
EXPORTS
|
||||
TestFunction1
|
||||
TestFunction2;
|
||||
TestFunction3 ; This is a comment
|
||||
AnotherFunction
|
||||
|
||||
; CHECK: File: test.dll
|
||||
; CHECK: Format: COFF-import-file
|
||||
@@ -21,3 +24,9 @@ TestFunction3 ; This is a comment
|
||||
; CHECK: Name type: name
|
||||
; CHECK-NEXT: Symbol: __imp_TestFunction3{{$}}
|
||||
; CHECK-NEXT: Symbol: TestFunction3{{$}}
|
||||
|
||||
; SYMTAB: Archive map
|
||||
; SYMTAB: TestFunction1 in test.dll
|
||||
; SYMTAB: TestFunction2 in test.dll
|
||||
; SYMTAB: TestFunction3 in test.dll
|
||||
; SYMTAB: AnotherFunction in test.dll
|
||||
|
||||
@@ -13,7 +13,12 @@ CHECK: lib.dll
|
||||
|
||||
Test that import libraries can be created from a def file
|
||||
|
||||
RUN: echo -e "NAME lib.dll\nEXPORTS\nMyFunc" > %t/implib.def
|
||||
RUN: echo -e "NAME lib.dll\nEXPORTS\nMyFunc\nAnotherFunc" > %t/implib.def
|
||||
RUN: llvm-lib -out:%t/implib.lib -def:%t/implib.def -machine:x64
|
||||
|
||||
RUN: llvm-ar t %t/implib.lib | FileCheck %s
|
||||
|
||||
RUN: llvm-nm --print-armap %t/implib.lib | FileCheck --check-prefix=SYMTAB %s
|
||||
SYMTAB: Archive map
|
||||
SYMTAB-NEXT: AnotherFunc in lib.dll
|
||||
SYMTAB-NEXT: MyFunc in lib.dll
|
||||
|
||||
Reference in New Issue
Block a user