You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ cl -c t.c a.c b.c && lld-link /LIB a.obj b.obj -out:foo.lib
Microsoft (R) C/C++ Optimizing Compiler Version 19.13.26131.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
As you can see from the verbose output, b.obj is not loaded, but it is if I swap in link.exe:
$ link t.obj foo.lib -wholearchive:foo.lib -out:t.exe -verbose -nodefaultlib -entry:main
Microsoft (R) Incremental Linker Version 14.13.26131.1
Copyright (C) Microsoft Corporation. All rights reserved.
Processed /NODEFAULTLIB (suppressing all default libs)
Extended Description
Consider:
$ cat a.c
int foo() { return 1; }
$ cat b.c
int bar() { return 2; }
$ cat t.c
int foo();
int main() {
return foo();
}
$ cl -c t.c a.c b.c && lld-link /LIB a.obj b.obj -out:foo.lib
Microsoft (R) C/C++ Optimizing Compiler Version 19.13.26131.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
t.c
a.c
b.c
Generating Code...
$ lld-link t.obj foo.lib -wholearchive:foo.lib -out:t.exe -verbose -nodefaultlib -entry:main
C:\src\llvm-project\build\bin\lld-link.exe: Reading t.obj
C:\src\llvm-project\build\bin\lld-link.exe: Directives: t.obj: /DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES"
C:\src\llvm-project\build\bin\lld-link.exe: Reading foo.lib
C:\src\llvm-project\build\bin\lld-link.exe: Reading foo.lib(a.obj)
C:\src\llvm-project\build\bin\lld-link.exe: Directives: foo.lib(a.obj): /DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES"
C:\src\llvm-project\build\bin\lld-link.exe: Loaded foo.lib(a.obj) for foo
C:\src\llvm-project\build\bin\lld-link.exe: ICF needed 2 iterations
As you can see from the verbose output, b.obj is not loaded, but it is if I swap in link.exe:
$ link t.obj foo.lib -wholearchive:foo.lib -out:t.exe -verbose -nodefaultlib -entry:main
Microsoft (R) Incremental Linker Version 14.13.26131.1
Copyright (C) Microsoft Corporation. All rights reserved.
Processed /NODEFAULTLIB (suppressing all default libs)
Starting pass 1
Loaded foo.lib(a.obj)
Loaded foo.lib(b.obj)
Searching libraries
Searching foo.lib:
Finished searching libraries
Finished pass 1
Starting pass 2
t.obj
foo.lib(b.obj)
foo.lib(a.obj)
Finished pass 2
This is causing Chromium's base_unittests tests to fail with asan, which uses wholearchive.
The text was updated successfully, but these errors were encountered: