33061 Commits

Author SHA1 Message Date
Alex Rønne Petersen
47e46b58d2
std.os.linux: Add missing time_t definition for sparc64. 2025-05-01 21:34:49 +02:00
Ali Cheraghi
200fb1e92e
test: skip "struct fields get automatically reordered" for spirv64 backend 2025-05-01 21:34:34 +02:00
psbob
8717453208
Fix Unexpected error for 1453 on Windows (#23729) 2025-05-01 21:31:58 +02:00
Dongjia Zhang
8a5f834240
use correcct symbol for the end of pcguard section 2025-04-28 20:48:30 +02:00
mlugg
bee19572c8
Sema: fix a few indexing bugs
* Indexing zero-bit types should not produce AIR indexing instructions
* Getting a runtime-known element pointer from a many-pointer should
  check that the many-pointer is not comptime-only

Resolves: #23405
2025-04-28 20:48:24 +02:00
dweiller
b5c22777f8
sema: do checked cast when resolving aggregate size 2025-04-28 20:48:19 +02:00
xdBronch
7e68999f79
Sema: fix memcpy with C pointers 2025-04-28 12:10:04 +02:00
Alex Rønne Petersen
470dac8a77
wasi-libc: Fix paths to psignal.c and strsignal.c.
Closes #23709.
2025-04-28 01:03:15 +02:00
Alex Rønne Petersen
e6a71e9e7a
Sema: Fix some ptr alignment checks to handle a potential ISA tag bit.
Closes #23570.
2025-04-28 00:58:53 +02:00
Shun Sakai
168981c678
docs(std.ascii): Remove redundant three slashes 2025-04-28 00:58:44 +02:00
Kevin Primm
23ab05f1f5
compiler: Fix -m<os>-version-min=... ordering 2025-04-27 14:27:52 +02:00
mlugg
160f2dabed
std.Build.Cache: fix several bugs
Aside from adding comments to document the logic in `Cache.Manifest.hit`
better, this commit fixes two serious bugs.

The first, spotted by Andrew, is that when upgrading from a shared to an
exclusive lock on the manifest file, we do not seek it back to the
start. This is a simple fix.

The second is more subtle, and has to do with the computation of file
digests. Broadly speaking, the goal of the main loop in `hit` is to
iterate the files listed in the manifest file, and check if they've
changed, based on stat and a file hash. While doing this, the
`bin_digest` field of `std.Build.Cache.File`, which is initially
`undefined`, is populated for all files, either straight from the
manifest (if the stat matches) or recomputed from the file on-disk. This
file digest is then used to update `man.hash.hasher`, which is building
the final hash used as, for instance, the output directory name when the
compiler emits into the cache directory. When `hit` returns a cache
miss, it is expected that `man.hash.hasher` includes the digests of all
"initial files"; that is, those which have been already added with e.g.
`addFilePath`, but not those which will later be added with
`addFilePost` (even though the manifest file has told us about some such
files). Previously, `hit` was using the `unhit` function to do this in a
few cases. However, this is incorrect, because `hit` assumes that all
files already have their `bin_digest` field populated; this function is
only valid to call *after* `hit` returns. Instead, we need to actually
compute the hashes which haven't yet been populated. Even if this logic
has been working, there was still a bug here, because we called `unhit`
when upgrading from a shared to an exclusive lock, writing the
(potentially `undefined`) file digests, but the loop itself writes the
file digests *again*! All in all, the hashing logic here was actually
incredibly broken.

I've taken the opportunity to restructure this section of the code into
what I think is a more readable format. A new function,
`hitWithCurrentLock`, uses the open manifest file to try and find a
cache hit. It returns a tagged union which, in the miss case, tells the
caller (`hit`) how many files already have their hash populated. This
avoids redundant work recomputing the same hash multiple times in
situations where the lock needs upgrading. This also eliminates the
outer loop from `hit`, which was a little confusing because it iterated
no more than twice!

The bugs fixed here could manifest in several different ways depending
on how contended file locks were satisfied. Most notably, on a cache
miss, the Zig compiler might have written the compilation output to the
incorrect directory (because it incorrectly constructed a hash using
`undefined` or repeated file digests), resulting in all future hits on
this manifest causing `error.FileNotFound`. This is #23110. I have been
able to reproduce #23110 on `master`, and have not been able to after
this commit, so I am relatively sure this commit resolves that issue.

Resolves: #23110
2025-04-27 14:08:21 +02:00
Michael Pfaff
53f298cffa
Calculate WTF-8 length before converting instead of converting into an intermediate buffer on the stack 2025-04-26 15:07:26 +02:00
tjog
3ca0f18bfe
fuzz: fix expected section start/end symbol name on MacOS when linking libfuzzer
Not only is the section name when adding the sancov variables different.

The linker symbol ending up in the binary is also different.

Reference: 60105ac6ba/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp (L1076-L1104)
2025-04-26 15:07:21 +02:00
Alex Rønne Petersen
a8844ab3bc
std.Target.amdgcn.cpu.gfx1153 doesn't exist in LLVM 19. 2025-04-25 20:14:44 +02:00
Ryan Liptak
aa013b7643
FailingAllocator: remove outdated doc comments, move doc comment example to decltest
Note: The decltests for files-as-a-struct don't show up in autodoc currently
2025-04-25 19:58:11 +02:00
Ali Cheraghi
f38a28a626
revive nvptx linkage 2025-04-25 19:57:45 +02:00
Ali Cheraghi
af6670c403
Module: ignore xnack and sramecc features on some gpu models 2025-04-25 19:57:39 +02:00
Pavel Otchertsov
fd7aafdbd5
cmake: support static linking against libxml2 2025-04-16 23:40:28 +02:00
phatchman
4b47e978e3
Return FileNotFound when CreateProcessW is called with a missing path (#23567) 2025-04-16 04:25:02 +02:00
David Rubin
d80cfa6f41 Compilation: Use trapping UBSan if -fno-ubsan-rt is passed.
This is a mitigation of #23216 meant only for 0.14.x.
2025-04-15 21:29:10 +02:00
Alex Rønne Petersen
379f1c9fa0
std.Build.Step: Don't capture a stack trace if !std.debug.sys_can_stack_trace. 2025-04-15 01:30:52 +02:00
Alex Rønne Petersen
c0378e85b6
link: Improve handling of --build-id when using LLD. 2025-04-15 01:30:34 +02:00
Luis Cáceres
ebb37e719d
src/libunwind.zig: Fix symbol visibility macro define
The define was changed in commit 729899f7b6bf6aff65988d895d7a639391a67608
in upstream llvm.
2025-04-15 01:30:27 +02:00
kcbanner
527df938e1
Value: ensure that extern structs have their layout resolved in ptrField 2025-04-11 21:35:42 +02:00
Jacob Young
1d34616236
x86_64: fix error_set_has_value of inferred error sets 2025-04-11 16:59:55 +02:00
Alex Rønne Petersen
a5f4107d3e
Compilation: Pass -m<os>-version-min=... to Clang for all applicable Darwin targets. 2025-04-11 02:19:22 +02:00
Pat Tullmann
2a7683933a
linux.zig: epoll_wait: pass kernel sigset size
Linux kernel syscalls expect to be given the number of bits of sigset that
they're built for, not the full 1024-bit sigsets that glibc supports.

I audited the other syscalls in here that use `sigset_t` and they're all
using `NSIG / 8`.

Fixes #12715
2025-04-10 10:49:04 +02:00
Techatrix
83e1ce1e00
Compilation: Fix logic in addCCArgs() for various file types and flags.
Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2025-04-09 15:04:24 +02:00
Meghan Denny
9397dc5af6
std: add nvidia as a known arm implementer 2025-04-09 15:03:45 +02:00
SuperAuguste
4ab34b142e
Fix mach-o naming for sancov sections 2025-04-09 15:03:17 +02:00
Matthew Roush
fbb297fd2a
Make translate-c more robust in handling macro functions.
Translate-c didn't properly account for C macro functions having parameter names that are C keywords. So something like `#define FOO(float) ((float) + 10)` would've been interpreted as casting `+10` to a `float` type, instead of adding `10` to the parameter `float`.

An example of a real-world macro function like this is SDL3's `SDL_DEFINE_AUDIO_FORMAT` from `SDL_audio.h`, which uses `signed` as a parameter.
2025-04-08 12:11:30 +02:00
Stefan Weigl-Bosker
8bb7c85bd4
start: fix pc register syntax for m68k 2025-04-08 12:10:22 +02:00
Alex Rønne Petersen
79e3c4a9a8
start: Align the stack on m68k. 2025-04-08 12:10:16 +02:00
SuperAuguste
60922dbf34
Remove overzealous LLVM anti-instrumentation attributes 2025-04-07 12:06:26 +02:00
Alex Rønne Petersen
b2feb0d575
glibc: Add missing stubs-lp64s.h for loongarch64-linux-gnusf.
https://sourceware.org/bugzilla/show_bug.cgi?id=32776
2025-04-06 17:23:19 +02:00
Ziyi Yan
a100419d06
Add lld path of linuxbrew installation (#23466)
Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2025-04-06 09:11:15 +02:00
Jacob Young
cf6c8eacfe Dwarf: handle undefined type values
Closes #23461
2025-04-06 00:56:57 -04:00
Jacob Young
cac0f56c03 x86_64: fix incorrect handling of unreusable operands
Closes #23448
2025-04-06 00:56:44 -04:00
Zenomat
a2ea4b02bc
std.net: Implement if_nametoindex for windows (#22555) 2025-04-05 20:41:50 +02:00
Dimitris Dinodimos
dac350f7c8
Change the lld path on macos homebrew
Homebrew now provides lld in a separate formula; it was part of llvm
formula.
2025-04-04 06:06:28 +02:00
Alex Rønne Petersen
1bada4b275
Merge pull request #23447 from alexrp/cpuid-updates 2025-04-03 19:32:59 +02:00
Alex Rønne Petersen
f5de2770e5
Merge pull request #23445 from alexrp/external-executor-fixes 2025-04-03 19:32:54 +02:00
Misaki Kasumi
d128f5c0bb
std.os.linux: block all signals in raise 2025-04-02 23:57:32 +02:00
Parker Liu
06fc600aec
translate-c: fix function prototype decalared inside a function
* If a function prototype is declarated inside a function, do not
  translate it to a top-level extern function declaration. Similar to
  extern local variable, just wrapped it into a block-local struct.

* Add a new extern_local_fn tag of aro_translate_c node for present
  extern local function declaration.

* When a function body has a C function prototype declaration, it adds
  an extern local function declaration. Subsequent function references
  will look for this function declaration.
2025-04-02 23:56:07 +02:00
Auguste Rame
0b4176891c
DebugAllocator: Fix bucket removal logic causing segfault/leak (#23390)
Make buckets doubly linked
2025-04-02 14:22:15 +02:00
mlugg
ceb84c647b
stage1: fix wasi_snapshot_preview1_fd_seek on cache files
`wasm2c` uses an interesting mechanism to "fake" the existence of cache
directories. However, `wasi_snapshot_preview1_fd_seek` was not correctly
integrated with this system, so previously crashed when run on a file in
a cache directory due to trying to call `fseek` on a `FILE *` which was
`NULL`.
2025-04-02 14:21:56 +02:00
Mason Remaley
4089134892
Zcu: fix ZOIR cache bugs
* When saving bigint limbs, we gave the iovec the wrong length, meaning
  bigint data (and the following string and compile error data) was corrupted.
* When updating a stale ZOIR cache, we failed to truncate the file, so
  just wrote more bytes onto the end of the stale cache.
2025-04-02 14:21:51 +02:00
David Rubin
f2c838d2cf
Sema: increment extra index even if return type is generic 2025-04-02 08:43:28 +02:00
Ali Cheraghi
edaa9584cc
zon: normalize negative zeroes 2025-04-02 08:43:21 +02:00