27 Commits

Author SHA1 Message Date
Jakub Konka
32ebceea95 macho: sort sections; use Atom.Alignment for alignment; init segments 2024-01-24 12:34:39 +01:00
Jakub Konka
0c171afab0 macho: parse an input object file! 2024-01-24 12:34:38 +01:00
Jakub Konka
dd0addab1f macho: get the ball rolling! 2024-01-24 12:34:38 +01:00
Jakub Konka
2f94dc939e macho: copy over new implementation sources from zld 2024-01-24 12:34:38 +01:00
Andrew Kelley
2047a6b82d fix remaining compile errors except one 2024-01-01 17:51:20 -07:00
Andrew Kelley
5a6a1f8a8a linker: update target references 2024-01-01 17:51:19 -07:00
mlugg
b355893438
compiler: correct unnecessary uses of 'var' 2023-11-19 11:11:49 +00:00
Andrew Kelley
3fc6fc6812 std.builtin.Endian: make the tags lower case
Let's take this breaking change opportunity to fix the style of this
enum.
2023-10-31 21:37:35 -04:00
Jacob Young
d890e81761 mem: fix ub in writeInt
Use inline to vastly simplify the exposed API.  This allows a
comptime-known endian parameter to be propogated, making extra functions
for a specific endianness completely unnecessary.
2023-10-31 21:37:35 -04:00
Jakub Konka
ebe371b757 macho: report basic __eh_frame problems as errors 2023-08-30 21:48:24 +02:00
Jakub Konka
ba710ec09d macho: remove obsolete error.FailedToResolveRelocationTarget 2023-08-30 20:34:16 +02:00
Jakub Konka
2c68fb3d7c macho: merge Zld state with MachO state 2023-08-29 11:40:18 +02:00
Jakub Konka
42e0850d78 macho: save indexes to all sections of interest 2023-08-29 11:39:35 +02:00
Jakub Konka
4b934b1f78 macho: use TableSection for stub entries in zld driver
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-29 11:39:34 +02:00
Jakub Konka
04e93dd265 macho: use TableSection for GOT entries in zld driver 2023-08-29 11:39:34 +02:00
Jakub Konka
da9e7e498a macho: unify Atom concept between drivers 2023-08-29 11:39:34 +02:00
Jakub Konka
7b282dffe6 macho: unify concept of SymbolWithLoc across drivers 2023-08-29 11:39:34 +02:00
Jakub Konka
d6e095de2c macho: track unwind/dwarf cfi records by symbol rather than atom
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-08-02 21:45:33 +02:00
Jakub Konka
852eb272bf macho: add fixes to __eh_frame parsing emitted by Nix C++ compiler 2023-06-25 14:33:00 -07:00
mlugg
f26dda2117 all: migrate code to new cast builtin syntax
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-24 16:56:39 -07:00
Eric Joldasov
50339f595a all: zig fmt and rename "@XToY" to "@YFromX"
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-19 12:34:42 -07:00
Jakub Konka
fa40267b04 macho: do not allocate atoms for stub entries 2023-04-21 22:44:27 +02:00
Jakub Konka
c984201ddb macho+zld: refactor parsing of relocation target 2023-03-22 15:13:17 +01:00
Andrew Kelley
aeaef8c0ff update std lib and compiler sources to new for loop syntax 2023-02-18 19:17:21 -07:00
Jakub Konka
b32f5ee932 macho: downgrade alignment requirements for symtab in object files
Parse and sort relocations by address descending.
2023-02-06 13:23:08 +01:00
Jakub Konka
02db9933a4 macho: properly relocate target symbol address in __eh_frame 2023-01-21 14:11:56 +01:00
Jakub Konka
835a60a34f zld: parse, synthesise and emit unwind records 2023-01-20 18:43:16 +01:00