[llvm-bugs] [Bug 33443] New: COFF: minimal program links in unnecessary parts of libcmt.lib due to _load_cfg_used resolution
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jun 13 15:45:54 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=33443
Bug ID: 33443
Summary: COFF: minimal program links in unnecessary parts of
libcmt.lib due to _load_cfg_used resolution
Product: lld
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: COFF
Assignee: unassignedbugs at nondot.org
Reporter: rnk at google.com
CC: llvm-bugs at lists.llvm.org
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170613/e5ede26a/attachment.html>
More information about the llvm-bugs
mailing list