Commit Graph
49 Commits
Author SHA1 Message Date
Nikita SmithandRyan Fleury 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 SmithandRyan Fleury dd715dacf7 assign COMDAT symlinks as soon as the symbol table is processed 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 b3efce4b9a better place for this helper function 2025-07-28 20:07:56 -07:00
Nikita SmithandRyan Fleury 07c7178770 filter out removed COMDATs from the PDB public symbols 2025-07-23 16:09:48 -07:00
Nikita SmithandRyan Fleury 17d35cd327 add garbage collector for COMDAT sections 2025-07-23 16:09:48 -07:00
Nikita SmithandRyan Fleury 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 SmithandRyan Fleury 7cd5a670e3 WIP factoring out symbol table fixups 2025-07-23 16:09:48 -07:00
Nikita SmithandRyan Fleury 17ca83697b draft symbol table fixups to prepare for refactoring symbol table patching step 2025-06-25 10:53:25 -07:00
Nikita SmithandRyan Fleury 2fbaafa32c parallel compute common block 2025-06-25 10:53:24 -07:00
Nikita SmithandRyan Fleury a395398bdf remove global variable for null section contrib 2025-06-25 10:53:24 -07:00
Nikita SmithandRyan Fleury 46663688e2 on read memory map files 2025-06-25 10:53:24 -07:00
Nikita SmithandRyan Fleury 4c972c0fba handle COMDAT symbols with non-zero section offset 2025-06-25 10:53:24 -07:00
Nikita SmithandRyan Fleury a5119e3b51 WIP function pad min 2025-06-25 10:53:24 -07:00
Nikita SmithandRyan Fleury 5fb0d978b9 WIP function pad min 2025-06-25 10:53:24 -07:00
Nikita SmithandRyan Fleury 9d93eda3ed simplify section table 2025-06-25 10:53:24 -07:00
Nikita SmithandRyan Fleury 15836572f4 factor out section sort index into contribution chunk and simplify
contribution sorting
2025-06-25 10:53:24 -07:00
Nikita SmithandRyan Fleury 205723f8d6 parallelize symbol tables patching 2025-06-25 10:53:24 -07:00
Nikita SmithandRyan Fleury 1c08db2705 move image, import lib, and debug info builders outside of the state machine 2025-06-25 10:53:24 -07:00
Nikita SmithandRyan Fleury 1c656979d2 move MSVC lib symbols to CRT layer 2025-06-25 10:53:23 -07:00
Nikita SmithandRyan Fleury e911bf5368 move obj writer for PE debug directory to stand-alone file 2025-06-25 10:53:23 -07:00
Nikita SmithandRyan Fleury 89e2ea15ad add /RAD_REMOVE_SECTION switch and special case debug sections 2025-06-25 10:53:23 -07:00
Nikita SmithandRyan Fleury 0f9321e92a move default linker options to main file 2025-06-25 10:53:23 -07:00
Nikita SmithandRyan Fleury 73fe9d223a handle /ALTERNATENAME directive 2025-06-25 10:53:22 -07:00
Nikita SmithandRyan Fleury f75cdd23d7 collapse linker input states into one state 2025-06-25 10:53:22 -07:00
Nikita SmithandRyan Fleury f467ff8822 WIP move export and import table make code to appropriate layers 2025-06-25 10:53:22 -07:00
Nikita SmithandRyan Fleury 69d5010245 WIP switching to creating import table objs 2025-06-25 10:53:22 -07:00
Nikita SmithandRyan Fleury f25dc5cc8d pack export table into obj and input back to the linker 2025-06-25 10:53:22 -07:00
Nikita SmithandRyan Fleury 3a7afcd80c replace linker lib writer with one from COFF 2025-06-25 10:53:22 -07:00
Nikita SmithandRyan Fleury 7c071e7238 linker checkpoint 2025-06-25 10:53:22 -07:00
Nikita SmithandRyan Fleury 19a7ada1dc make export table with COFF obj writer,
partially converted import table to COFF obj writer
2025-06-25 10:53:21 -07:00
Nikita SmithandRyan Fleury 3a2bb318c7 make import lib objs with COFF obj writer 2025-06-25 10:53:21 -07:00
Nikita SmithandRyan Fleury e580b69180 make linker obj with COFF obj writer 2025-06-25 10:53:21 -07:00
Nikita SmithandRyan Fleury c45088b546 replaced dependency on linker's chunking for resource serialization
with COFF obj writer
2025-06-25 10:53:21 -07:00
Nikita Smith ab05133f8a picked better name convention for the section table 2025-04-04 15:47:56 -07:00
Nikita Smith bbce89eada added /RAD_WRITE_TEMP_FILES
When enabled linker writes image and debug info to temporary files
and renames them after all writes are done.
2025-02-25 14:41:34 -08:00
Nikita Smith 153bbc7b1d pass over COFF layer
- updated naming convention on structs, enums, and macros to conform with code base style
- moved related structs closer to each other
- moved parser code to separate file
2025-01-20 19:31:52 -08:00
Nikita Smith 08a368dd66 handle ADDR32 base relocation 2024-12-06 15:35:33 -08:00
Nikita Smith 435f6c4ef6 append .lib to defaultlibs 2024-11-15 16:14:00 -08:00
Nikita Smith b631d431fa create section layout without copying chunk data and perform chunk data
copy in parallel given layout
2024-11-15 16:14:00 -08:00
Nikita Smith 0d0951bf08 squash some image-related steps into finalize image 2024-11-12 10:36:44 -08:00
Nikita Smith 214be8c433 moved Guid struct and related helpers to base 2024-11-07 11:54:25 -08:00
Nikita Smith 4a2e1dd8d0 switch to thread safe hash trie map
Initial implementation of the symbol table allowed us to push symbols
from one thread at a time and required a wonky lock-step and spread out
logic for replacing symbols. And because it was a externally chained
hash table we had to guesstimate optimal capacity for small and big targets.
We erred on the side of larger capacity to prevent degradation and
rehashing, however this meant small targets had to spent unreasonable
amount of time memory allocing slots. With hash trie we can dynamically
scale up to 4 ^ 32 items and atomically replace symbols when needed. Neat!
2024-10-30 15:43:53 -07:00
Nikita Smith 26611c5454 moved IO related code to stand-alone file, piped all read/and writes
through new API, /rad_log now can enable read and/or write logs with
"io", "io_reads", "io_writes" parameters.
2024-10-19 16:36:32 -07:00
Nikita Smith 800a2349e5 pass over COFF resource reader and writer 2024-10-19 13:44:36 -07:00
Nikita Smith 46390ba0b8 reworked manifest handling
- manifest files wont be created unless symbols are resolved
- delay mt.exe presence check until we launch it
- create explicit case that writes manifests to disk
- moved manifest dependency collection step to happen after obj input
- removed /rad_delete_manifest
2024-10-18 23:37:30 -07:00
Nikita Smith f792da5d31 manifest... 2024-10-18 16:53:30 -07:00
Nikita Smith d04e86c007 rename merged manifest 2024-10-18 16:23:51 -07:00
Nikita Smith 932df7bf68 linker 2024-10-15 17:25:22 -07:00