Commit Graph

218 Commits

Author SHA1 Message Date
Nikita Smith c7c86cd360 do not report unresolved symbols in debug info sections 2025-09-16 10:31:01 -07:00
Nikita Smith b1609017c5 inline xxhash functions 2025-09-08 16:07:31 -07:00
Nikita Smith 98a05728b3 add check for whether weak symbol is resolved 2025-09-08 16:07:31 -07:00
Nikita Smith ee3832ea3b parallel for lib symbol search 2025-09-08 16:07:31 -07:00
Nikita Smith 8f749f4239 use global symbol table to detect duplicate imports 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 069d683690 fix crash when obj does not have debug info 2025-09-06 09:54:23 -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 21163264d4 redirect entry point to CRT version if name is inferred 2025-09-06 09:54:22 -07:00
Nikita Smith f2ee135439 fix up symbols visibility 2025-09-05 15:19:31 -07:00
Nikita Smith 56c43ad614 clean up HashTable, removed unused command line switches, added
list wrapper for alt names, added natvis for HashTable, AltNameList,
MergeDirectiveList, and IncludeSymbolList
2025-09-05 15:19:31 -07:00
Nikita Smith 6a3d7e65f3 remove year from the copyright 2025-09-05 15:19:31 -07:00
Nikita Smith e88dc44f31 clean up debug leftovers 2025-09-05 15:19:31 -07:00
Nikita Smith 580303b0dd emit jump thunks for imports only when needed 2025-09-05 15:19:30 -07:00
Nikita Smith 43e81b934b move weak symbol replacer to the symbol table layer 2025-09-05 15:19:30 -07:00
Nikita Smith 8d75497bba do not set function pad min switch by default 2025-09-05 15:19:30 -07:00
Nikita Smith 0b0a2664d1 merge .idata with .rdata 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 d9eb26a830 infer subsystem when only entry point is specified 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 d7cdaa98b5 oops forgot to set enum type 2025-09-05 15:19:30 -07:00
Nikita Smith 41fe8a7410 merge undefined and weak search passes 2025-09-05 15:19:30 -07:00
Nikita Smith b64e1dca9a WIP fix lib push order and sort new inputs 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 257914da2f handle alternate name directive after obj input 2025-08-18 19:09:32 -07:00
Nikita Smith b19f73b93a change unresolved weak symbol type to undefined 2025-08-18 19:09:32 -07:00
Nikita Smith cdf515793f stop walking on reaching an undefined symbol 2025-08-18 19:09:32 -07:00
Nikita Smith 0983915f40 oops forgot to init the delay load dll hash table and the established name string 2025-08-18 19:09:32 -07:00
Nikita Smith 1bca83610f changed symbol search logic to run in three steps: undefined, weak,
and anti-dependency weak, allowing linking to proceed only after
symbols from previous step are added to the symbol table

this solves the problem of anti-dependency symbols because they are
searched in libraries if the dependency is unresolved weak symbol
2025-08-18 19:09:32 -07:00
Nikita Smith a3582332ee push a null symbol as a terminator for /alternatename weak symbol chain 2025-08-18 19:09:31 -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 829a35430c add flag to exclude objs from debug info input 2025-08-11 02:49:26 -07:00
Nikita Smith 2b02f5cec6 lifetime fixes
- fully serialize the lib because we cannot guarantee that its members
  will have the same lifetime as the serialized lib
- put import stub symbols on the symbol table arena
2025-08-10 21:35:33 -07:00
Nikita Smith 7466da1479 mark referenced symbols as live for unresolved-symbol detection 2025-08-08 15:54:21 -07:00
Nikita Smith 9893a8135d fix crash when linking undefined weak symbol 2025-08-08 13:35:47 -07:00
Nikita Smith 137eb6403a fix crash when relocation points to an undefined section symbol 2025-08-07 22:40:20 -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 1fe85acff8 refactor include symbols to go through same code path as alternate name symbols 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 8d246d0c6a pass down to config obj; preparing to refactor alternate name out of the symbol table 2025-08-05 08:39:11 -07:00
Nikita Smith 92e6069104 collapse obj directive directive code paths 2025-07-28 20:07:56 -07:00
Nikita Smith 18f83521e4 clean up pass over directives handler; preparing to collapse code paths 2025-07-28 20:07:56 -07:00
Nikita Smith 0b904f4e24 extract function size infer logic into its own block 2025-07-28 20:07:56 -07:00