26557 Commits

Author SHA1 Message Date
Andrew Kelley
5aa82ed477 std.elf: remove some unneeded @as 2023-10-21 21:38:41 -04:00
Andrew Kelley
ecfb18286a migrate make_ptr_const to new anonymous decl mechanism
Instead of creating Module.Decl objects, directly create InternPool
pointer values using the anon_decl Addr encoding.

The LLVM backend needed code to notice the alignment of the pointer and
lower accordingly. The other backends likely need a similar change.
2023-10-21 21:38:41 -04:00
Lee Cannon
3cd3052d4d fix std.Build.addAssembly 2023-10-21 20:46:28 -04:00
JustinWayland
c45af2af61
Fix simple doc mistakes. (#17624)
* Add missing period in Stack's description

This looks fine in the source, but looks bad when seen on the documentation website.

* Correct documentation for attachSegfaultHandler()

The description for attachSegfaultHandler() looks pretty bad without indicating that the stuff at the end is code

* Added missing 'the's in Queue.put's documentation

* Fixed several errors in Stack's documentation

`push()` and `pop()` were not styled as code

There was no period after `pop()`, which looks bad on the documentation.

* Fix multiple problems in base64.zig

Both "invalid"s in Base64.decoder were not capitalized.

Missing period in documentation of Base64DecoderWithIgnore.calcSizeUpperBound.

* Fix capitalization typos in bit_set.zig

In DynamicBitSetUnmanaged.deinit's and DynamicBitSet.deinit's documentation, "deinitializes" was uncapitalized.

* Fix typos in fifo.zig's documentation

Added a previously missing period to the end of the first line of LinearFifo.writableSlice's documentation.
Added missing periods to both lines of LinearFifo.pump's documentation.

* Fix typos in fmt.bufPrint's documentation

The starts of both lines were not capitalized.

* Fix minor documentation problems in fs/file.zig

Missing periods in documentation for Permissions.setReadOnly, PermissionsWindows.setReadOnly, MetadataUnix.created, MetadataLinux.created, and MetadataWindows.created.

* Fix a glaring typo in enums.zig

* Correct errors in fs.zig

* Fixed documentation problems in hash_map.zig

The added empty line in verify_context's documentation is needed, otherwise autodoc for some reason assumes that the list hasn't been terminated and continues reading off the rest of the documentation as if it were part of the second list item.

* Added lines between consecutive URLs in http.zig

Makes the documentation conform closer to what was intended.

* Fix wrongfully ended sentence in Uri.zig

* Handle wrongly entered comma in valgrind.zig.

* Add missing periods in wasm.zig's documentation

* Fix odd spacing in event/loop.zig

* Add missing period in http/Headers.zig

* Added missing period in io/limited_reader.zig

This isn't in the documentation due to what I guess is a limitation of autodoc, but it's clearly supposed to be. If it was, it would look pretty bad.

* Correct documentation in math/big/int.zig

* Correct formatting in math/big/rational.zig

* Create an actual link to ZIGNOR's paper.

* Fixed grammatical issues in sort/block.zig

This will not show up in the documentation currently.

* Fix typo in hash_map.zig
2023-10-21 21:24:55 +00:00
Andrew Kelley
3f4df85299 link.Elf: report file not found error 2023-10-21 22:25:39 +02:00
Michael Bradshaw
cc56577edf Return zero for NaN-to-int lossy casts
Fixes #15038.

The goal here is to guarantee lossyCast() is panic-free and always safe.
2023-10-21 20:51:51 +03:00
snoire
b403ca0aab std.Build: use create() instead of init() for Step.RemoveDir 2023-10-21 17:48:25 +03:00
Jakub Konka
809e7aa4fc
Merge pull request #17638 from ziglang/elf-dwarf-fixes
dwarf: decouple DWARF formats from target pointer size + misc fixes
2023-10-21 16:14:40 +02:00
Andrew Kelley
3d6e633371
Merge pull request #16840 from e4m2/rand-int
std.rand: Support integers with >64 bits in more functions
2023-10-21 05:26:19 -04:00
LordMZTE
b3aaf854cd std.os: do nothing when calling fchdir with AT_FDCWD 2023-10-21 05:13:21 -04:00
matu3ba
f335d92b28
compiler_rt: arm frsub, drsub with tests (#17629)
Tests with +-0, numbers with accuracy 0.001, 0.000001, +-max for inf.
2023-10-21 02:12:02 -07:00
Frank Denis
a5c79c7998
crypto.ff: faster exponentiation with short/public exponents (#17617)
RSA exponents are typically 3 or 65537, and public.

For those, we don't need to use conditional moves on the exponent,
and precomputing a lookup table is not worth it. So, save a few
cpu cycles and some memory for that common case.

For safety, make `powWithEncodedExponent()` constant-time by default,
and introduce a `powWithEncodedPublicExponent()` function for exponents
that are assumed to be public.

With `powWithEncodedPublicExponent()`, short (<= 36 bits) exponents
will take the fast path.
2023-10-21 02:09:43 -07:00
Andrew Kelley
54a4f24ea7 build.zig: bump max_rss again
zig build-exe zig Debug aarch64-macos-none: error: memory usage peaked
at 6607110144 bytes, exceeding the declared upper bound of 6500000000
2023-10-20 23:01:05 -07:00
Andrew Kelley
c55a33e6d9 build.zig: it takes even more ram to build zig apparently
zig build-exe zig Debug aarch64-macos-none: error: memory usage peaked
at 6466420736 bytes, exceeding the declared upper bound of 6350000000
2023-10-20 22:41:20 -07:00
Andrew Kelley
8520aa585f build.zig: adjust max_rss again
Looks like the higher memory requirements come from building with a
clean cache, and affect all operating systems, not just macOS.
2023-10-20 21:56:37 -07:00
Andrew Kelley
5ec59f2a01 build.zig: building on macos takes more memory
Previous commit caused this error to be printed:

zig build-exe zig Debug aarch64-macos-none: error: memory usage peaked
at 6323765248 bytes, exceeding the declared upper bound of 5200000000
2023-10-20 21:54:27 -07:00
Andrew Kelley
1c48588fc8 build.zig: annotate max_rss for building the compiler
I observed some out-of-memory conditions happening on one of the CI
servers. This should make it avoid scheduling compiler builds at the
same time as other memory-intensive operations.
2023-10-20 21:31:49 -07:00
joadnacer
89aad1b89c linux.io_uring: Implement splice functions 2023-10-21 05:02:17 +03:00
Andrew Kelley
0d4d8dfc15 std.Target: update default Linux cross-compiling version
Currently, Zig uses the oldest Debian release that is still under LTS
for the default version minimum. This is now Debian 10 (Buster), with
long-term support until 2024-06-30.

Debian Buster uses Linux 4.19 and glibc 2.28.

For the default version maximum, Zig uses the newest stable Linux
version, which is currently 6.5.7.

Citations:
* https://www.debian.org/News/2019/20190706
* https://packages.debian.org/source/buster/glibc
* https://kernel.org/

Previous update commit: 1530203c804db7e5abd7d6eac05cfbe449d30aea
2023-10-20 20:12:50 -04:00
Andrew Kelley
bd1f96869e InternPool: fix incomplete hash of pointer values
There is this `common` prefix which was not getting passed in all union
tags of pointer vals, resumably making InternPool slower for pointer
values.
2023-10-20 20:02:35 -04:00
Andrew Kelley
328ec15d9c Revert "make distinct error limit configurable"
This reverts commit 78855bd21866b515018259a2194e036e4b3120df.

This commit did not replace uses of `Type.err_int` of which there are
currently 60 uses.

Re-opens #786
2023-10-20 14:03:55 -07:00
Jakub Konka
6dc45e7d31
Merge pull request #17621 from ziglang/elf-pic-pie
elf: actually check for dynamic executables
2023-10-20 22:33:44 +02:00
Andrew Kelley
7de893c085
Merge pull request #16817 from Sahnvour/shuffle-deps
std.Build: add --seed argument to randomize step dependencies spawning
2023-10-20 15:30:48 -04:00
Constantin Bilz
45d7dfa833 std.hash_map: add const attribute to StringIndexContext.bytes and ...
StringIndexAdapter.bytes

Without this change, constructing a Context/Adapter for a `const` string
table requires a `@constCast`.
2023-10-20 19:06:32 +03:00
Pat Tullmann
1631dc923d glibc headers: reallocarray added to glibc in v2.26
Here's the glibc commit that adds reallocarray to glibc:
https://sourceware.org/git/?p=glibc.git;a=commit;h=2e0bbbfbf95fc9e22692e93658a6fbdd2d4554da

The reallocarray symbol is declared in both stdlib.h and malloc.h.

Fix #17607
2023-10-20 06:45:24 -04:00
dbandstra
6822a7a123 langref: bring build.zig examples up to date
Update to match current outputs of init-exe and init-lib.
2023-10-20 04:50:29 -04:00
matu3ba
3c22cecee2
compiler_rt: add tests for arm routines (#17573)
* __aeabi_ldivmod
* __aeabi_uldivmod
* __aeabi_idivmod
* __aeabi_uidivmod
2023-10-20 00:57:11 -07:00
Andrew Kelley
a361f37b1c
Merge pull request #17608 from squeek502/resinator-fixes
resinator: Fix `INCLUDE` var handling and sync with upstream
2023-10-20 03:49:14 -04:00
dweiller
db18b562ac std.Build: do not assume custom test runners support client-server mode 2023-10-20 02:39:17 -04:00
Michael Dusan
aa76ca2931 llvm: set PIE only for executables
closes #17575
2023-10-20 01:59:55 -04:00
Andrew Kelley
5d8bc56ab6
Merge pull request #15268 from DraagrenKirneh/feature/14475-minimum-zig-version
#14475 minimal_zig_version in build.zig.zon
2023-10-20 00:51:44 -04:00
Prokop Randacek
fee09009a8 gettimeofday takes nullable pointers 2023-10-20 00:15:34 -04:00
Jacob Young
4d106076c3 link: initialize llvm before calling the llvm API 2023-10-19 16:51:11 -04:00
Jakub Konka
f4f5e9edd6 dwarf: bring back realpath resolution of include dirs 2023-10-19 22:41:59 +02:00
Jakub Konka
eb76ef58f8 dwarf: revert adding spurious and incorrect +1 to getDebugInfoEnd() 2023-10-19 21:56:47 +02:00
Jakub Konka
400faec10b dwarf: introduce Dwarf.Format to be able to select 32/64bit format at whim 2023-10-19 21:56:47 +02:00
Jakub Konka
4f66efdc7f dwarf: clean up and fix writing include dirs and files to debug line header 2023-10-19 21:56:47 +02:00
Jakub Konka
349dc05452 dwarf: remove obsolete sentinels from abbrev table 2023-10-19 21:56:47 +02:00
Andrew Kelley
10200970bb build system: fixups to --seed mechanism
* support 0x prefixed hex code for CLI seed arguments
* don't change the build summary; the printed CLI on build runner
  failure is sufficient
* use `std.crypto.random` instead of system time for entropy
2023-10-19 14:24:35 -04:00
Sahnvour
b87353a17f std.Build: add --seed argument to randomize step dependencies spawning
help detect possibly hidden dependencies on the running order of steps,
especially in -j1 mode
2023-10-19 14:24:35 -04:00
Jakub Konka
b8ff989fa0 elf: force pie in tests affected by QEMU bug 2023-10-19 19:46:23 +02:00
Jakub Konka
3768c95371 elf: actually check for dynamic executables 2023-10-19 15:57:58 +02:00
Krzysztof Wolicki
530dc0405c
std.os: unlinkW shouldn't return error.DirNotEmpty 2023-10-19 12:59:52 +00:00
Jacob Young
fbbccc9d5f Builder: fix incorrect type for 32-bit systems 2023-10-19 08:06:44 -04:00
Jakub Konka
f3d23d9232
Merge pull request #17594 from ziglang/elf-atom-limit
elf: increase permissible Atom <-> input section resolution to u32 for Zig's module
2023-10-19 12:30:56 +02:00
Andrew Kelley
ae2cd5fe26 Revert "Never implicitly add rpaths for each lib dir, add NixOS libdir to rpath"
This reverts commit d7b73af8f65bb891c8700ed47777144bb6f35fe1.

I did not look at this closely enough. This is incorrect; it should not
implicitly add rpaths for every library, and it should not disable the
nice default of each_lib_path when compiling for the native OS.

See #16062 where we are working on a follow-up improvement to this.
2023-10-18 23:37:47 -07:00
Jakub Konka
470d887d80
Merge pull request #17593 from ziglang/elf-native-libc
elf: link against libc installation
2023-10-19 07:39:03 +02:00
Andrew Kelley
b795925ee4 doc: add minimum_zig_version field reference 2023-10-18 18:59:13 -07:00
Andrew Kelley
777af14b57 Package.Manifest: fix bitrotted unit tests 2023-10-18 18:59:13 -07:00
DraagrenKirneh
1882ff95e7 Package.Manifest: add minimum_zig_version field 2023-10-18 18:58:58 -07:00