Nikita Smith
941b8a011e
duplicate identical search aliases are not an error case
2026-07-27 14:47:09 -07:00
Nikita Smith
d34e1a7802
implement /OPT:ICF
...
Add identical COMDAT folding using a color-refinement over foldable
read-only sections. Hash section contents, relocation targets, and target
colors until partitions stabilize, then redirect folded COMDAT symlinks
and discard duplicate sections.
Honor .llvm_addrsig via /LLVM_ADDRSIG so address-significant sections
are not folded, keep separate color space for code, unwind info, and
MSVC vftables, and update COMDAT symbol/section mapping after folding.
Add linker tests covering function folding, relocation-sensitive folds,
alignment, color-space separation, symlink chains, .llvm_addrsig,
pdata/xdata, and C++ ICF cases.
2026-07-27 14:47:08 -07:00
Nikita Smith
9616307503
add extra node to the symbol ref for better insertion per
2026-06-19 20:12:24 -07:00
Nikita Smith
9ce6b9504b
centralize section header reads and writes
2026-06-12 11:40:03 -07:00
Nikita Smith
42cf820972
cache for section flags
...
modifying the section flags is expensive with COW file mappings, Windows
maps are set to 64k granularity
2026-06-12 11:40:02 -07:00
Nikita Smith
1dc72b2bcf
replace single-hop associative section walk to multi-hop
2026-05-18 18:11:48 -07:00
Nikita Smith
cc8fdc6c6f
order check for COMDATs with any property
2025-09-17 15:21:37 -07:00
Nikita Smith
630c3b42a7
do lightweight import gathering while resolving links
2025-09-17 15:21:37 -07:00
Nikita Smith
98eaf67dd8
while symbol table is being built sort weak and undefined symbols to
...
separate chunk lists to speed up library search
2025-09-17 15:21:37 -07:00
Nikita Smith
d6596efac8
allow weak symbols to resolve to other weak symbols
2025-09-16 10:31:01 -07:00
Nikita Smith
98a05728b3
add check for whether weak symbol is resolved
2025-09-08 16:07:31 -07:00
Nikita Smith
7cea036bc1
clean up pass over symbol table
...
- rename functions for consistency
- remove unused code
2025-09-08 16:07:31 -07:00
Nikita Smith
a6432cce8e
improve unresolved symbol errors
...
- collect symbol references and print out objs that reference
unresolved symbol
- print source file location of the references
2025-09-06 09:54:23 -07:00
Nikita Smith
d92f45784d
rename defined symbol to obj ref, as the symbol table no longer has
...
scopes and it makes no sense to refer to them that way
2025-09-06 09:54:22 -07:00
Nikita Smith
6a3d7e65f3
remove year from the copyright
2025-09-05 15:19:31 -07:00
Nikita Smith
43e81b934b
move weak symbol replacer to the symbol table layer
2025-09-05 15:19:30 -07:00
Nikita Smith
1aac27095e
WIP: reorder input and library search order to match MSVC behavior
2025-09-05 15:19:30 -07:00
Nikita Smith
240935f0cc
WIP: use MSVC rule for COMDAT symbol replacement
2025-09-05 15:19:30 -07:00
Nikita Smith
e1b7168605
update weak vs undefined replacement rule
2025-09-05 15:19:30 -07:00
Nikita Smith
67e66dc26e
WIP switching to serial library search-style, removed lib scope from
...
the symbol table
2025-09-05 15:19:30 -07:00
Nikita Smith
330c8ead38
move member queue-attempt flag from symbol to lib struct
2025-09-05 15:19:30 -07:00
Nikita Smith
89d496c855
fix replacement rule for weak search library vs undefined
2025-09-05 15:19:30 -07:00
Nikita Smith
b56ce72b7f
test cases for weak vs weak
2025-08-18 19:09:32 -07:00
Nikita Smith
b05237ceec
handle anti-dependency weak symbol
2025-08-18 19:09:32 -07:00
Nikita Smith
31b2b1c0f7
add replacement cases for weak vs. undefined and vice versa
2025-08-18 19:09:32 -07:00
Nikita Smith
1d6eae2b18
minor fixes for gathering library members
2025-08-12 19:03:51 -07:00
Nikita Smith
b50f309422
modified member queue logic to prioritize libs where pull-in reference
...
symbol is declared
2025-08-11 23:28:03 -07:00
Nikita Smith
9893a8135d
fix crash when linking undefined weak symbol
2025-08-08 13:35:47 -07:00
Nikita Smith
4f6f9d61ed
inline function for replacing weak symbols with default symbol
2025-08-07 17:41:45 -07:00
Nikita Smith
9a1f96bda2
progress on /opt:ref
...
Link the debugger and strip unreferenced sections
TODO: Mark referenced undefined symbols for unresolved symbol reporting
2025-08-07 17:36:11 -07:00
Nikita Smith
d3dedd8bef
simplifying symbol table scopes
...
Linker cannot register extern import symbols initially because
the import object files are not available until all other object files are
resolved. To work around this, we create a stub weak symbol and assign
it to each import symbol. This allows linker to proceed. Once the import
object files are generated, linker replaces the stub symbol with
the actual ones from the import objects.
2025-08-05 08:39:12 -07:00
Nikita Smith
dd715dacf7
assign COMDAT symlinks as soon as the symbol table is processed
2025-08-05 08:39:11 -07:00
Nikita Smith
c1958809eb
make use of undocumented anti-dependency search property on weak symbols
...
to implement alternate name using weak symbols
2025-08-05 08:39:11 -07:00
Nikita Smith
07c7178770
filter out removed COMDATs from the PDB public symbols
2025-07-23 16:09:48 -07:00
Nikita Smith
a6b2cf64ba
WIP collect sections associations
2025-07-23 16:09:48 -07:00
Nikita Smith
d32667546d
factor out weak symbol resolution logic and apply it to the symbol table
...
when building link context
2025-07-23 16:09:48 -07:00
Nikita Smith
7cd5a670e3
WIP factoring out symbol table fixups
2025-07-23 16:09:48 -07:00
Nikita Smith
fcb06579a4
collapse symbol scope and symbol type enums
2025-06-25 10:53:25 -07:00
Nikita Smith
790c95fc80
organization pass over symbol table files
2025-06-25 10:53:24 -07:00
Nikita Smith
0aadf60359
update code block dividers
2025-06-25 10:53:24 -07:00
Nikita Smith
75d02f1c1e
check symbol presence using stable name pointer
2025-06-25 10:53:24 -07:00
Nikita Smith
af00acd0f5
add missing symbol replacement logic
2025-06-25 10:53:24 -07:00
Nikita Smith
3d2b1e19e3
handle communal var vs regular non-comdat symbol
2025-06-25 10:53:23 -07:00
Nikita Smith
fb0e8d7579
fix crash on COMDAT folding communal variable
2025-06-25 10:53:23 -07:00
Nikita Smith
bf25b5b249
handle COMDAT Associative selection
2025-06-25 10:53:23 -07:00
Nikita Smith
bde11caf11
improve exact match selection
2025-06-25 10:53:23 -07:00
Nikita Smith
aafb980c6b
prevent dropping of newly inserted symbol while selecting slot leader
2025-06-25 10:53:23 -07:00
Nikita Smith
3eb7debad5
check COMDAT symlink points to a defined symbol
2025-06-25 10:53:23 -07:00
Nikita Smith
3978181d02
check symbol type before patching section header
2025-06-25 10:53:23 -07:00
Nikita Smith
4aa6e6d132
store symbol links for COMDAT
2025-06-25 10:53:23 -07:00