18 Commits

Author SHA1 Message Date
Andrew Kelley
5a6a1f8a8a linker: update target references 2024-01-01 17:51:19 -07: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
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
Jakub Konka
f56054d129 coff: invalidate GOT relocs after segment shift in memory 2023-04-26 19:08:38 -04:00
Jakub Konka
dd300d92e1 coff: treat vmaddr of 0 as unallocated when checking if resolvable 2023-04-21 22:44:28 +02:00
Jakub Konka
ae8fb21514 coff: use TableSection for GOT 2023-04-21 22:44:28 +02:00
Jakub Konka
ee0c445765 coff: due to ASLR we need to dupe the code for relocating
In addition, we need to be careful not to mark the relocations as
resolved prematurely as then we are risking malforming the binary
as we need to resolve the relocs twice: once for in-memory writes,
and once for in-file updates.
2023-03-30 21:08:32 +02:00
Jakub Konka
216badef0b coff: use std.os.windows wrappers; fix relocating in-file 2023-03-30 21:08:31 +02:00
Jakub Konka
d2f0130855 coff: make sure we correctly slide relocation target when resolving 2023-03-30 21:08:30 +02:00
Jakub Konka
cde722a711 coff: put section growing in helper; only mark section if actually resolved 2023-03-28 21:42:55 +02:00
Jakub Konka
25f3175217 coff: use ArrayHashMap if we are iterating over keys 2023-03-28 19:27:05 +02:00
Jakub Konka
004f32e79d coff: resolve relocs on bytes buffer directly 2023-03-28 18:59:44 +02:00
Jakub Konka
db877df8eb coff: move import table definition into a separate ImportTable.zig module 2023-03-28 14:13:39 +02:00
Jakub Konka
fb3345e346 coff: do not use atoms for synthetic import address table
Instead, introduce a custom ImportTable structure which will
act as a thunk in the MachO linker, and we will use that to
calculate the address of a pointer on-the-fly.

Additionally, fix logic in writeImportTables to allow for multiple
DLLs.
2023-03-28 13:28:48 +02:00
Jakub Konka
c430e9afa7 link: make Coff atoms fully owned by the linker 2023-01-31 20:27:17 +01:00
Stevie Hryciw
04f3067a79 run zig fmt on everything checked by CI 2022-11-18 19:22:42 +00:00
Jakub Konka
1aeef29733 coff: move relocation in its own module 2022-11-06 08:41:43 +01:00