<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 - COFF: minimal program links in unnecessary parts of libcmt.lib due to _load_cfg_used resolution"
href="https://bugs.llvm.org/show_bug.cgi?id=33443">33443</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>COFF: minimal program links in unnecessary parts of libcmt.lib due to _load_cfg_used resolution
</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>In LLD, if any input object added to the symbol table defines _load_cfg_used,
then we mark it as undefined to pull in that object and anything it references.
I don't think this is quite what the MSVC linker does.
This behavior was added back in r243182 for /safeseh handling.
This makes small examples with two object files that happen to contain
/defaultlib:libcmt slightly larger:
$ cat t.c
extern void foo();
int main() {
foo();
return 42;
}
$ cat a.c
void foo() {}
$ cl -c t.c a.c
$ lld-link t.obj a.obj -entry:main -verbose
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 a.obj
C:\src\llvm-project\build\bin\lld-link.exe: Directives: a.obj:
/DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES"
C:\src\llvm-project\build\bin\lld-link.exe: Reading
c:/progra~2/micros~1.0/vc/lib/amd64\libcmt.lib
C:\src\llvm-project\build\bin\lld-link.exe: Reading
c:/progra~2/micros~1.0/vc/lib/amd64\oldnames.lib
C:\src\llvm-project\build\bin\lld-link.exe: Reading libcmt.lib(loadcfg.obj)
C:\src\llvm-project\build\bin\lld-link.exe: Loaded libcmt.lib(loadcfg.obj) for
_load_config_used
C:\src\llvm-project\build\bin\lld-link.exe: Reading libcmt.lib(gs_cookie.obj)
C:\src\llvm-project\build\bin\lld-link.exe: Loaded libcmt.lib(gs_cookie.obj)
for __security_cookie
C:\src\llvm-project\build\bin\lld-link.exe: Reading
libcmt.lib(guard_support.obj)
C:\src\llvm-project\build\bin\lld-link.exe: Loaded
libcmt.lib(guard_support.obj) for __guard_check_icall_fptr
C:\src\llvm-project\build\bin\lld-link.exe: Reading
libcmt.lib(_guard_dispatch_.obj)
C:\src\llvm-project\build\bin\lld-link.exe: Loaded
libcmt.lib(_guard_dispatch_.obj) for _guard_dispatch_icall_nop
C:\src\llvm-project\build\bin\lld-link.exe: ICF needed 2 iterations
Discarded _guard_icall_checks_enforced
Discarded __guard_fids__guard_icall_checks_enforced
My marking _load_cfg_used undefined, LLD links in four more object files from
libcmt.lib than MSVC. This isn't really a major size problem, but it's annoying
when trying to produce very reduced examples that have very minimal inputs.</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>