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) {
11381138 }
11391139 }
11401140
1141- if (!args.hasArg (OPT_INPUT)) {
1141+ if (!args.hasArg (OPT_INPUT, OPT_wholearchive_file )) {
11421142 if (args.hasArg (OPT_deffile))
11431143 config->noEntry = true ;
11441144 else
@@ -1626,7 +1626,7 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr) {
16261626 }
16271627
16281628 // Handle generation of import library from a def file.
1629- if (!args.hasArg (OPT_INPUT)) {
1629+ if (!args.hasArg (OPT_INPUT, OPT_wholearchive_file )) {
16301630 fixupExports ();
16311631 createImportLibrary (/* asLib=*/ true );
16321632 return ;
@@ -1672,8 +1672,8 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr) {
16721672
16731673 // Set default image name if neither /out or /def set it.
16741674 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 ());
16771677 }
16781678
16791679 // Fail early if an output file is not writable.
Original file line number Diff line number Diff line change 44# RUN: not lld-link /nodefaultlib /out:%t.exe %t.obj > %t.log 2>&1
55# RUN: FileCheck -check-prefix=MAIN %s < %t.log
66
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+
712# RUN: sed s/ENTRYNAME/wmain/ %s | yaml2obj > %t.obj
813# RUN: not lld-link /out:%t.exe %t.obj > %t.log 2>&1
914# RUN: FileCheck -check-prefix=WMAIN %s < %t.log
Original file line number Diff line number Diff line change 44# RUN: cp %t.obj %T/out/out1.obj
55# RUN: cp %t.obj %T/out/tmp/out2
66# RUN: cp %t.obj %T/out/tmp/out3.xyz
7+ # RUN: lld-link /lib %t.obj /out:%T/out/out4.lib
78
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
910# RUN: lld-link /entry:main %T/out/out1.obj
1011# RUN: lld-link /entry:main %T/out/tmp/out2
1112# RUN: lld-link /dll /entry:main %T/out/tmp/out3.xyz
13+ # RUN: lld-link /entry:main -wholearchive:%T/out/out4.lib
1214
1315# RUN: llvm-readobj out1.exe | FileCheck %s
1416# RUN: llvm-readobj out2.exe | FileCheck %s
1517# RUN: llvm-readobj out3.dll | FileCheck %s
18+ # RUN: llvm-readobj out4.exe | FileCheck %s
1619
1720CHECK: File:
Original file line number Diff line number Diff line change 1414# RUN: lld-link -dll -out:%t.dll -entry:main %t.main.obj %t.archive.lib -wholearchive:%t.archive.lib -implib:%t.lib
1515# RUN: llvm-readobj %t.lib | FileCheck %s -check-prefix CHECK-IMPLIB
1616
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+
1721# RUN: mkdir -p %t.dir
1822# RUN: cp %t.archive.lib %t.dir/foo.lib
1923# 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