[PATCH] D156473: [Object] Use COFF archive format for import libraries.
Jacek Caban via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 28 05:29:26 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbacc7aebb9b9: [Object] Use COFF archive format for import libraries. (authored by jacek).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156473/new/
https://reviews.llvm.org/D156473
Files:
lld/test/COFF/export.test
llvm/lib/Object/COFFImportFile.cpp
llvm/test/tools/llvm-dlltool/coff-exports.def
llvm/test/tools/llvm-lib/implibs.test
Index: llvm/test/tools/llvm-lib/implibs.test
===================================================================
--- llvm/test/tools/llvm-lib/implibs.test
+++ llvm/test/tools/llvm-lib/implibs.test
@@ -13,7 +13,12 @@
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
Index: llvm/test/tools/llvm-dlltool/coff-exports.def
===================================================================
--- llvm/test/tools/llvm-dlltool/coff-exports.def
+++ llvm/test/tools/llvm-dlltool/coff-exports.def
@@ -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 @@
; 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
Index: llvm/lib/Object/COFFImportFile.cpp
===================================================================
--- llvm/lib/Object/COFFImportFile.cpp
+++ llvm/lib/Object/COFFImportFile.cpp
@@ -611,7 +611,7 @@
}
return writeArchive(Path, Members, /*WriteSymtab*/ true,
- object::Archive::K_GNU,
+ MinGW ? object::Archive::K_GNU : object::Archive::K_COFF,
/*Deterministic*/ true, /*Thin*/ false);
}
Index: lld/test/COFF/export.test
===================================================================
--- lld/test/COFF/export.test
+++ lld/test/COFF/export.test
@@ -68,10 +68,10 @@
# 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156473.545110.patch
Type: text/x-patch
Size: 2933 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230728/05d11726/attachment.bin>
More information about the llvm-commits
mailing list