Commit graph

33500 commits

Author SHA1 Message Date
Andrew Kelley
9f5c1038c3 init spork8 backend 2025-05-16 14:42:37 -07:00
Isaac Freund
bc2f7c7547 Revert "Work around stage1 not yet returning null-terminated @typeInfo strings"
This reverts commit c8fa767f08.
2025-05-14 06:47:23 +02:00
Cezary Kupaj
518105471e
Fix SIGSEGV handler for AArch64 Darwin targets
* ucontext_t ptr is 8-byte aligned instead of 16-byte aligned which @alignCast() expects
* Retrieve pc address from ucontext_t since unwind_state is null
* Work around __mcontext_data being written incorrectly by the kernel
2025-05-14 05:38:38 +02:00
Alex Rønne Petersen
5b606d435d
Merge pull request #21882 from alexrp/compiler-fixes
compiler: Fix some real and theoretical miscompilations with `allowzero` and `volatile`
2025-05-13 10:42:05 +02:00
wooster0
a365971a33 std.meta.intToEnum -> std.enums.fromInt
Also use an optional as the return type instead of an error code.
2025-05-13 07:28:41 +02:00
Alex Rønne Petersen
a3693aae3a
Merge pull request #23856 from alexrp/backport-llvm-120036 2025-05-13 01:08:07 +02:00
Alex Rønne Petersen
bc3c50c21e
Merge pull request #23700 from sorairolake/rename-trims
chore(std.mem): Rename `trimLeft` and `trimRight` to `trimStart` and `trimEnd`
2025-05-12 17:11:52 +02:00
Alex Rønne Petersen
9d8adb38a1
std.Build: Make no_builtin a property of Module instead of Step.Compile.
This reflects how the compiler actually treats it.

Closes #23424.
2025-05-12 17:08:22 +02:00
Alex Rønne Petersen
aa7c6dcac1
main: List -f(no-)builtin as per-module options.
Contributes to #23424.
2025-05-12 17:07:50 +02:00
Alex Rønne Petersen
74f55175d5
test: Add some basic LLVM IR tests for atomics, volatile, and allowzero. 2025-05-12 17:07:50 +02:00
Alex Rønne Petersen
e63e3f7a7c
test: Add test-llvm-ir step and harness for testing generated LLVM IR. 2025-05-12 17:07:50 +02:00
Alex Rønne Petersen
fe5dbc2474
std.Build: Change Step.Compile.no_builtin from bool to ?bool.
To be in line with other, similar options.
2025-05-12 17:07:50 +02:00
Alex Rønne Petersen
af55b27d5a
test: Fix incorrect interpretation of -Dtest-filter=... for test-debugger. 2025-05-12 17:07:50 +02:00
Alex Rønne Petersen
44bf64a709
llvm: Fix a bunch of volatile semantics violations.
Also fix some cases where we were being overzealous in applying volatile.
2025-05-12 17:07:50 +02:00
Alex Rønne Petersen
427810f3ed
llvm: Don't set nonnull attribute on pointers in non-generic address spaces.
LLVM considers null pointers to be valid for such address spaces.
2025-05-12 17:07:50 +02:00
Alex Rønne Petersen
e9ae9a5fc4
llvm: Don't set nonnull attribute on allowzero slices. 2025-05-12 17:07:49 +02:00
Alex Rønne Petersen
e95e7651ec
llvm: Set null_pointer_is_valid attribute when accessing allowzero pointers.
This informs optimization passes that they shouldn't assume that a load from a
null pointer invokes undefined behavior.

Closes #15816.
2025-05-12 17:07:49 +02:00
Alex Rønne Petersen
5c2e300f42
Air: Fix mustLower() to consider volatile for a handful of instructions.
These can all potentially operate on volatile pointers.
2025-05-12 17:07:49 +02:00
Alex Rønne Petersen
47aaaec6ea
Air: Always return true for inline assembly in mustLower().
AstGen requires inline assembly to either have outputs or be marked volatile, so
there doesn't appear to be any point in doing these checks.
2025-05-12 17:07:49 +02:00
Alex Rønne Petersen
4c36a403a8
Air: Fix mustLower() for atomic_load with inter-thread ordering. 2025-05-12 17:07:49 +02:00
Alex Rønne Petersen
d4ca9804f8
riscv64: Handle writes to the zero register sensibly in result bookkeeping. 2025-05-12 17:07:49 +02:00
Alex Rønne Petersen
61ae9a2f45
riscv64: Add missing fence for seq_cst atomic_store. 2025-05-12 17:07:49 +02:00
Alex Rønne Petersen
e40de86082
riscv64: Get rid of some trailing whitespace. 2025-05-12 17:07:49 +02:00
Alex Rønne Petersen
8285de62d5
Merge pull request #23745 from alexrp/target-os-versions
`std.Target`: Update supported OS version ranges
2025-05-12 16:59:46 +02:00
Linus Groh
abbead1fb8 libc: update macOS headers to SDK 15.2 2025-05-12 16:50:17 +02:00
Alex Rønne Petersen
2a55fcd03a
libtsan: Disable warnings when building. 2025-05-12 16:24:59 +02:00
Alex Rønne Petersen
d14f7f7a09
libtsan: Backport llvm/llvm-project#120036.
https://github.com/llvm/llvm-project/pull/120036
2025-05-12 16:24:59 +02:00
Alex Rønne Petersen
833d4c9ce4
Merge pull request #23835 from alexrp/freebsd-libc
Support dynamically-linked FreeBSD libc when cross-compiling
2025-05-12 01:19:23 +02:00
Alex Rønne Petersen
c3906718b3
Merge pull request #23810 from alexrp/more-test-targets 2025-05-11 20:52:47 +02:00
Alex Rønne Petersen
f3e851dbd0
compiler: Link libc by default when targeting FreeBSD.
We don't yet have a direct syscall layer in std.os.freebsd.
2025-05-11 11:15:23 +02:00
Alex Rønne Petersen
4c2f1e01a7
freebsd: Create strong references to __progname and environ in stub libc.so.
These symbols are defined in the statically-linked startup code. The real
libc.so.7 contains strong references to them, so they need to be put into the
dynamic symbol table.
2025-05-11 11:15:23 +02:00
Alex Rønne Petersen
6282129218
test: Add {powerpc64,riscv32}-netbsd-none to llvm_targets. 2025-05-11 11:15:23 +02:00
Alex Rønne Petersen
e8992af7f0
Compilation.Config: Default to dynamic linking with FreeBSD libc. 2025-05-11 11:15:09 +02:00
Alex Rønne Petersen
2116f2e3b2
Compilation: Don't pass -mabi to Clang on powerpc64(le)-freebsd.
The driver doesn't support it, and FreeBSD 13+ on PPC64 uses ELFv2 anyway.
2025-05-10 20:58:28 +02:00
Alex Rønne Petersen
d3a6236eef
compiler: Support building FreeBSD crt1.o/Scrt1.o and stub shared libraries.
Only works for FreeBSD 14+. Note that we still default to targeting FreeBSD 13.

Contributes to #2876.
2025-05-10 20:58:15 +02:00
Alex Rønne Petersen
837e0f9c37 std.Target: Remove ObjectFormat.nvptx (and associated linker code).
Textual PTX is just assembly language like any other. And if we do ever add
support for emitting PTX object files after reverse engineering the bytecode
format, we'd be emitting ELF files like the CUDA toolchain. So there's really no
need for a special ObjectFormat tag here, nor linker code that treats it as a
distinct format.
2025-05-10 12:21:57 +02:00
Alex Rønne Petersen
0e3609b8e0
std.Target: Factor arch/ABI into FreeBSD minimum OS version selection.
Based on data in std.zig.target.
2025-05-10 12:19:26 +02:00
Alex Rønne Petersen
eeaa1b17c6
std.zig.target: Add FreeBSD libc support. 2025-05-10 12:19:26 +02:00
Alex Rønne Petersen
9e23e1d16c
compiler: Define __FreeBSD_version when targeting FreeBSD libc. 2025-05-10 12:19:26 +02:00
Alex Rønne Petersen
be566a4c11
libc: Add FreeBSD libc abilists file.
Currently covers version 1.7 (FreeBSD 14.0.0).
2025-05-10 12:19:26 +02:00
Alex Rønne Petersen
68cd00497f
update_freebsd_libc: Add tool for updating FreeBSD libc startup code. 2025-05-10 12:19:26 +02:00
Alex Rønne Petersen
a36dcef7dc
libc: Add FreeBSD libc startup code from 14.2.0.
* NT_FREEBSD_ABI_TAG was manually adjusted from using a hardcoded value to using
  __FreeBSD_version which will be defined by the compiler.
* GCJ stuff was removed.
* HAVE_CTORS definitions were removed.
2025-05-10 12:19:26 +02:00
Alex Rønne Petersen
01390cc533
std.zig.LibCDirs: Add FreeBSD libc support. 2025-05-10 12:19:26 +02:00
Alex Rønne Petersen
6e64bc845f
libc: Add FreeBSD system and libc headers from 14.2.0.
osreldate.h and sys/param.h were manually adjusted to not __FreeBSD_version
since it will be defined by the compiler.
2025-05-10 12:19:26 +02:00
Alex Rønne Petersen
df719f249d
process_headers: Add FreeBSD libc support. 2025-05-10 12:19:26 +02:00
Alex Rønne Petersen
162b11b250
libcxxabi: Pass -fPIC via module options instead of CFLAGS. 2025-05-10 12:19:26 +02:00
Alex Rønne Petersen
610d3cf9de
compiler: Move vendored library support to libs subdirectory. 2025-05-10 12:19:26 +02:00
Alex Rønne Petersen
309ff9c34e
std.Target: Add isFreeBSDLibC() function. 2025-05-10 12:19:26 +02:00
Alex Rønne Petersen
46042170cb
std.Target: Fix requiresLibC() for FreeBSD. 2025-05-10 12:19:26 +02:00
Alex Rønne Petersen
ba9f2571b7
test: Remove some nonsensical FreeBSD targets from llvm_targets. 2025-05-10 12:19:26 +02:00