aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2025-02-26initial implementation of `@deprecated`Loris Cro
2025-02-26Compilation: disable ubsan_rt for spirv targetAli Cheraghi
2025-02-26Merge pull request #22488 from Rexicon226/ubsan-rtAndrew Kelley
implement a ubsan runtime for better error messages
2025-02-26Sema: remove legacy coercionmlugg
This was meant to be removed in #21817, but was somehow missed.
2025-02-25x86_64: use ZON for encodingsmlugg
2025-02-25Zcu: correctly resolve references to test bodiesmlugg
Resolves: #21569 Resolves: #22912
2025-02-25Merge pull request #22937 from alichraghi/ali_spvRobin Voetter
spirv: make test suite working again
2025-02-25ubsan: don't create ubsan in every static lib by defaultAndrew Kelley
Problem here is if zig is asked to create multiple static libraries, it will build the runtime multiple times and then they will conflict. Instead we want to build the runtime exactly once.
2025-02-25correct some bugsDavid Rubin
2025-02-25Compilation: correct when to include ubsanDavid Rubin
2025-02-25main: add `-f{no-}ubsan-rt` to the usage textDavid Rubin
2025-02-25Compilation: always import ubsan if a ZCU existsDavid Rubin
Unlike `compiler-rt`, `ubsan` uses the standard library quite a lot. Using a similar approach to how `compiler-rt` is handled today, where it's compiled into its own object and then linked would be sub-optimal as we'd be introducing a lot of code bloat. This approach always "imports" `ubsan` if the ZCU, if it exists. If it doesn't such as the case where we're compiling only C code, then we have no choice other than to compile it down to an object and link. There's still a tiny optimization we can do in that case, which is when compiling to a static library, there's no need to construct an archive with a single object. We'd only go back and parse out ubsan from the archive later in the pipeline. So we compile it to an object instead and link that to the static library. TLDR; - `zig build-exe foo.c` -> build `libubsan.a` and links - `zig build-obj foo.c` -> doesn't build anything, just emits references to ubsan runtime - `zig build-lib foo.c -static` -> build `ubsan.o` and link it - `zig build-exe foo.zig bar.c` -> import `ubsan-rt` into the ZCU - `zig build-obj foo.zig bar.c` -> import `ubsan-rt` into the ZCU - `zig build-lib foo.zig bar.c` -> import `ubsan-rt` into the ZCU
2025-02-25move libubsan to `lib/` and integrate it into `-fubsan-rt`David Rubin
2025-02-25Compilation: use the minimal runtime in `ReleaseSafe`David Rubin
2025-02-25ubsan: add a basic runtimeDavid Rubin
2025-02-25link.MachO.UnwindInfo: reproduce lld's commentAndrew Kelley
it explains why zero is used instead of saturation
2025-02-25link.MachO.UnwindInfo: Handle u24 overflow for CU records pointing to DWARF.Alex Rønne Petersen
Closes #23010.
2025-02-25Merge pull request #22999 from alexrp/mingw-updateAlex Rønne Petersen
2025-02-24spirv: get rid of function_types cacheRobin Voetter
This deep hash map doesn't work
2025-02-24spirv: do not generate unnecessary forward pointerAli Cheraghi
Co-authored-by: Robin Voetter <robin@voetter.nl>
2025-02-24spirv: replace some unreachables with compile errorsAli Cheraghi
2025-02-24mingw: Update MinGW-w64 sources to 3839e21b08807479a31d5a9764666f82ae2f0356.Alex Rønne Petersen
2025-02-24Merge pull request #22154 from alexrp/disable-intrinsicsAlex Rønne Petersen
compiler: Implement `@disableIntrinsics()` builtin function.
2025-02-24llvm: Fix C ABI integer promotion for loongarch64.Alex Rønne Petersen
It appears to just be a 1:1 copy of riscv64, including the super weird sign extension quirk for u32. Contributes to #21671.
2025-02-23Sema: allow `@ptrCast` of slices changing the lengthmlugg
Also, refactor `Sema.ptrCastFull` to not be a horrifying hellscape.
2025-02-22Dwarf: fix lowering of comptime-only optional pointer `null` valuesJacob Young
Closes #22974
2025-02-22Type: resolve union tag type before checking for runtime bitsDavid Rubin
2025-02-23cbe: Implement support for -fno-builtin and @disableIntrinsics().Alex Rønne Petersen
2025-02-23compiler: Implement @disableIntrinsics() builtin function.Alex Rønne Petersen
Closes #21833. Closes #22110.
2025-02-22zig build fmtAndrew Kelley
2025-02-22zig fmt: fix invalid alignment on freesAndrew Kelley
2025-02-22arch/sparc64/CodeGen: Fix indentation in realStackOffset87flowers
2025-02-23Merge pull request #22903 from alexrp/llvm-nobuiltin-memcpy-inlineAlex Rønne Petersen
`llvm`: Use inline variants of `memcpy`/`memset` intrinsics when using `-fno-builtin`
2025-02-22stage2-wasm: implement switch_dispatch + handle > 32 bit integers in switchesPavel Verigo
Updated solution is future proof for arbitary size integer handling for both strategies .br_table lowering if switch case is dense, .br_if base jump table if values are too sparse.
2025-02-22Merge pull request #22659 from ifreund/linker-script-fixAndrew Kelley
link: fix ambiguous names in linker scripts
2025-02-22llvm: Use inline variants of memcpy/memset intrinsics when using -fno-builtin.Alex Rønne Petersen
This is a correctness issue: When -fno-builtin is used, we must assume that we could be compiling the memcpy/memset implementations, so generating calls to them is problematic.
2025-02-22llvm.Builder: Update some intrinsic definitions for LLVM 19.Alex Rønne Petersen
2025-02-22link.MachO: Add support for the -x flag (discard local symbols).Alex Rønne Petersen
This can also be extended to ELF later as it means roughly the same thing there. This addresses the main issue in #21721 but as I don't have a macOS machine to do further testing on, I can't confirm whether zig cc is able to pass the entire cgo test suite after this commit. It can, however, cross-compile a basic program that uses cgo to x86_64-macos-none which previously failed due to lack of -x support. Unlike previously, the resulting symbol table does not contain local symbols (such as C static functions). I believe this satisfies the related donor bounty: https://ziglang.org/news/second-donor-bounty
2025-02-22x86_64: rewrite scalar `@bitReverse`Jacob Young
2025-02-22Sema: Fix fnptr alignment safety checks to account for potential ISA tag.Alex Rønne Petersen
As seen on e.g. Arm/Thumb and MIPS (MIPS16/microMIPS). Fixes #22888.
2025-02-21Output `zig targets` as ZON instead of JSON (#22939)Mason Remaley
* Adds startTupleField/startStructField, makes pattern in print targets less verbose * Makes some enums into strings * Start/finish renamed to begin/end I feel bad changing this, but I don't know why I named them this way in the first place. Begin/end is consistent with the json API, and with other APIs in the wild that follow this pattern. Better to change now than later.
2025-02-21wasi-libc: Deduplicate sources and headers with regards to upstream musl.Alex Rønne Petersen
Unfortunately some duplicate files must remain in lib/libc/wasi/libc-top-half because they include internal headers *in the same directory* which have edits relative to upstream musl. Because C is an amazing language, there is no way to make it so that e.g. upstream musl's src/stdio/fputc.c includes wasi-libc's src/stdio/putc.h instead of the upstream putc.h. The preprocessor always searches the current directory first for quote includes. Anyway, this still takes us from 2.9M to 1.4M for the combination of lib/libc/wasi and lib/libc/include/wasm-wasi-musl, so I still call it a win.
2025-02-21fix `-fsanitize-coverage-trace-pc-guard` and fuzzer support for C compile unitsXavier Bouchoux
- allow `-fsanitize-coverage-trace-pc-guard` to be used on its own without enabling the fuzzer. (note that previouly, while the flag was only active when fuzzing, the fuzzer itself doesn't use it, and the code will not link as is.) - add stub functions in the fuzzer to link with instrumented C code (previously fuzzed tests failed to link if they were calling into C): while the zig compile unit uses a custom `EmitOptions.Coverage` with features disabled, the C code is built calling into the clang driver with "-fsanitize=fuzzer-no-link" that automatically enables the default features. (see https://github.com/llvm/llvm-project/blob/de06978ebcff5f75913067b019d2d522d0be0872/clang/lib/Driver/SanitizerArgs.cpp#L587) - emit `-fsanitize-coverage=trace-pc-guard` instead of `-Xclang -fsanitize-coverage-trace-pc-guard` so that edge coverrage is enabled by clang driver. (previously, it was enabled only because the fuzzer was)
2025-02-19Merge pull request #22932 from jacobly0/x86_64-rewriteAndrew Kelley
x86_64: start rewriting bit counting operations
2025-02-18x86_64: rewrite scalar `@popCount`Jacob Young
2025-02-18x86_64: rewrite scalar `@ctz`Jacob Young
2025-02-18spirv: extend supported `c` constraint valuesAli Cheraghi
2025-02-18spirv: ziggify and remove unknown spirv featuresAli Cheraghi
`OpCapability` and `OpExtension` now can also be emitted from inline assembly
2025-02-18spirv: respect cpu featuresAli Cheraghi
2025-02-18spirv: cache more types & merge constructX functionsAli Cheraghi