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 @@ -1138,7 +1138,7 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr) {
1138
1138
}
1139
1139
}
1140
1140
1141
- if (!args.hasArg (OPT_INPUT)) {
1141
+ if (!args.hasArg (OPT_INPUT, OPT_wholearchive_file )) {
1142
1142
if (args.hasArg (OPT_deffile))
1143
1143
config->noEntry = true ;
1144
1144
else
@@ -1626,7 +1626,7 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr) {
1626
1626
}
1627
1627
1628
1628
// Handle generation of import library from a def file.
1629
- if (!args.hasArg (OPT_INPUT)) {
1629
+ if (!args.hasArg (OPT_INPUT, OPT_wholearchive_file )) {
1630
1630
fixupExports ();
1631
1631
createImportLibrary (/* asLib=*/ true );
1632
1632
return ;
@@ -1672,8 +1672,8 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr) {
1672
1672
1673
1673
// Set default image name if neither /out or /def set it.
1674
1674
if (config->outputFile .empty ()) {
1675
- config->outputFile =
1676
- getOutputPath (( *args.filtered (OPT_INPUT).begin ())->getValue ());
1675
+ config->outputFile = getOutputPath (
1676
+ ( *args.filtered (OPT_INPUT, OPT_wholearchive_file ).begin ())->getValue ());
1677
1677
}
1678
1678
1679
1679
// 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