Commit Graph

12877 Commits

Author SHA1 Message Date
Alex Rønne Petersen 07c93cb103 compiler-rt: Add a comment explaining why we currently need weak linkage. 2025-05-19 00:22:03 +02:00
Alex Rønne Petersen 90fb2d9754 compiler-rt: Fix some exports to respect the common linkage and visibility. 2025-05-19 00:22:03 +02:00
Alex Rønne Petersen 092352ec63 compiler-rt, zigc: Use hidden visibility except when testing.
This prevents symbols from these libraries from polluting the dynamic symbol
tables of binaries built with Zig. The downside is that we no longer deduplicate
the symbols at run time due to weak linkage.

Closes #7935.
Closes #13303.
Closes #19342.
2025-05-19 00:22:03 +02:00
Andrew Kelley b77e601342 Merge pull request #23834 from jacobly0/x86_64-rewrite
x86_64: finish rewriting scalar overflow and saturate operations
2025-05-18 14:36:33 -04:00
mlugg d32829e053 std.Build.Cache: change contract of addFilePostContents
This function was broken, because it took ownership of the buffer on
error *sometimes*, in a way which the caller could not tell. Rather than
trying to be clever, it's easier to just follow the same interface as
all other `addFilePost` methods, and not take ownership of the path.

This is a breaking change. The next commits will apply it to the
compiler, which is the only user of this function in the ziglang/zig
repository.
2025-05-18 17:10:04 +01:00
Alex Rønne Petersen 74a3ae4927 start: Don't artificially limit some posixCallMainAndExit() logic to Linux.
This code applies to ~any POSIX OS where we don't link libc. For example, it'll
be useful for FreeBSD and NetBSD.

As part of this, move std.os.linux.pie to std.pie since there's really nothing
Linux-specific about what that file is doing.
2025-05-18 17:14:09 +02:00
Jacob Young a3b0c242b0 x86_64: rewrite @splat 2025-05-17 18:00:17 -04:00
Jacob Young 58d2bd601e x86_64: rewrite scalar <<|
Closes #23035
2025-05-17 18:00:17 -04:00
Jacob Young 4adb7eca6a debug: correctly detect missing entries in .eh_frame_hdr 2025-05-17 02:08:41 -04:00
Jacob Young 6d68a494c8 x86_64: rewrite vector +| 2025-05-17 02:08:41 -04:00
Alex Rønne Petersen 1a82cceb8c std.Target: Factor arch/ABI into NetBSD minimum OS version selection.
Based on data in std.zig.target.
2025-05-17 04:41:27 +02:00
Alex Rønne Petersen a090ef007b std.zig.target: Add NetBSD libc support. 2025-05-17 04:41:27 +02:00
Alex Rønne Petersen c36d483ba0 libc: Add NetBSD libc abilists file.
Currently covers version 10.1.
2025-05-17 04:41:27 +02:00
Alex Rønne Petersen 1c342ca7c3 libc: Add NetBSD libc startup code from 10.1.
* sysident_assym.h was manually expanded.
    * The ELF_NOTE_MARCH_DESC and ELF_NOTE_MARCH_DESCSZ macros will be defined
      by the compiler.
* Legacy .init/.fini stuff was removed.
* GCJ nonsense was removed.
2025-05-17 04:41:27 +02:00
Alex Rønne Petersen 35f8121194 std.zig.LibCDirs: Add NetBSD libc support. 2025-05-17 04:41:27 +02:00
Alex Rønne Petersen 553cb3ed46 libc: Add NetBSD system and libc headers from 10.1.
sys/param.h was manually adjusted to not define __NetBSD_Version__ since it will
be defined by the compiler.
2025-05-17 04:41:27 +02:00
Alex Rønne Petersen 6028db7f29 std.Target: Add isNetBSDLibC() function. 2025-05-17 04:41:27 +02:00
Alex Rønne Petersen 8a7d925d36 std.Target: Fix requiresLibC() for NetBSD. 2025-05-17 04:41:27 +02:00
Alex Rønne Petersen 3d6f83b331 std.Target: Adjust DynamicLinker.standard() for NetBSD.
* powerpc64 does not appear to be a thing.
* riscv32/riscv64 have not had actual releases yet.
2025-05-17 04:41:27 +02:00
Alex Rønne Petersen 9af8e7c68e std.c: Fill out some missing definitions for supported NetBSD libc targets.
This allows ubsan-rt to build.
2025-05-17 04:41:26 +02:00
Matthew Lugg 9064907b34 Merge pull request #23907 from mlugg/ref-trace
compiler: reference trace fixes
2025-05-16 22:42:07 +01:00
Marc Tiehuis 224e39316f std.hash.Wyhash: fix dangling stack pointer
Closes #23895.
2025-05-16 15:28:20 +02:00
mlugg 46d7e808dc build runner: don't incorrectly omit reference traces
It's incorrect to ever set `include_reference_trace` here, because the
compiler has already given or not given reference traces depending on
the `-freference-trace` option propagated to the compiler process by
`std.Build.Step.Compile`.

Perhaps in future we could make the compiler always return the reference
trace when communicating over the compiler protocol; that'd be more
versatile than the current behavior, because the build runner could, for
instance, show a reference trace on-demand without having to even invoke
the compiler. That seems really useful, since the reference trace is
*often* unnecessary noise, but *sometimes* essential. However, we don't
live in that world right now, so passing the option here doesn't make
sense.

Resolves: #23415
2025-05-16 13:40:52 +01:00
HydroH cc1475c91d std: remove std.crypto.Certificate.Parsed.pubKeySigAlgo method (#23811) 2025-05-16 00:21:25 +02:00
wooster0 56fad6a195 make error messages prettier
Error messages never contain periods or grave accents.
Get rid of the periods and use apostrophes instead in
probably the only two error messages that had them.
2025-05-15 16:39:15 +01:00
Bryson Miller 08d534e8d8 Introduce common strcasecmp and strncasecmp implementations (#23840) 2025-05-15 10:58:33 +02:00
Alex Rønne Petersen bc377183ce reduce: Fix build due to std.mem.Alignment changes.
Closes #23884.
2025-05-15 03:13:41 +02: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 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 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 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 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 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 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 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
David 2c241b263c Introduce common bzero libc implementation. (#23812)
* Introduce common `bzero` libc implementation.

* Update test name according to review

Co-authored-by: Linus Groh <mail@linusgroh.de>

* address code review

- import common implementation when musl or wasi is included
- don't use `c_builtins`, use `@memset`

* bzero calling conv to .c

* Apply review

Co-authored-by: Veikka Tuominen <git@vexu.eu>

---------

Co-authored-by: Linus Groh <mail@linusgroh.de>
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2025-05-10 10:37:21 +02:00