10528 Commits

Author SHA1 Message Date
Alex Rønne Petersen 3c924abb69 std.zig.llvm.bitcode_writer: Fix word byte order on big endian systems.
The bitcode format always uses little endian words. Prior to this commit, a
bitcode file produced on e.g. aarch64_be or s390x would fail to be loaded by
LLVM.
2025-03-04 17:28:03 -05:00
Andrew Kelley 1e2b3b1df9 std.Build.Step: fix missing path sep in error message
I have a more robust solution to this coming up in the writer interface
branch.
2025-03-03 17:18:18 -08:00
Matthew Lugg c76f451abc Merge pull request #22979 from mlugg/remove-legacy-coercions
Sema: remove legacy coercion
2025-03-03 22:18:28 +00:00
Fausto Ribeiro edabcf6192 std.DynLib: fix proper type of chain_ptr on GnuHashSection32
Type is correct on GnuHashSection64 but not on 32 bit version. Change it so
use of DynLib on 32-bit archs compiles.
2025-03-03 20:01:05 +01:00
Linus Groh 3bea47883a std.time: Make Instant.since() work on UEFI 2025-03-02 23:16:34 +00:00
Linus Groh 1a03b8c899 std.os.uefi: Fix two padding mistakes in the Time struct
```c
//************************************************
//EFI_TIME
//************************************************
// This represents the current time information
typedef struct {
   UINT16    Year;              // 1900 - 9999
   UINT8     Month;             // 1 - 12
   UINT8     Day;               // 1 - 31
   UINT8     Hour;              // 0 - 23
   UINT8     Minute;            // 0 - 59
   UINT8     Second;            // 0 - 59
   UINT8     Pad1;
   UINT32    Nanosecond;        // 0 - 999,999,999
   INT16     TimeZone;          // —1440 to 1440 or 2047
   UINT8     Daylight;
   UINT8     Pad2;
 }   EFI_TIME;
```
2025-03-02 23:16:34 +00:00
Linus Groh 6378295b77 std.os.uefi: Fix integer overflow in Time.toEpoch()
Instead of thinking hard about what the actual supported maximum value
for each sub-calculation is we can simply use an u64 from hours onwards.
2025-03-02 22:58:45 +00:00
rpkak 0367d684fc add parentheses in std.heap.page_size_min 2025-03-02 22:27:57 +01:00
Frank Denis d8d2aa9af4 crypto.pcurves.common: generalize invert() (#23039)
The Bernstein-Yang inversion code was meant to be used only with the
fields we currently use for the NIST curves.

But people copied that code and were confused that it didn't work as
expected with other field sizes.

It doesn't cost anything to make it work with other field sizes,
that may support in the future. So let's do it.
This also reduces the diff with the example zig code in fiat crypto.

Suggested by @Rexicon226 -- Thank you!
2025-03-02 11:27:04 +01:00
Andrew Kelley 6c3cbb0c87 Merge pull request #22994 from ziglang/newhash
implement new package hash format: `$name-$semver-$hash`
2025-02-28 04:40:05 -05:00
Andrew Kelley 6b6c1b1b0e Revert "Merge pull request #22898 from kristoff-it/deprecated-proposal"
This reverts commit dea72d15da, reversing
changes made to ab381933c8.

The changeset does not work as advertised and does not have sufficient
test coverage.

Reopens #22822
2025-02-28 01:37:10 -08:00
Alex Rønne Petersen 5c44934e20 Move the compiler's LLVM bitcode builder to std.zig.llvm. 2025-02-27 01:32:49 -05:00
Andrew Kelley e0129b387f std.ArrayList: delete unit test
tests should use the API, not only verify compilation succeeds.
2025-02-26 11:42:03 -08:00
Loris Cro 43a949ee95 fix regressed build system unit test 2025-02-26 14:41:33 -05:00
Andrew Kelley c5aa680c88 don't inherit allowed deprecation from parent modules
Inheriting allow-deprecation from parent modules doesn't make too much
sense, so instead make them default to disallow unless otherwise
specified. This allows build system to avoid redundant
`-fno-allow-deprecated` args.

This makes the generated CLIs smaller, and makes zig1.wasm update not
needed.

Also represented `is_root` differently (moved to field of graph).
2025-02-26 14:41:33 -05:00
Loris Cro 25790e95f1 @deprecated: remove per-module flag in Build
This implementation looks at the builder of each
module in the build graph instead of storing a
boolean for each module.
2025-02-26 14:41:33 -05:00
Loris Cro ba7cd8121d @deprecated: add build system support 2025-02-26 14:41:33 -05:00
Loris Cro fff8eff2bd initial implementation of @deprecated 2025-02-26 14:41:33 -05:00
Andrew Kelley c45dcd013b Merge pull request #22488 from Rexicon226/ubsan-rt
implement a ubsan runtime for better error messages
2025-02-26 03:08:36 -05:00
mlugg 8e074f1549 std: remove dependencies on legacy coercion 2025-02-26 00:17:09 +00:00
mlugg 3fcb4408a5 AstGen: improve 'file cannot be a tuple' source location
Instead of just reporting this on token 0, report it on the first
tuple-like field.
2025-02-25 22:28:47 +00:00
Alex Rønne Petersen 055969b101 std.Target: Update known max OS versions. 2025-02-25 20:30:43 +01:00
Robin Voetter d856763aca Merge pull request #22937 from alichraghi/ali_spv
spirv: make test suite working again
2025-02-25 20:27:37 +01:00
Andrew Kelley 2447b87d98 std.heap.page_size_min: relax freestanding restriction
x86_64 and aarch64 have safe values for page_size_min
2025-02-25 11:22:33 -08:00
Andrew Kelley faf256e429 std.mem.indexOfSentinel: don't ask the OS the page size
simply use page_size_min instead.

better yet, this logic would avoid depending on page size entirely...
2025-02-25 11:22:33 -08:00
David Rubin 9432a9b6e1 build: add bundle_ubsan_rt 2025-02-25 11:22:33 -08:00
David Rubin fc77678339 mem: add @branchHint to indexOfSentinel
also seems to work around aarch64 LLVM miscompilation 🤔
2025-02-25 11:22:33 -08:00
David Rubin 95720f007b move libubsan to lib/ and integrate it into -fubsan-rt 2025-02-25 11:22:33 -08:00
David Rubin babee5f73c ubsan: implement some more checks 2025-02-25 11:22:33 -08:00
David Rubin c27b7973c9 Compilation: use the minimal runtime in ReleaseSafe 2025-02-25 11:22:33 -08:00
David Rubin eef8d4ff4f ubsan: switch to using std.builtin.panicExtra to log errors 2025-02-25 11:22:33 -08:00
David Rubin 5e0073c898 ubsan: add a basic runtime 2025-02-25 11:22:33 -08:00
Alex Rønne Petersen c7e99b93a4 Revert "skip regressed LLVM 17 std lib test on powerpc"
This reverts commit 5b8af7a2a9.

Closes #16951.
2025-02-25 18:28:34 +01:00
Alex Rønne Petersen bedf806672 Merge pull request #22999 from alexrp/mingw-update 2025-02-25 12:54:55 +01:00
Ali Cheraghi a0eec9ce9e spirv: replace some unreachables with compile errors 2025-02-24 19:12:33 +01:00
Alex Rønne Petersen 51b44be9cc std.zig.target: Support new wiaguid library name for MinGW-w64. 2025-02-24 12:01:12 +01:00
Alec Fessler 1cc388d526 stdlib: handle EEXIST in mmap with FIXED_NOREPLACE. Fixes #21475 2025-02-24 04:36:14 -05:00
Alex Rønne Petersen ecc76348e6 Merge pull request #22154 from alexrp/disable-intrinsics
compiler: Implement `@disableIntrinsics()` builtin function.
2025-02-24 08:25:23 +01:00
Linus Groh 68bd82d0cc std.posix: Handle USER_MAPPED_FILE in windows ftruncate() impl 2025-02-23 16:58:26 -05:00
Andrew Kelley e47f340e23 std.Build.Step.ConfigHeader: follow deprecation policy 2025-02-23 12:45:35 -08:00
Andrew Kelley 86f35479d9 Merge pull request #22794 from cbilz/autoconf_at
std.Build.Step.ConfigHeader: Add support for Autoconf-style `@FOO@` variables
2025-02-23 15:36:49 -05:00
Linus Groh c44f4501e7 std.math.big.int: Support strings up to base 36
Co-Authored-By: samy007 <samy2014@free.fr>
2025-02-23 11:25:35 +00:00
mlugg 5e20e9b449 Sema: allow @ptrCast of slices changing the length
Also, refactor `Sema.ptrCastFull` to not be a horrifying hellscape.
2025-02-23 08:28:58 +00:00
Andrew Kelley d6f8200294 zig fmt 2025-02-22 22:21:24 -08:00
Constantin Bilz 75b0538688 std.Build: Allow ConfigHeader values to be added at build.zig runtime 2025-02-22 23:31:17 -05:00
Anders Bondehagen 77007445bf std.net: Fix IPv6 address format compression for long zero runs (#22441) 2025-02-22 19:52:47 -08:00
Linus Groh 4b0f77cc1f std.crypto.tlcsprng: Fix hardcoded use of defaultRandomSeed()
Instead of hardcoding a call to defaultRandomSeed() use the customizable
std.options.cryptoRandomSeed() like in the rest of the function.

Closes #19943.
2025-02-22 22:39:40 -05:00
Alex Rønne Petersen 6ba785584a compiler: Implement @disableIntrinsics() builtin function.
Closes #21833.
Closes #22110.
2025-02-23 04:08:56 +01:00
Andrew Kelley 8683f25d24 std.heap.DebugAllocator: default wasm to 64K page size
including on freestanding
2025-02-22 21:06:00 -05:00
Andrew Kelley dd54c48aa2 std.crypto.asn1: fix merge conflicts 2025-02-22 17:44:11 -08:00