Skip to content

[LLD][COFF] Update nodefaultlibs after updating search paths #128813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 12, 2025
Merged

[LLD][COFF] Update nodefaultlibs after updating search paths #128813

merged 4 commits into from
Mar 12, 2025

Conversation

A2uria
Copy link
Contributor

@A2uria A2uria commented Feb 26, 2025

Fix #107346

Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot
Copy link
Member

llvmbot commented Feb 26, 2025

@llvm/pr-subscribers-lld
@llvm/pr-subscribers-platform-windows

@llvm/pr-subscribers-lld-coff

Author: None (A2uria)

Changes

Fix #107346


Full diff: https://github.com/llvm/llvm-project/pull/128813.diff

1 Files Affected:

  • (modified) lld/COFF/Driver.cpp (+7)
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index 1589323073c09..086ec83cc5206 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -786,6 +786,13 @@ void LinkerDriver::addWinSysRootLibSearchPaths() {
                                       path))
       searchPaths.push_back(saver().save(path));
   }
+
+  // Libraries specified by `/nodefaultlib:` may not be found in incomplete
+  // search paths before lld infers a machine type from input files.
+  std::set<std::string> noDefaultLibs;
+  for (const std::string &path : ctx.config.noDefaultLibs)
+    noDefaultLibs.insert(findLib(path).lower());
+  ctx.config.noDefaultLibs = noDefaultLibs;
 }
 
 // Parses LIB environment which contains a list of search paths.

@mstorsjo
Copy link
Member

mstorsjo commented Mar 7, 2025

Can you make a testcase for this situation? We generally require test additions/changes for functional changes.

@A2uria A2uria marked this pull request as draft March 8, 2025 15:54
@A2uria
Copy link
Contributor Author

A2uria commented Mar 9, 2025

Test is expected to fail after cherry picking 9ef907a before this pr is merged.

Windows
llvm-lit.py: V:\llvm-project\llvm\utils\lit\lit\llvm\config.py:57: note: using lit tools: C:\Program Files\Git\usr\bin
llvm-lit.py: V:\llvm-project\llvm\utils\lit\lit\llvm\config.py:512: note: using ld.lld: v:\llvm-project\build\bin\ld.lld.exe
llvm-lit.py: V:\llvm-project\llvm\utils\lit\lit\llvm\config.py:512: note: using lld-link: v:\llvm-project\build\bin\lld-link.exe
llvm-lit.py: V:\llvm-project\llvm\utils\lit\lit\llvm\config.py:512: note: using ld64.lld: v:\llvm-project\build\bin\ld64.lld.exe
llvm-lit.py: V:\llvm-project\llvm\utils\lit\lit\llvm\config.py:512: note: using wasm-ld: v:\llvm-project\build\bin\wasm-ld.exe
-- Testing: 3065 tests, 20 workers --
Testing:  0..
FAIL: lld :: COFF/nodefaultlib.test (355 of 3065)
******************** TEST 'lld :: COFF/nodefaultlib.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
cp V:\llvm-project\lld\test\COFF/Inputs/hello64.obj V:\llvm-project\build\tools\lld\test\COFF\Output
# executed command: cp 'V:\llvm-project\lld\test\COFF/Inputs/hello64.obj' 'V:\llvm-project\build\tools\lld\test\COFF\Output'
# RUN: at line 2
cp V:\llvm-project\lld\test\COFF/Inputs/std64.lib V:\llvm-project\build\tools\lld\test\COFF\Output
# executed command: cp 'V:\llvm-project\lld\test\COFF/Inputs/std64.lib' 'V:\llvm-project\build\tools\lld\test\COFF\Output'
# RUN: at line 4
not v:\llvm-project\build\bin\lld-link.exe /out:V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.exe /entry:main /subsystem:console    hello64.obj /defaultlib:std64.lib >& V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.log
# executed command: not 'v:\llvm-project\build\bin\lld-link.exe' '/out:V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.exe' /entry:main /subsystem:console hello64.obj /defaultlib:std64.lib
# RUN: at line 6
v:\llvm-project\build\bin\filecheck.exe -DMSG='no such file or directory' -check-prefix=CHECK1 V:\llvm-project\lld\test\COFF\nodefaultlib.test < V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.log
# executed command: 'v:\llvm-project\build\bin\filecheck.exe' '-DMSG=no such file or directory' -check-prefix=CHECK1 'V:\llvm-project\lld\test\COFF\nodefaultlib.test'
# RUN: at line 8
not v:\llvm-project\build\bin\lld-link.exe /out:V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.exe /entry:main /subsystem:console    hello64 /defaultlib:std64.lib >& V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.log
# executed command: not 'v:\llvm-project\build\bin\lld-link.exe' '/out:V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.exe' /entry:main /subsystem:console hello64 /defaultlib:std64.lib
# RUN: at line 10
v:\llvm-project\build\bin\filecheck.exe -DMSG='no such file or directory' -check-prefix=CHECK2 V:\llvm-project\lld\test\COFF\nodefaultlib.test < V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.log
# executed command: 'v:\llvm-project\build\bin\filecheck.exe' '-DMSG=no such file or directory' -check-prefix=CHECK2 'V:\llvm-project\lld\test\COFF\nodefaultlib.test'
# RUN: at line 12
v:\llvm-project\build\bin\lld-link.exe /libpath:V:\llvm-project\build\tools\lld\test\COFF\Output /out:V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.exe /entry:main    /subsystem:console hello64.obj /defaultlib:std64.lib    /nodefaultlib:std64.lib >& V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.log || true
# executed command: 'v:\llvm-project\build\bin\lld-link.exe' '/libpath:V:\llvm-project\build\tools\lld\test\COFF\Output' '/out:V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.exe' /entry:main /subsystem:console hello64.obj /defaultlib:std64.lib /nodefaultlib:std64.lib
# .---redirected output from 'V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.log'
# | lld-link: error: undefined symbol: ExitProcess
# | >>> referenced by V:\llvm-project\build\tools\lld\test\COFF\Output\hello64.obj:(main)
# |
# | lld-link: error: undefined symbol: MessageBoxA
# | >>> referenced by V:\llvm-project\build\tools\lld\test\COFF\Output\hello64.obj:(main)
# |
# | lld-link: error: undefined symbol: ImportByOrdinal
# | >>> referenced by V:\llvm-project\build\tools\lld\test\COFF\Output\hello64.obj:(main)
# `-----------------------------
# note: command had no output on stdout or stderr
# error: command failed with exit status: 1
# executed command: true
# RUN: at line 15
v:\llvm-project\build\bin\filecheck.exe -check-prefix=CHECK3 V:\llvm-project\lld\test\COFF\nodefaultlib.test < V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.log
# executed command: 'v:\llvm-project\build\bin\filecheck.exe' -check-prefix=CHECK3 'V:\llvm-project\lld\test\COFF\nodefaultlib.test'
# RUN: at line 17
v:\llvm-project\build\bin\lld-link.exe /libpath:V:\llvm-project\build\tools\lld\test\COFF\Output /out:V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.exe /entry:main    /subsystem:console hello64.obj /defaultlib:std64    /nodefaultlib:std64.lib >& V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.log || true
# executed command: 'v:\llvm-project\build\bin\lld-link.exe' '/libpath:V:\llvm-project\build\tools\lld\test\COFF\Output' '/out:V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.exe' /entry:main /subsystem:console hello64.obj /defaultlib:std64 /nodefaultlib:std64.lib
# .---redirected output from 'V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.log'
# | lld-link: error: undefined symbol: ExitProcess
# | >>> referenced by V:\llvm-project\build\tools\lld\test\COFF\Output\hello64.obj:(main)
# |
# | lld-link: error: undefined symbol: MessageBoxA
# | >>> referenced by V:\llvm-project\build\tools\lld\test\COFF\Output\hello64.obj:(main)
# |
# | lld-link: error: undefined symbol: ImportByOrdinal
# | >>> referenced by V:\llvm-project\build\tools\lld\test\COFF\Output\hello64.obj:(main)
# `-----------------------------
# note: command had no output on stdout or stderr
# error: command failed with exit status: 1
# executed command: true
# RUN: at line 20
v:\llvm-project\build\bin\filecheck.exe -check-prefix=CHECK3 V:\llvm-project\lld\test\COFF\nodefaultlib.test < V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.log
# executed command: 'v:\llvm-project\build\bin\filecheck.exe' -check-prefix=CHECK3 'V:\llvm-project\lld\test\COFF\nodefaultlib.test'
# RUN: at line 27
v:\llvm-project\build\bin\lld-link.exe /libpath:V:\llvm-project\build\tools\lld\test\COFF\Output /out:V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.exe /entry:main    /subsystem:console hello64.obj /defaultlib:std64.lib
# executed command: 'v:\llvm-project\build\bin\lld-link.exe' '/libpath:V:\llvm-project\build\tools\lld\test\COFF\Output' '/out:V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.exe' /entry:main /subsystem:console hello64.obj /defaultlib:std64.lib
# RUN: at line 30
env LIB=V:\llvm-project\build\tools\lld\test\COFF\Output v:\llvm-project\build\bin\lld-link.exe /out:V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.exe /entry:main    /subsystem:console hello64.obj /defaultlib:std64.lib
# executed command: env 'LIB=V:\llvm-project\build\tools\lld\test\COFF\Output' 'v:\llvm-project\build\bin\lld-link.exe' '/out:V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.exe' /entry:main /subsystem:console hello64.obj /defaultlib:std64.lib
# RUN: at line 34
v:\llvm-project\build\bin\lld-link.exe V:\llvm-project\lld\test\COFF/Inputs/precomp.obj V:\llvm-project\lld\test\COFF/Inputs/precomp-a.obj V:\llvm-project\lld\test\COFF/Inputs/precomp-b.obj /nodefaultlib:libcmt /nodefaultlib:oldnames /entry:main /debug /pdb:V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.pdb /out:V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.exe /opt:ref /opt:icf
# executed command: 'v:\llvm-project\build\bin\lld-link.exe' 'V:\llvm-project\lld\test\COFF/Inputs/precomp.obj' 'V:\llvm-project\lld\test\COFF/Inputs/precomp-a.obj' 'V:\llvm-project\lld\test\COFF/Inputs/precomp-b.obj' /nodefaultlib:libcmt /nodefaultlib:oldnames /entry:main /debug '/pdb:V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.pdb' '/out:V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.exe' /opt:ref /opt:icf
# RUN: at line 35
v:\llvm-project\build\bin\llvm-pdbutil.exe dump -modules V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.pdb | v:\llvm-project\build\bin\filecheck.exe V:\llvm-project\lld\test\COFF\nodefaultlib.test -check-prefix UPPERCASE
# executed command: 'v:\llvm-project\build\bin\llvm-pdbutil.exe' dump -modules 'V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.pdb'
# executed command: 'v:\llvm-project\build\bin\filecheck.exe' 'V:\llvm-project\lld\test\COFF\nodefaultlib.test' -check-prefix UPPERCASE
# RUN: at line 40
v:\llvm-project\build\bin\yaml2obj.exe -o V:\llvm-project\build\tools\lld\test\COFF\Output/defaultlib.obj V:\llvm-project\lld\test\COFF/Inputs/defaultlib.yaml
# executed command: 'v:\llvm-project\build\bin\yaml2obj.exe' -o 'V:\llvm-project\build\tools\lld\test\COFF\Output/defaultlib.obj' 'V:\llvm-project\lld\test\COFF/Inputs/defaultlib.yaml'
# RUN: at line 41
mkdir -p V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x64
# executed command: mkdir -p 'V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x64'
# RUN: at line 42
cp V:\llvm-project\lld\test\COFF/Inputs/ret42.lib V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x64/default.lib
# executed command: cp 'V:\llvm-project\lld\test\COFF/Inputs/ret42.lib' 'V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x64/default.lib'
# RUN: at line 43
not v:\llvm-project\build\bin\lld-link.exe /winsysroot:V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.dir/sysroot /out:V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.exe /entry:main /subsystem:console /nodefaultlib:default.lib V:\llvm-project\build\tools\lld\test\COFF\Output/defaultlib.obj
# executed command: not 'v:\llvm-project\build\bin\lld-link.exe' '/winsysroot:V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.dir/sysroot' '/out:V:\llvm-project\build\tools\lld\test\COFF\Output\nodefaultlib.test.tmp.exe' /entry:main /subsystem:console /nodefaultlib:default.lib 'V:\llvm-project\build\tools\lld\test\COFF\Output/defaultlib.obj'
# note: command had no output on stdout or stderr
# error: command failed with exit status: 1

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
********************
Failed Tests (1):
  lld :: COFF/nodefaultlib.test


Testing Time: 84.63s

Total Discovered Tests: 3065
  Unsupported: 1082 (35.30%)
  Passed     : 1982 (64.67%)
  Failed     :    1 (0.03%)
Linux
llvm-lit: /home/ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using ld.lld: /home/ubuntu/llvm-project/build/bin/ld.lld
llvm-lit: /home/ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using lld-link: /home/ubuntu/llvm-project/build/bin/lld-link
llvm-lit: /home/ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using ld64.lld: /home/ubuntu/llvm-project/build/bin/ld64.lld
llvm-lit: /home/ubuntu/llvm-project/llvm/utils/lit/lit/llvm/config.py:512: note: using wasm-ld: /home/ubuntu/llvm-project/build/bin/wasm-ld
FAIL: lld :: COFF/nodefaultlib.test (364 of 3065)
******************** TEST 'lld :: COFF/nodefaultlib.test' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: cp /home/ubuntu/llvm-project/lld/test/COFF/Inputs/hello64.obj /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output
+ cp /home/ubuntu/llvm-project/lld/test/COFF/Inputs/hello64.obj /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output
RUN: at line 2: cp /home/ubuntu/llvm-project/lld/test/COFF/Inputs/std64.lib /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output
+ cp /home/ubuntu/llvm-project/lld/test/COFF/Inputs/std64.lib /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output
RUN: at line 4: not /home/ubuntu/llvm-project/build/bin/lld-link /out:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.exe /entry:main /subsystem:console    hello64.obj /defaultlib:std64.lib >& /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.log
+ not /home/ubuntu/llvm-project/build/bin/lld-link /out:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.exe /entry:main /subsystem:console hello64.obj /defaultlib:std64.lib
RUN: at line 6: /home/ubuntu/llvm-project/build/bin/FileCheck -DMSG='No such file or directory' -check-prefix=CHECK1 /home/ubuntu/llvm-project/lld/test/COFF/nodefaultlib.test < /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.log
+ /home/ubuntu/llvm-project/build/bin/FileCheck '-DMSG=No such file or directory' -check-prefix=CHECK1 /home/ubuntu/llvm-project/lld/test/COFF/nodefaultlib.test
RUN: at line 8: not /home/ubuntu/llvm-project/build/bin/lld-link /out:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.exe /entry:main /subsystem:console    hello64 /defaultlib:std64.lib >& /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.log
+ not /home/ubuntu/llvm-project/build/bin/lld-link /out:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.exe /entry:main /subsystem:console hello64 /defaultlib:std64.lib
RUN: at line 10: /home/ubuntu/llvm-project/build/bin/FileCheck -DMSG='No such file or directory' -check-prefix=CHECK2 /home/ubuntu/llvm-project/lld/test/COFF/nodefaultlib.test < /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.log
+ /home/ubuntu/llvm-project/build/bin/FileCheck '-DMSG=No such file or directory' -check-prefix=CHECK2 /home/ubuntu/llvm-project/lld/test/COFF/nodefaultlib.test
RUN: at line 12: /home/ubuntu/llvm-project/build/bin/lld-link /libpath:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output /out:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.exe /entry:main    /subsystem:console hello64.obj /defaultlib:std64.lib    /nodefaultlib:std64.lib >& /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.log || true
+ /home/ubuntu/llvm-project/build/bin/lld-link /libpath:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output /out:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.exe /entry:main /subsystem:console hello64.obj /defaultlib:std64.lib /nodefaultlib:std64.lib
+ true
RUN: at line 15: /home/ubuntu/llvm-project/build/bin/FileCheck -check-prefix=CHECK3 /home/ubuntu/llvm-project/lld/test/COFF/nodefaultlib.test < /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.log
+ /home/ubuntu/llvm-project/build/bin/FileCheck -check-prefix=CHECK3 /home/ubuntu/llvm-project/lld/test/COFF/nodefaultlib.test
RUN: at line 17: /home/ubuntu/llvm-project/build/bin/lld-link /libpath:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output /out:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.exe /entry:main    /subsystem:console hello64.obj /defaultlib:std64    /nodefaultlib:std64.lib >& /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.log || true
+ /home/ubuntu/llvm-project/build/bin/lld-link /libpath:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output /out:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.exe /entry:main /subsystem:console hello64.obj /defaultlib:std64 /nodefaultlib:std64.lib
+ true
RUN: at line 20: /home/ubuntu/llvm-project/build/bin/FileCheck -check-prefix=CHECK3 /home/ubuntu/llvm-project/lld/test/COFF/nodefaultlib.test < /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.log
+ /home/ubuntu/llvm-project/build/bin/FileCheck -check-prefix=CHECK3 /home/ubuntu/llvm-project/lld/test/COFF/nodefaultlib.test
RUN: at line 27: /home/ubuntu/llvm-project/build/bin/lld-link /libpath:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output /out:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.exe /entry:main    /subsystem:console hello64.obj /defaultlib:std64.lib
+ /home/ubuntu/llvm-project/build/bin/lld-link /libpath:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output /out:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.exe /entry:main /subsystem:console hello64.obj /defaultlib:std64.lib
RUN: at line 30: env LIB=/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output /home/ubuntu/llvm-project/build/bin/lld-link /out:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.exe /entry:main    /subsystem:console hello64.obj /defaultlib:std64.lib
+ env LIB=/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output /home/ubuntu/llvm-project/build/bin/lld-link /out:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.exe /entry:main /subsystem:console hello64.obj /defaultlib:std64.lib
RUN: at line 34: /home/ubuntu/llvm-project/build/bin/lld-link /home/ubuntu/llvm-project/lld/test/COFF/Inputs/precomp.obj /home/ubuntu/llvm-project/lld/test/COFF/Inputs/precomp-a.obj /home/ubuntu/llvm-project/lld/test/COFF/Inputs/precomp-b.obj /nodefaultlib:libcmt /nodefaultlib:oldnames /entry:main /debug /pdb:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.pdb /out:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.exe /opt:ref /opt:icf
+ /home/ubuntu/llvm-project/build/bin/lld-link /home/ubuntu/llvm-project/lld/test/COFF/Inputs/precomp.obj /home/ubuntu/llvm-project/lld/test/COFF/Inputs/precomp-a.obj /home/ubuntu/llvm-project/lld/test/COFF/Inputs/precomp-b.obj /nodefaultlib:libcmt /nodefaultlib:oldnames /entry:main /debug /pdb:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.pdb /out:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.exe /opt:ref /opt:icf
RUN: at line 35: /home/ubuntu/llvm-project/build/bin/llvm-pdbutil dump -modules /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.pdb | /home/ubuntu/llvm-project/build/bin/FileCheck /home/ubuntu/llvm-project/lld/test/COFF/nodefaultlib.test -check-prefix UPPERCASE
+ /home/ubuntu/llvm-project/build/bin/llvm-pdbutil dump -modules /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.pdb
+ /home/ubuntu/llvm-project/build/bin/FileCheck /home/ubuntu/llvm-project/lld/test/COFF/nodefaultlib.test -check-prefix UPPERCASE
RUN: at line 40: /home/ubuntu/llvm-project/build/bin/yaml2obj -o /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/defaultlib.obj /home/ubuntu/llvm-project/lld/test/COFF/Inputs/defaultlib.yaml
+ /home/ubuntu/llvm-project/build/bin/yaml2obj -o /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/defaultlib.obj /home/ubuntu/llvm-project/lld/test/COFF/Inputs/defaultlib.yaml
RUN: at line 41: mkdir -p /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x64
+ mkdir -p /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x64
RUN: at line 42: cp /home/ubuntu/llvm-project/lld/test/COFF/Inputs/ret42.lib /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x64/default.lib
+ cp /home/ubuntu/llvm-project/lld/test/COFF/Inputs/ret42.lib /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x64/default.lib
RUN: at line 43: not /home/ubuntu/llvm-project/build/bin/lld-link /winsysroot:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.dir/sysroot /out:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.exe /entry:main /subsystem:console /nodefaultlib:default.lib /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/defaultlib.obj
+ not /home/ubuntu/llvm-project/build/bin/lld-link /winsysroot:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.dir/sysroot /out:/home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/nodefaultlib.test.tmp.exe /entry:main /subsystem:console /nodefaultlib:default.lib /home/ubuntu/llvm-project/build/tools/lld/test/COFF/Output/defaultlib.obj

--

********************
********************
Failed Tests (1):
  lld :: COFF/nodefaultlib.test


Testing Time: 16.97s

Total Discovered Tests: 3065
  Unsupported: 1046 (34.13%)
  Passed     : 2018 (65.84%)
  Failed     :    1 (0.03%)

@A2uria A2uria marked this pull request as ready for review March 9, 2025 03:44
@A2uria
Copy link
Contributor Author

A2uria commented Mar 9, 2025

It is worth mentioning that the problem in #107346 is a subset of the test case.

Since I don't have write access to this repo, so reviewers may have to merge this as well as #128814.

Copy link
Member

@mstorsjo mstorsjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@A2uria
Copy link
Contributor Author

A2uria commented Mar 12, 2025

Sorry to bother but could you please merge this PR for me as I don't have write access?

@mstorsjo
Copy link
Member

Sorry to bother but could you please merge this PR for me as I don't have write access?

Yes, will do - I just wanted to leave a little time after approving it, in case someone else had further comments, before merging it.

@mstorsjo mstorsjo merged commit 90a08fb into llvm:main Mar 12, 2025
11 checks passed
Copy link

@A2uria Congratulations on having your first Pull Request (PR) merged into the LLVM Project!

Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail here.

If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are working as expected, well done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lld-link not respecting /NODEFAULTLIB with a conflicting /DEFAULTLIB
3 participants