Instead of referencing stub indices since these can now be obtained
in a more generic fashion from the actual linked-list of atoms in
the __stub_helper section.
With this routine, we are now able to freely shift stub_helper
section in memory and in file since the VM addressing is now dynamically
dependent on the positioning of `__stub_helper` preamble and other
sections generated by the linker.
By incrementally I mean using the incremental linker machinery
and concepts. Currently, lots of repetition but already highlighted
a potential problem with resolving relocations for symbols that
weren't seen yet but wanting to write the atom to file (before
seeing the relevant atoms).
with relocations to `dyld_private` and `__dyld_stub_binder` symbols
making the routine properly dynamic (i.e., making it possible to call
the routine before VM allocation takes place).
After merging `populateMetadata` with `populateMissingMetadata`,
it is imperative we clear the number of symbols in `writeSymbolTable`.
However, this is hopefully just a temp measure until the convergence
of incremental with traditional is complete.
instead of globally storing unresolved and tentative defs,
store indices to actual symbols in the functions that are responsible
for symbol resolution.
For example, in order to run a binary on an iPhone Simulator,
you need to specify that explicitly as part of the target as
`aarch64-ios-simulator` rather than `aarch64-ios-gnu` or
`aarch64-ios` for short.
* ensure we correctly transfer `-iwithsysroot` and
`-iframeworkwithsysroot` flags with values from `build.zig` and that
they are correctly transferred forward to `zig cc`
* try to look for `libSystem.tbd` in the provided syslibroot - one
caveat that the user will have to specify library search paths too
Previously, I have incorrectly assumed that with two-level namespace
we only need to link in dylibs/frameworks that actually export symbols
which are undefined in the linked image. Turns out, regardless of
whether we link with two-level namespace (default on macOS) or a
flat namespace (more common on other platforms), we always need to
put the dylibs/frameworks as specified by the user from the linker
line into the final linked image.
Remove some unused debugging machinery such as full printing of the
symtab after symbol resolution. It was there only for the time of
rewriting the linker.