Loading lld/COFF/Driver.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -1138,7 +1138,7 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr) { } } if (!args.hasArg(OPT_INPUT)) { if (!args.hasArg(OPT_INPUT, OPT_wholearchive_file)) { if (args.hasArg(OPT_deffile)) config->noEntry = true; else Loading Loading @@ -1626,7 +1626,7 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr) { } // Handle generation of import library from a def file. if (!args.hasArg(OPT_INPUT)) { if (!args.hasArg(OPT_INPUT, OPT_wholearchive_file)) { fixupExports(); createImportLibrary(/*asLib=*/true); return; Loading Loading @@ -1672,8 +1672,8 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr) { // Set default image name if neither /out or /def set it. if (config->outputFile.empty()) { config->outputFile = getOutputPath((*args.filtered(OPT_INPUT).begin())->getValue()); config->outputFile = getOutputPath( (*args.filtered(OPT_INPUT, OPT_wholearchive_file).begin())->getValue()); } // Fail early if an output file is not writable. Loading lld/test/COFF/entry-inference.test +5 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,11 @@ # RUN: not lld-link /nodefaultlib /out:%t.exe %t.obj > %t.log 2>&1 # RUN: FileCheck -check-prefix=MAIN %s < %t.log # Entry inference should work through /wholearchive:, they are also inputs. # RUN: lld-link /lib %t.obj /out:%t.lib # RUN: not lld-link /nodefaultlib /out:%t.exe /wholearchive:%t.lib > %t.log 2>&1 # RUN: FileCheck -check-prefix=MAIN %s < %t.log # RUN: sed s/ENTRYNAME/wmain/ %s | yaml2obj > %t.obj # RUN: not lld-link /out:%t.exe %t.obj > %t.log 2>&1 # RUN: FileCheck -check-prefix=WMAIN %s < %t.log Loading lld/test/COFF/out.test +4 −1 Original line number Diff line number Diff line Loading @@ -4,14 +4,17 @@ # RUN: cp %t.obj %T/out/out1.obj # RUN: cp %t.obj %T/out/tmp/out2 # RUN: cp %t.obj %T/out/tmp/out3.xyz # RUN: lld-link /lib %t.obj /out:%T/out/out4.lib # RUN: rm -f out1.exe out2.exe out3.exe out3.dll # RUN: rm -f out1.exe out2.exe out3.exe out3.dll out4.exe # RUN: lld-link /entry:main %T/out/out1.obj # RUN: lld-link /entry:main %T/out/tmp/out2 # RUN: lld-link /dll /entry:main %T/out/tmp/out3.xyz # RUN: lld-link /entry:main -wholearchive:%T/out/out4.lib # RUN: llvm-readobj out1.exe | FileCheck %s # RUN: llvm-readobj out2.exe | FileCheck %s # RUN: llvm-readobj out3.dll | FileCheck %s # RUN: llvm-readobj out4.exe | FileCheck %s CHECK: File: lld/test/COFF/wholearchive.s +4 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,10 @@ # RUN: lld-link -dll -out:%t.dll -entry:main %t.main.obj %t.archive.lib -wholearchive:%t.archive.lib -implib:%t.lib # RUN: llvm-readobj %t.lib | FileCheck %s -check-prefix CHECK-IMPLIB # PR43744: Test no inputs except a whole archive. # RUN: lld-link -dll -out:%t.dll -noentry -wholearchive:%t.archive.lib -implib:%t.lib # RUN: llvm-readobj %t.lib | FileCheck %s -check-prefix CHECK-IMPLIB # RUN: mkdir -p %t.dir # RUN: cp %t.archive.lib %t.dir/foo.lib # 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 Loading Loading
lld/COFF/Driver.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -1138,7 +1138,7 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr) { } } if (!args.hasArg(OPT_INPUT)) { if (!args.hasArg(OPT_INPUT, OPT_wholearchive_file)) { if (args.hasArg(OPT_deffile)) config->noEntry = true; else Loading Loading @@ -1626,7 +1626,7 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr) { } // Handle generation of import library from a def file. if (!args.hasArg(OPT_INPUT)) { if (!args.hasArg(OPT_INPUT, OPT_wholearchive_file)) { fixupExports(); createImportLibrary(/*asLib=*/true); return; Loading Loading @@ -1672,8 +1672,8 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr) { // Set default image name if neither /out or /def set it. if (config->outputFile.empty()) { config->outputFile = getOutputPath((*args.filtered(OPT_INPUT).begin())->getValue()); config->outputFile = getOutputPath( (*args.filtered(OPT_INPUT, OPT_wholearchive_file).begin())->getValue()); } // Fail early if an output file is not writable. Loading
lld/test/COFF/entry-inference.test +5 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,11 @@ # RUN: not lld-link /nodefaultlib /out:%t.exe %t.obj > %t.log 2>&1 # RUN: FileCheck -check-prefix=MAIN %s < %t.log # Entry inference should work through /wholearchive:, they are also inputs. # RUN: lld-link /lib %t.obj /out:%t.lib # RUN: not lld-link /nodefaultlib /out:%t.exe /wholearchive:%t.lib > %t.log 2>&1 # RUN: FileCheck -check-prefix=MAIN %s < %t.log # RUN: sed s/ENTRYNAME/wmain/ %s | yaml2obj > %t.obj # RUN: not lld-link /out:%t.exe %t.obj > %t.log 2>&1 # RUN: FileCheck -check-prefix=WMAIN %s < %t.log Loading
lld/test/COFF/out.test +4 −1 Original line number Diff line number Diff line Loading @@ -4,14 +4,17 @@ # RUN: cp %t.obj %T/out/out1.obj # RUN: cp %t.obj %T/out/tmp/out2 # RUN: cp %t.obj %T/out/tmp/out3.xyz # RUN: lld-link /lib %t.obj /out:%T/out/out4.lib # RUN: rm -f out1.exe out2.exe out3.exe out3.dll # RUN: rm -f out1.exe out2.exe out3.exe out3.dll out4.exe # RUN: lld-link /entry:main %T/out/out1.obj # RUN: lld-link /entry:main %T/out/tmp/out2 # RUN: lld-link /dll /entry:main %T/out/tmp/out3.xyz # RUN: lld-link /entry:main -wholearchive:%T/out/out4.lib # RUN: llvm-readobj out1.exe | FileCheck %s # RUN: llvm-readobj out2.exe | FileCheck %s # RUN: llvm-readobj out3.dll | FileCheck %s # RUN: llvm-readobj out4.exe | FileCheck %s CHECK: File:
lld/test/COFF/wholearchive.s +4 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,10 @@ # RUN: lld-link -dll -out:%t.dll -entry:main %t.main.obj %t.archive.lib -wholearchive:%t.archive.lib -implib:%t.lib # RUN: llvm-readobj %t.lib | FileCheck %s -check-prefix CHECK-IMPLIB # PR43744: Test no inputs except a whole archive. # RUN: lld-link -dll -out:%t.dll -noentry -wholearchive:%t.archive.lib -implib:%t.lib # RUN: llvm-readobj %t.lib | FileCheck %s -check-prefix CHECK-IMPLIB # RUN: mkdir -p %t.dir # RUN: cp %t.archive.lib %t.dir/foo.lib # 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 Loading