<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - LLD "foo.lib -wholearchive:foo.lib" doesn't work"
href="https://bugs.llvm.org/show_bug.cgi?id=37592">37592</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LLD "foo.lib -wholearchive:foo.lib" doesn't work
</td>
</tr>
<tr>
<th>Product</th>
<td>lld
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>COFF
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rnk@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>