11355 Commits

Author SHA1 Message Date
Jakub Konka
17ec2cea64 macho: remove error_union return from resolveRelocations() 2023-03-28 21:52:44 +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
70838d34aa coff: assert the imports table is not dirty 2023-03-28 14:17:12 +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
2a5c4ea8f0 coff: repurpose value field of import Symbol for lib_name offset 2023-03-28 12:28:49 +02:00
Jakub Konka
0dc210f950 link: pass expected lib name as hint in getGlobalSymbol() 2023-03-28 12:28:48 +02:00
Jakub Konka
d2040b2763 coff: grow .idata if required 2023-03-28 12:28:48 +02:00
Jacob Young
fd13e44e0c x86_64: cleanup debug mir dumping 2023-03-27 05:58:00 -04:00
Jacob Young
802c2e4fae x86_64: fix popcnt and disable regressed test 2023-03-27 05:58:00 -04:00
Jacob Young
6c54428415 x86_64: implement trunc with large source 2023-03-27 05:58:00 -04:00
Jacob Young
587eacefec x86_64: fix 64-bit multiply by 32-bit immediate 2023-03-27 05:58:00 -04:00
Jacob Young
65838fcabe x86_64: implement some binary ops for large values 2023-03-27 05:58:00 -04:00
Jacob Young
3a516433b0 x86_64: add live codegen debug 2023-03-27 05:58:00 -04:00
Jacob Young
abb37a7cb8 x86_64: factor out lowering from emitting 2023-03-27 05:58:00 -04:00
Jacob Young
86625c5a75 x86_64: enable mem dst bin ops, and fix uncovered bugs 2023-03-27 04:31:39 -04:00
Jakub Konka
32591c1d99
Merge pull request #15076 from jacobly0/x86_64-backend
x86_64: implement things
2023-03-26 17:31:42 +02:00
Veikka Tuominen
4a5628e730 Module: fix lazy srcloc resolution for new for loop syntax
Closes #15081
2023-03-26 15:14:03 +03:00
Jacob Young
14c0b8c548 x86_64: remove unused Mir encodings
This also restores the size of Mir.Inst and simplifies logic in general.
2023-03-25 21:26:18 -04:00
Jacob Young
d29c674d0d x86_64: implement teb inline assembly for windows 2023-03-25 16:23:55 -04:00
Jacob Young
1e080e5056 x86_64: implement atomic loops 2023-03-25 16:23:55 -04:00
Jacob Young
6d9bdc8733 x86_64: fix cmpxchg 2023-03-25 16:23:55 -04:00
Jacob Young
a2f6e068b0 x86_64: implement 128-bit intcast 2023-03-25 16:23:55 -04:00
Jacob Young
d064cf639f x86_64: implement 128-bit shifts 2023-03-25 16:23:55 -04:00
Jacob Young
77300c02d6 x86_64: implement large ptr_elem_val 2023-03-25 16:23:55 -04:00
Jacob Young
8f385e77ca x86_64: implement struct_field_val for packed containers 2023-03-25 16:23:55 -04:00
Jacob Young
0cfc0d0d13 x86_64: implement struct_field_ptr for packed containers 2023-03-25 16:23:55 -04:00
Jacob Young
d9ce69dc39 codegen: fix ptr-like optional constants 2023-03-25 16:23:55 -04:00
Jacob Young
3ece975857 x86_64: implement saturating arithmetic 2023-03-25 16:23:55 -04:00
Jacob Young
4ab4bd04fe x86_64: add back assume unused
This seems to have been asserting due to a value tracking bug that has
since been fixed.
2023-03-24 21:34:38 -04:00
Jacob Young
0987ed1970 x86_64: detect canonicalisation hazards 2023-03-24 17:57:58 -04:00
Jacob Young
5e0f091684 x86_64: try to fix br canonicalization 2023-03-24 17:57:58 -04:00
Jacob Young
935ec9ec6a x86_64: canonicalize each br of a block 2023-03-24 17:57:58 -04:00
Jacob Young
c604111e22 x86_64: fix block result value tracking 2023-03-24 17:57:58 -04:00
Jacob Young
12c07fcf20 x86_64: fix more value tracking bugs 2023-03-24 17:57:58 -04:00
Jacob Young
dbe1b4a7e5 x86_64: fix value tracking bugs 2023-03-24 17:57:58 -04:00
Jakub Konka
dcdb878360 macho+zld: only check for alias symbols for non-extern relocations 2023-03-23 22:32:09 +01:00
Jakub Konka
dc6b05408a
Merge pull request #15041 from ziglang/fix-14923
macho: fix Go mislinking on aarch64-macos, and misc cleanup
2023-03-22 18:30:00 +01:00
Jakub Konka
1eb4264b7a macho+zld: make sure we populate source section index lookup if no undefs 2023-03-22 15:13:52 +01:00
Jakub Konka
c984201ddb macho+zld: refactor parsing of relocation target 2023-03-22 15:13:17 +01:00
Jakub Konka
8bffe87e9e macho: collect all exports into the export trie 2023-03-21 21:31:24 +01:00
Jakub Konka
1be8621815 macho+zld: when finding by address, note the end of section symbols too
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-03-21 21:27:22 +01:00
Jakub Konka
dc98009e36 macho+zld: save all defined globals in the export trie 2023-03-21 16:12:25 +01:00
Jakub Konka
cb34d6f436 macho+zld: put locals and globals in function-starts section 2023-03-21 14:43:02 +01:00
Jakub Konka
83352678d4 macho+zld: put __TEXT bound sections in __TEXT segment 2023-03-21 14:30:30 +01:00
John Schmidt
ec445fb6b8 Improve error messages for break type coercion 2023-03-21 15:09:42 +02:00
mlugg
f9b5829508 Sema: implement @export for arbitrary values 2023-03-21 15:04:39 +02:00
Xavier Bouchoux
898e4473e8 CBE: implement aggregateInit() for array of array case.
fixes `error(compilation): clang failed with stderr: error: array type 'uint32_t[10]' (aka 'unsigned int[10]') is not assignable`
2023-03-21 14:56:04 +02:00