File tree Expand file tree Collapse file tree 4 files changed +17
-5
lines changed Expand file tree Collapse file tree 4 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -1171,7 +1171,7 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr) {
1171
1171
}
1172
1172
}
1173
1173
1174
- if (!args.hasArg (OPT_INPUT)) {
1174
+ if (!args.hasArg (OPT_INPUT, OPT_wholearchive_file )) {
1175
1175
if (args.hasArg (OPT_deffile))
1176
1176
config->noEntry = true ;
1177
1177
else
@@ -1700,7 +1700,7 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr) {
1700
1700
}
1701
1701
1702
1702
// Handle generation of import library from a def file.
1703
- if (!args.hasArg (OPT_INPUT)) {
1703
+ if (!args.hasArg (OPT_INPUT, OPT_wholearchive_file )) {
1704
1704
fixupExports ();
1705
1705
createImportLibrary (/* asLib=*/ true );
1706
1706
return ;
@@ -1749,8 +1749,8 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr) {
1749
1749
1750
1750
// Set default image name if neither /out or /def set it.
1751
1751
if (config->outputFile .empty ()) {
1752
- config->outputFile =
1753
- getOutputPath (( *args.filtered (OPT_INPUT).begin ())->getValue ());
1752
+ config->outputFile = getOutputPath (
1753
+ ( *args.filtered (OPT_INPUT, OPT_wholearchive_file ).begin ())->getValue ());
1754
1754
}
1755
1755
1756
1756
// Fail early if an output file is not writable.
Original file line number Diff line number Diff line change 4
4
# RUN: not lld-link /nodefaultlib /out:%t.exe %t.obj > %t.log 2>&1
5
5
# RUN: FileCheck -check-prefix=MAIN %s < %t.log
6
6
7
+ # Entry inference should work through /wholearchive:, they are also inputs.
8
+ # RUN: lld-link /lib %t.obj /out:%t.lib
9
+ # RUN: not lld-link /nodefaultlib /out:%t.exe /wholearchive:%t.lib > %t.log 2>&1
10
+ # RUN: FileCheck -check-prefix=MAIN %s < %t.log
11
+
7
12
# RUN: sed s/ENTRYNAME/wmain/ %s | yaml2obj > %t.obj
8
13
# RUN: not lld-link /out:%t.exe %t.obj > %t.log 2>&1
9
14
# RUN: FileCheck -check-prefix=WMAIN %s < %t.log
Original file line number Diff line number Diff line change 4
4
# RUN: cp %t.obj %T/out/out1.obj
5
5
# RUN: cp %t.obj %T/out/tmp/out2
6
6
# RUN: cp %t.obj %T/out/tmp/out3.xyz
7
+ # RUN: lld-link /lib %t.obj /out:%T/out/out4.lib
7
8
8
- # RUN: rm -f out1.exe out2.exe out3.exe out3.dll
9
+ # RUN: rm -f out1.exe out2.exe out3.exe out3.dll out4.exe
9
10
# RUN: lld-link /entry:main %T/out/out1.obj
10
11
# RUN: lld-link /entry:main %T/out/tmp/out2
11
12
# RUN: lld-link /dll /entry:main %T/out/tmp/out3.xyz
13
+ # RUN: lld-link /entry:main -wholearchive:%T/out/out4.lib
12
14
13
15
# RUN: llvm-readobj out1.exe | FileCheck %s
14
16
# RUN: llvm-readobj out2.exe | FileCheck %s
15
17
# RUN: llvm-readobj out3.dll | FileCheck %s
18
+ # RUN: llvm-readobj out4.exe | FileCheck %s
16
19
17
20
CHECK: File:
Original file line number Diff line number Diff line change 14
14
# RUN: lld-link -dll -out:%t.dll -entry:main %t.main.obj %t.archive.lib -wholearchive:%t.archive.lib -implib:%t.lib
15
15
# RUN: llvm-readobj %t.lib | FileCheck %s -check-prefix CHECK-IMPLIB
16
16
17
+ # PR43744: Test no inputs except a whole archive.
18
+ # RUN: lld-link -dll -out:%t.dll -noentry -wholearchive:%t.archive.lib -implib:%t.lib
19
+ # RUN: llvm-readobj %t.lib | FileCheck %s -check-prefix CHECK-IMPLIB
20
+
17
21
# RUN: mkdir -p %t.dir
18
22
# RUN: cp %t.archive.lib %t.dir/foo.lib
19
23
# RUN: lld-link -dll -out:%t.dll -entry:main -libpath:%t.dir %t.main.obj %t.dir/./foo.lib -wholearchive:foo.lib -implib:%t.lib
You can’t perform that action at this time.
0 commit comments