aboutsummaryrefslogtreecommitdiff
path: root/src/link/MachO/Object.zig
AgeCommit message (Collapse)Author
2023-09-21compiler: move struct types into InternPool properAndrew Kelley
Structs were previously using `SegmentedList` to be given indexes, but were not actually backed by the InternPool arrays. After this, the only remaining uses of `SegmentedList` in the compiler are `Module.Decl` and `Module.Namespace`. Once those last two are migrated to become backed by InternPool arrays as well, we can introduce state serialization via writing these arrays to disk all at once. Unfortunately there are a lot of source code locations that touch the struct type API, so this commit is still work-in-progress. Once I get it compiling and passing the test suite, I can provide some interesting data points such as how it affected the InternPool memory size and performance comparison against master branch. I also couldn't resist migrating over a bunch of alignment API over to use the log2 Alignment type rather than a mismash of u32 and u64 byte units with 0 meaning something implicitly different and special at every location. Turns out you can do all the math you need directly on the log2 representation of alignments.
2023-08-30macho: report basic __eh_frame problems as errorsJakub Konka
2023-08-29macho: handle mismatched and missing platform errorsJakub Konka
2023-08-29macho: parse platform info from each object file into Platform structJakub Konka
2023-08-29macho: merge Zld state with MachO stateJakub Konka
2023-08-29macho: save indexes to all sections of interestJakub Konka
2023-08-29macho: unify creating atomsJakub Konka
2023-08-29macho: move initSection into MachO from ZldJakub Konka
2023-08-29macho: move getOutputSection into AtomJakub Konka
2023-08-29macho: use TableSection for stub entries in zld driverJakub Konka
Write thunks separately from other atoms - this can still be improved by not using atoms at all, but one thing at a time.
2023-08-29macho: unify Atom concept between driversJakub Konka
2023-08-29macho: unify Section concept across driversJakub Konka
2023-08-29macho: unify concept of SymbolWithLoc across driversJakub Konka
2023-08-29macho: simplify input file parsing for both driversJakub Konka
2023-08-16macho: tie FDEs and unwind records to all symbol aliasesJakub Konka
This is in particular very important to the Zig language which allows exporting the same symbol under different names. For instance, it is possible to have a case such that: ``` ... 4258 T _foo 4258 T _bar ... ``` In this case we need to keep track of both symbol names when resolving FDEs and unwind records.
2023-08-02macho: track unwind/dwarf cfi records by symbol rather than atomJakub Konka
This solves the nuance case of compiling hand-crafted assembly files which do not feature `MH_SUBSECTIONS_VIA_SYMBOLS` flag resulting in input `Atom`s encompassing multiple symbols each with unique unwind information.
2023-06-25macho: add fixes to __eh_frame parsing emitted by Nix C++ compilerJakub Konka
2023-06-24all: migrate code to new cast builtin syntaxmlugg
Most of this migration was performed automatically with `zig fmt`. There were a few exceptions which I had to manually fix: * `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten * `@truncate`'s fixup is incorrect for vectors * Test cases are not formatted, and their error locations change
2023-06-16migration: std.math.{min, min3, max, max3} -> `@min` & `@max`r00ster91
2023-05-23std.sort: add pdqsort and heapsortAli Chraghi
2023-04-28update codebase to use `@memset` and `@memcpy`Andrew Kelley
2023-03-22macho+zld: make sure we populate source section index lookup if no undefsJakub Konka
2023-03-22macho+zld: refactor parsing of relocation targetJakub Konka
2023-03-21macho+zld: when finding by address, note the end of section symbols tooJakub Konka
Previously, if we were looking for the very last symbol by address in some section, and the next symbol happened to also have the same address value but would reside in a different section, we would keep going finding the wrong symbol in the wrong section. This mechanism turns out vital for correct linking of Go binaries where the runtime looks for specially crafted synthetic symbols which mark the beginning and end of each section. In this case, we had an unfortunate clash between the end of PC marked machine code section (`_runtime.etext`) and beginning of read-only data (`_runtime.rodata`).
2023-02-18update std lib and compiler sources to new for loop syntaxAndrew Kelley
2023-02-06macho: parse and sort data-in-code entries ahead of timeJakub Konka
2023-02-06macho: downgrade alignment requirements for symtab in object filesJakub Konka
Parse and sort relocations by address descending.
2023-01-21macho: fix sorting symbols by seniorityJakub Konka
2023-01-21macho: synthesise unwind records in absence of compact unwind sectionJakub Konka
Unlike Apple ld, we will not do any DWARF CFI parsing and simply output DWARF type unwind records.
2023-01-20zld: parse, synthesise and emit unwind recordsJakub Konka
2022-10-30macho: fix regression in dead strip for x86_64Jakub Konka
Correctly handle calculating encompassing atoms for local relocations (`r_extern == 0`).
2022-10-22macho: some docsJakub Konka
2022-10-22macho: gracefully handle uninitialized symtabs in objectsJakub Konka
2022-10-22macho: fix handling of lack of subsections and tracking of inner symbolsJakub Konka
2022-10-22macho: fix bug in incorrectly splicing nodes in trieJakub Konka
2022-10-22macho: do not assume __la_symbol_ptr was createdJakub Konka
2022-10-22macho: upstream rewritten traditional linker, zldJakub Konka
kubkon/zld gitrev 5733ed87abe2f07e1330c3232a252e9defec638a
2022-09-18macho: fix after sync with masterJakub Konka
2022-09-18macho: rewrite how we allocate space in incremental contextJakub Konka
2022-09-18macho: do not call populateMissingMetadata in full link modeJakub Konka
2022-09-18macho: clean up use of section idsJakub Konka
2022-09-18macho: move main driver loop for one-shot into standalone zld moduleJakub Konka
2022-09-17macho: do not assume every object has a symtabJakub Konka
For example, building stage2 requires an empty `empty.cc` source file compiling which generates a valid translation unit with no symtab/strtab. In this case, we cannot simply assume that every translation unit will have a valid symtab; instead, we cautiously default the input symtab and strtab fields to optional `null` to signal symtab's presence or its lack of. In case the symtab is not present, we catch this fact when splitting input sections into subsections and create a synthetic symbol per every suitable section.
2022-08-24Merge pull request #12574 from Vexu/remove-bit-op-type-paramAndrew Kelley
stage2+stage1: remove type parameter from bit builtins
2022-08-23macho: fix compile errors in std.debugJakub Konka
2022-08-23std.debug: implement support for DWARFv5Andrew Kelley
2022-08-22Dwarf: Added stroffsetsptr support (#12270)Keith Chambers
* Added support for stroffsetsptr class in Dwarf stdlib * Proper initializion of debug_str_offsets in DwarfInfo * Added missing null initializer to DwarfInfo in Macho * Added missing is_64 field to getAttrString in DwarfInfo * Fixed formatting * Added missing is_64 param to getAttrString * Added required cast to usize * Adding missing .debug_str_offsets initialization * getAttrString now uses the str_offsets_base attr
2022-08-22stage2+stage1: remove type parameter from bit builtinsVeikka Tuominen
Closes #12529 Closes #12511 Closes #6835
2022-08-10link.MachO: use accurate alignment attribute on pointersAndrew Kelley
Also adds a new method to ArrayList: appendUnalignedSlice
2022-08-10Revert "macho: allow unaligned offsets in object files"Andrew Kelley
This reverts commit 45c444ff18b43d30a7277e346174ba6eca4a6193.