Veikka Tuominen
66520c8342
Sema: validate array element types
...
Fixes the compiler crash part of #15175
2023-04-05 14:45:56 +03:00
Veikka Tuominen
82a6acca93
Sema: implement inline switch capture at comptime
...
Closes #15157
2023-04-05 14:45:56 +03:00
Jakub Konka
a503724801
macho: reapply relocation dirtying logic from coff linker
2023-04-05 05:57:09 +02:00
Jakub Konka
f372995e1e
macho: refactor adding GOT and stub entries
...
Don't special-case resolving of `dyld_stub_binder`.
2023-04-05 05:57:09 +02:00
Jakub Konka
5ea6e78943
Merge pull request #15162 from jacobly0/x86_64-start
...
x86_64: get enough things working to enable full `start.zig` logic
2023-04-05 03:02:42 +02:00
Jakub Konka
3a8362e751
macho+zld: refactor how we resolve dyld_stub_binder symbol
2023-04-04 15:44:01 +02:00
Jacob Young
821eb595f4
x86_64: implement cmp_lt_errors_len
2023-04-03 15:19:07 -04:00
Jacob Young
9fd460821f
elf: cleanup phdr tracking
...
Since one of the program header entries is now the program header table
itself, we can avoid tracking it explicitly and just track it as yet
another program segment.
2023-04-03 14:17:43 -04:00
Jakub Konka
c0e9b84997
elf: preallocate offsets for PT_PHDR and PT_LOAD (empty) segment
...
Otherwise, we will be using `undefined` as the offset to allocate
remaining phdrs and shdrs.
2023-04-03 18:30:55 +02:00
Jacob Young
5900dc0580
x86_64: fix typos
2023-04-03 18:02:55 +02:00
Jacob Young
562170681a
link: cleanup lazy symbols
...
We now only update one lazy symbol in flushModule.
Updating the rest from updateDecl is TBD.
2023-04-03 18:02:53 +02:00
Jacob Young
f0d13489f8
Elf: add program headers for the program header table
2023-04-03 17:45:17 +02:00
Jacob Young
cd24ab7f6e
x86_64: canonicalise loops
2023-04-03 17:45:16 +02:00
Jacob Young
1980f5479b
x86_64: implement store to immediate address
2023-04-03 17:45:16 +02:00
Jacob Young
272acb7ee5
x86_64: implement storing large immediates
2023-04-03 17:45:16 +02:00
Jacob Young
f5f0d95f0e
x86_64: implement a more generic assembler for inline assembly
2023-04-03 17:45:16 +02:00
Jakub Konka
72137824e5
macho: clean up code responsible for growing sections in file
2023-04-03 10:07:49 +02:00
Jakub Konka
ad8dfd3673
macho+coff: remove alignment from Atom as it is unused
2023-04-03 09:14:36 +02:00
Jacob Young
f4b411314c
Sema: defer stores to inferred allocs
...
This lets us generate the store with knowledge of the type to be stored.
Therefore, we can avoid generating garbage Air with stores through
pointers to comptime-only types which backends cannot lower.
Closes #13410
Closes #15122
2023-04-02 18:05:44 +03:00
Jacob Young
f4359531b1
x86_64: implement shl with overflow
2023-04-02 06:11:12 -04:00
Jacob Young
0e289cc826
x86_64: implement large add/sub with overflow
2023-04-02 05:16:46 -04:00
Jacob Young
c713c86389
x86_64: implement wide multiply
2023-04-02 04:49:53 -04:00
Jacob Young
b80cdde4f0
x86_64: implement struct_field_val for large packed structs
2023-04-02 04:49:53 -04:00
Jacob Young
83a208c355
x86_64: implement large cmp
2023-04-02 04:49:53 -04:00
Jacob Young
677427bc3a
x86_64: implement error name
2023-04-02 04:49:53 -04:00
Jacob Young
ccefa9dbf5
x86_64: implement calling var args functions
2023-04-02 04:49:53 -04:00
Jacob Young
ac68d72d24
x86_64: implement aggregate init of a packed struct
2023-04-02 04:49:53 -04:00
Jakub Konka
a88c0b4d08
link: handle -u flag in all linkers
...
Also clean up parsing of linker args - reuse `ArgsIterator`.
In MachO, ensure we add every symbol marked with `-u` as undefined
before proceeding with symbol resolution. Additionally, ensure those
symbols are never garbage collected.
MachO entry_in_dylib test: pass `-u _my_main` when linking executable
so that it is not incorrectly garbage collected by the linker.
2023-04-01 14:22:44 +02:00
Jakub Konka
2dd178443a
macho: do not assume entrypoint is defined
2023-04-01 14:22:44 +02:00
Jakub Konka
6f83a741d8
macho: handle weird case of entrypoint being a stub
2023-04-01 14:22:44 +02:00
Jakub Konka
f2587de4e9
macho: look for entry in archives/dylibs too
2023-04-01 14:22:44 +02:00
Jakub Konka
ab2b70f6c1
tapi: update to latest Apple changes
2023-04-01 08:31:27 +02:00
Jakub Konka
9ea04f4f1c
tapi: update yaml parser
...
5de8b0b3a2
2023-04-01 08:31:16 +02:00
Loris Cro
9cb2919d50
Merge pull request #15127 from der-teufel-programming/autodoc_newbuiltins
...
autodoc: Add new builtins to Autodoc
2023-03-31 17:30:09 +02:00
Loris Cro
ab2c602f34
Merge pull request #14823 from der-teufel-programming/autodoc-quickfixes
...
autodoc: Add struct to tryResolveRefPath
2023-03-31 17:26:55 +02:00
Krzysztof Wolicki
b69578e19c
autodoc: add new builtins
2023-03-31 11:47:14 +02:00
Krzysztof Wolicki
652b005f9b
autodoc: fix Extended builtin functions names rendering
2023-03-31 11:47:14 +02:00
Jakub Konka
908ccce064
coff: enable hot-code swapping on a compatible host only
2023-03-30 21:24:49 +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
5d387742fd
coff: reimplement VirtualProtectEx using our own ntdll wrapper
2023-03-30 21:08:31 +02:00
Jakub Konka
423b9f1114
coff: reimplement Read/WriteProcessMemory using our own ntdll wrappers
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
39d6303644
coff: first (not-fully-functional) PoC of HCS
2023-03-30 21:08:30 +02:00
Jakub Konka
22e1b03360
coff: use copy in zig-cache for child process in HCS
...
Ideally, we would just do an atomic rename, but so far I had no
luck. I have also tried marking the file to delete-on-close but
then we cannot use it to spawn the process. So for now, let's just
put a copy in `zig-cache` and let the user decide when to recycle
the cache dir.
2023-03-30 21:08:30 +02:00
Robin Voetter
3357c59ceb
new builtins: @workItemId, @workGroupId, @workGroupSize
...
* @workItemId returns the index of the work item in a work group for a
dimension.
* @workGroupId returns the index of the work group in the kernel dispatch for a
dimension.
* @workGroupSize returns the size of the work group for a dimension.
These builtins are mainly useful for GPU backends. They are currently only
implemented for the AMDGCN LLVM backend.
2023-03-30 12:20:24 +03:00
Tw
11903436a9
llvm/bpf: disable llvm builtins for bpf target
...
As bpf program has no global section for constant values (especially strings),
so use llvm's builtins (like memcpy, memset, etc) will lead to compilation failure
(something like this: A call to built-in function 'memcpy' is not supported.)
Signed-off-by: Tw <tw19881113@gmail.com>
2023-03-30 12:11:04 +03:00
Jacob Young
0543def52f
llvm: fix crashes when loading a struct field
...
The result of buildStructGEP is not always a GEP (sorry), so we can't
use getGEPResultElementType on it.
Closes #14641
2023-03-30 11:54:24 +03:00
Jakub Konka
46b2f1f705
Merge pull request #15105 from ziglang/hcs-win-poc
...
coff: improve handling of relocs and general linker fixes
2023-03-29 09:21:52 +02:00
Jacob Young
dd66e0addb
Sema: fix empty slice pointer value
...
We just checked that inst_child_ty was effectively a zero-bit type, so
it is certainly not the non-zero alignment we are looking for.
Closes #15085
2023-03-28 23:12:19 +03:00