Commit Graph
100 Commits
Author SHA1 Message Date
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 f1b22dbe27 change library to use compressed member offsets 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 0ceadff525 maintain input order of objs in PDB 2025-09-05 15:19:30 -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 e1786d0a11 discard delay loads in the config before they get to link context builder 2025-08-18 19:09:32 -07:00
Nikita Smith 1ce2fbfd1a helper for setting default 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 04d2877b40 strip leading white space 2025-08-18 19:09:31 -07:00
Nikita Smith 81381f9a6d minor cleanups 2025-08-18 19:09:31 -07:00
Nikita Smith 81c68cfdd3 register common and absolute symbols in library's symbol table 2025-08-18 19:09:31 -07:00
Nikita Smith e27831902e note 2025-08-18 19:09:31 -07:00
Nikita Smith c53b8d43d0 assign symbol indices before serializing symbols so forward-references
are possible
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 086d774b8b fix ELF compressed header and skip duplicate sections 2025-08-12 14:10:13 -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 702fd74b23 minor cleanup in obj initer 2025-08-10 21:41:39 -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 cff6426741 null check for obj 2025-08-05 08:39:12 -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
Nikita Smith 7be9df0e90 move directive section gather logic to obj layer 2025-07-28 20:07:56 -07:00
Nikita Smith 72e073e4e6 fix typo that broke /NODEFAULTLIB usage 2025-07-28 20:07:56 -07:00
Nikita Smith b3efce4b9a better place for this helper function 2025-07-28 20:07:56 -07:00
Nikita Smith 1e1d903878 store library pointer in the obj instead of path; required for prioritized symbol lookup implementation 2025-07-28 20:07:56 -07:00
Nikita Smith 4cb09e73c2 remove warning pragma 2025-07-28 20:07:56 -07:00
Nikita Smith 0b37fac81c move delay load helper to mscrt layer 2025-07-28 20:07:55 -07:00
Nikita Smith 6fda20ec9c helper script for extracting obj paths out of pdb 2025-07-24 17:44:13 -07:00
Nikita Smith 54fad8a89c validate strong symbol interp type 2025-07-24 17:32:05 -07:00
Nikita Smith 6cc5be0065 opt ref test 2025-07-24 17:32:05 -07:00
Nikita Smith 2d52e274ce remove debug code 2025-07-24 17:32:05 -07:00
Nikita Smith cc6e56eee1 do full path check for thin objs only 2025-07-24 17:32:05 -07:00
Nikita Smith 9b91a0f907 github actions fun 2025-07-23 16:09:48 -07:00
Nikita Smith 9fab69002c fix buffer over-read in sinfl.h 2025-07-23 16:09:48 -07:00
Nikita 295a822889 put quotes around arguments to prevent command injection 2025-07-23 16:09:48 -07:00
Nikita Smith 07c7178770 filter out removed COMDATs from the PDB public symbols 2025-07-23 16:09:48 -07:00
Nikita Smith ffc9317067 add a relocation to "a" to prevent linker from removing .test 2025-07-23 16:09:48 -07:00
Nikita Smith 17d35cd327 add garbage collector for COMDAT sections 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 a4ac07162e test abs vs abs 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 db52ba32e6 helper for profiling parallel fors 2025-07-16 13:54:58 -07:00
Nikita Smith 093e43d2ff change output folder name 2025-07-16 13:54:58 -07:00
Nikita Smith 4322c9ccfc change torture to assume default liker to be radlink, typo fix, and
added progress report
2025-06-25 10:53:25 -07:00
Nikita Smith 17ca83697b draft symbol table fixups to prepare for refactoring symbol table patching step 2025-06-25 10:53:25 -07:00
Nikita Smith 08f2b749e8 omit file offset, file size, and hash on bss sections 2025-06-25 10:53:25 -07:00
Nikita Smith 7769a485ba more merge fixes 2025-06-25 10:53:25 -07:00
Nikita Smith 91ddd214b3 fix string to U64 conversion
- handle zero on input string
- handle upper and lower case prefixes
2025-06-25 10:53:25 -07:00
Nikita Smith a954c2125c merge fixups 2025-06-25 10:53:25 -07:00
Nikita Smith fcb06579a4 collapse symbol scope and symbol type enums 2025-06-25 10:53:25 -07:00
Nikita Smith b1723ce066 gracefully handle invalid libs 2025-06-25 10:53:25 -07:00
Nikita Smith 2ba9f2a61b fix uinited var warning 2025-06-25 10:53:24 -07:00
Nikita Smith 153d78ec6a unpoison memory-mapped files 2025-06-25 10:53:24 -07:00
Nikita Smith 790c95fc80 organization pass over symbol table files 2025-06-25 10:53:24 -07:00
Nikita Smith 7120d0c1a4 share memory mapped files 2025-06-25 10:53:24 -07:00
Nikita Smith 2fbaafa32c parallel compute common block 2025-06-25 10:53:24 -07:00
Nikita Smith a395398bdf remove global variable for null section contrib 2025-06-25 10:53:24 -07:00
Nikita Smith f5b19675cb merge conflict 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 46663688e2 on read memory map files 2025-06-25 10:53:24 -07:00
Nikita Smith 16e72fd573 remove unused switch 2025-06-25 10:53:24 -07:00
Nikita Smith 6b3a63f474 correct task name for weak symbol patch 2025-06-25 10:53:24 -07:00
Nikita Smith 65095437b7 allow forward reference tag symbols 2025-06-25 10:53:24 -07:00
Nikita Smith e487fbc494 minor torture fixes 2025-06-25 10:53:24 -07:00
Nikita Smith ba326924ee test for relocation against removed COMDAT 2025-06-25 10:53:24 -07:00
Nikita Smith ad3e6e0b79 pipe obj reads through IO layer 2025-06-25 10:53:24 -07:00
Nikita Smith 4c972c0fba handle COMDAT symbols with non-zero section offset 2025-06-25 10:53:24 -07:00
Nikita Smith 422829b196 print align and debug sections 2025-06-25 10:53:24 -07:00
Nikita Smith bddf088df1 collect type indices in L_THREAD32 2025-06-25 10:53:24 -07:00
Nikita Smith c7d6145ec9 print section contributions in RAD_MAP 2025-06-25 10:53:24 -07:00
Nikita Smith 1fde5a5120 linker natvis 2025-06-25 10:53:24 -07:00
Nikita Smith 06e844abaa remove default delay bind table 2025-06-25 10:53:24 -07:00
Nikita Smith 048600260c special case fill for bss contribs 2025-06-25 10:53:24 -07:00
Nikita Smith a4b4d5799a fixes for delay import by ordinal and null terminate ILT, IAT, BIAT, and UIAT 2025-06-25 10:53:24 -07:00
Nikita Smith 8ba64238a2 delay load test 2025-06-25 10:53:24 -07:00
Nikita Smith 3c4edba465 validate section flags on merge 2025-06-25 10:53:24 -07:00
Nikita Smith cccbbfc74c do not patch debug section symbols and patch replaced COMDATs in separate
pass
2025-06-25 10:53:24 -07:00
Nikita Smith b19be0574c function pad min - final pass over 2025-06-25 10:53:24 -07:00
Nikita Smith bbb825adf4 extract hotpatch flag from compile symbol 2025-06-25 10:53:24 -07:00
Nikita Smith a5119e3b51 WIP function pad min 2025-06-25 10:53:24 -07:00
Nikita Smith d7b8de5998 test empty section and section with removed flag 2025-06-25 10:53:24 -07:00
Nikita Smith 5fb0d978b9 WIP function pad min 2025-06-25 10:53:24 -07:00
Nikita Smith 9d93eda3ed simplify section table 2025-06-25 10:53:24 -07:00
Nikita Smith ecdee57c60 move helpers to COFF layer 2025-06-25 10:53:24 -07:00
Nikita Smith a484906cf9 create section contribution for common block 2025-06-25 10:53:24 -07:00