Commit Graph

9918 Commits

Author SHA1 Message Date
Andrew Kelley
1340565e22
Merge pull request #21654 from ziglang/embrace-path-abstraction
link: fix false positive crtbegin/crtend detection
2024-10-10 22:30:04 -07:00
Alex Rønne Petersen
2309d07e20 std.os.linux: Use the Thumb-specific syscall helpers for thumbeb too.
Fixes a "write to reserved register r7" compile error for thumbeb-linux-*.
2024-10-11 02:38:30 +02:00
Andrew Kelley
01aab9f6b3 std.Build.Step.CheckObject: display source file path
and upgrade to getPath3
2024-10-10 14:21:52 -07:00
Andrew Kelley
101d21a6dc std.Build.Cache.Path: fix single-quote escaping format 2024-10-10 14:21:52 -07:00
Andrew Kelley
14c8e270bb link: fix false positive crtbegin/crtend detection
Embrace the Path abstraction, doing more operations based on directory
handles rather than absolute file paths. Most of the diff noise here
comes from this one.

Fix sorting of crtbegin/crtend atoms. Previously it would look at all
path components for those strings.

Make the C runtime path detection partially a pure function, and move
some logic to glibc.zig where it belongs.
2024-10-10 14:21:52 -07:00
mlugg
c96f9a017a Sema: implement @splat for arrays
Resolves: #20433
2024-10-10 11:22:49 +01:00
Andrew Kelley
22661f3d67 link tests: add a way to check prefix and use it 2024-10-08 21:57:08 -07:00
Michael Dusan
e535e65eb3
freebsd posix: add SystemOutdated to MemFdCreateError 2024-10-07 13:19:33 -04:00
Michael Dusan
be91b68e66
dragonfly std: more std.c support 2024-10-07 13:19:33 -04:00
Alex Rønne Petersen
20e03beaef
Merge pull request #21611 from alexrp/target-abi-default
`std.Target`: Rewrite `Abi.default()` to have better defaults across the board.
2024-10-07 06:14:10 +02:00
Alex Rønne Petersen
cc79cc9f55
Merge pull request #21615 from linusg/panic-uefi
std.debug: Fix defaultPanic() uefi build
2024-10-07 03:38:41 +02:00
Alex Rønne Petersen
aa8f39e271
Merge pull request #21614 from alexrp/target-avr-align
`std.Target`: Fix `cTypePreferredAlignment()` to always return 1 for avr.
2024-10-07 01:56:42 +02:00
Alex Rønne Petersen
790fc8cd98
Merge pull request #21499 from alexrp/loongarch-gnusf
Add `loongarch64-linux-gnusf` target support
2024-10-07 01:24:00 +02:00
Alex Rønne Petersen
221bd829bc
std.Target: Rewrite Abi.default() to have better defaults across the board. 2024-10-06 23:28:21 +02:00
Andrew Kelley
d5c9d85295
Merge pull request #21597 from achan1989/issue_14324
Create/open file on WASI targets should have POLL_FD_READWRITE rights
2024-10-06 13:02:51 -07:00
InKryption
3284d1ffb1 Build: Add option(LazyPath, ...) support
Also adds support for `[]const LazyPath` in a similar vein, and
refactors a few other bits of code.
2024-10-06 12:39:35 -07:00
Linus Groh
f18c71ba73 std.debug: Fix defaultPanic() uefi build
lib/std/debug.zig:491:38: error: slice of non-array type 'u16'
            utf16_buffer[len_minus_3][0..3].* = .{ '\r', '\n', 0 };
            ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~

lib/std/debug.zig:510:70: error: expected type '?*const anyopaque', found '[]u16'
                _ = bs.exit(uefi.handle, .Aborted, exit_msg.len + 1, exit_data);
                                                                     ^~~~~~~~~

Regressed in #21520.
2024-10-07 02:40:01 +09:00
Alex Rønne Petersen
148b5b4c78
Merge pull request #21608 from mikdusan/ppc64
ppc64: get further along into system bootstrap
2024-10-06 17:26:40 +02:00
Alex Rønne Petersen
770aa54579
std.Target: Fix cTypePreferredAlignment() to always return 1 for avr.
This matches avr-gcc's ABI.
2024-10-06 17:19:07 +02:00
Alex Rønne Petersen
ece265b1c2
Merge pull request #21605 from alexrp/ohos-stuff
`std.Target`: Introduce `Abi.ohoseabi` to distinguish the soft float case.
2024-10-06 16:26:24 +02:00
Alex Rønne Petersen
be5378b038
Merge pull request #21587 from alexrp/hexagon-porting
Some initial `hexagon-linux` port work
2024-10-06 13:35:56 +02:00
Matthew Lugg
008bb1f120
Merge pull request #21518 from mlugg/incremental-ci
incr-check enhancements, and CI for incremental test cases
2024-10-06 11:16:27 +01:00
achan1989
b01a5c6bb7 Explain why POLL_FD_READWRITE is not dangerous at sites of use 2024-10-06 09:47:12 +01:00
achan1989
1d8844dd56 Copy in WASI rights_t documentation 2024-10-06 09:44:52 +01:00
Alex Rønne Petersen
516cb5a5e8
Merge pull request #21037 from alexrp/target-dyld
`std.Target`: Rewrite DynamicLinker.standard() and fill in some missing details.
2024-10-06 09:17:57 +02:00
mlugg
90db767721
std: async read into small temporary buffer between poll calls on Windows
This commit changes how `std.io.poll` is implemented on Windows. The new
implementation unfortunately incurs a little extra system call overhead,
but fixes several bugs in the old implementation:

* The `lpNumberOfBytesRead` parameter of `ReadFile` was used with
  overlapped I/O. This is explicitly disallowed by the documentation, as
  the value written to this pointer is "potentially erroneous"; instead,
  `GetOverlappedResult` must always be used, even if the operation
  immediately returns. Documentation states that `lpNumberOfBytesRead`
  cannot be passed as null on Windows 7, so for compatibility, the
  parameter is passed as a pointer to a dummy global.
* If the initial `ReadFile` returned data, and the next read returned
  `BROKEN_PIPE`, the received data was silently ignored in the sense
  that `pollWindows` did not `return`, instead waiting for data to come
  in on another file (or for all files to close).
* The asynchronous `ReadFile` calls which were left pending between
  calls to `pollWindows` pointed to a potentially unstable buffer, since
  the user of `poll` may use part of the `LinearFifo` API which rotate
  its ring buffer. This race condition was causing CI failures in some
  uses of the compiler server protocol.

These issues are all resolved. Now, `pollWindows` will queue an initial
read to a small (128-byte) stable buffer per file. When this read is
completed, reads directly into the FIFO's writable slice are performed
until one is left pending, at which point that read is cancelled (with a
check to see if it was completed between the `ReadFile` and `CancelIo`
calls) and the next read into the small stable buffer is queued. These
small buffer reads are the ones left pending between `pollWindows`
calls, avoiding the race condition described above.

Related: #21565
2024-10-06 07:01:12 +01:00
Alex Rønne Petersen
ac247c9943
Merge pull request #21331 from bobf/std-meta-DeclEnum-empty-struct
Prevent failure with empty struct in `std.meta.DeclEnum`
2024-10-06 02:52:20 +02:00
Alex Rønne Petersen
406e56ab69
Merge pull request #21581 from zigmd/fix-typo-in-segset_t
std: fix typo in darwin segset_t
2024-10-06 00:32:54 +02:00
Michael Dusan
665d0157d5
std ppc64: add nop to start inline-asm
fixes ld.lld error: call to save_start.posixCallMainAndExit lacks nop, can't restore toc
2024-10-05 10:27:13 -04:00
Michael Dusan
f7da960a33
stage1 ppc64: remove inline-asm overlapping clobbers
Required when bootstrapping with GCC.
2024-10-05 10:26:47 -04:00
achan1989
0d85284e4d Create/open file on WASI targets should have POLL_FD_READWRITE rights 2024-10-05 15:23:00 +02:00
Alex Rønne Petersen
84e192c88b
std.Target: Introduce Abi.ohoseabi to distinguish the soft float case.
For the same reason as #21504.
2024-10-05 15:13:37 +02:00
Alex Rønne Petersen
9a5b0a6762
std.Target: Rewrite DynamicLinker.standard() and fill in some missing details. 2024-10-05 13:53:24 +02:00
Jonathan Marler
73de620ad5 std.os.windows.ReadFile: handle ERROR_LOCK_VIOLATION
fixes #21500
2024-10-05 00:36:49 -07:00
Andrew Kelley
cfd3bcffec
Merge pull request #21591 from patrickwick/issue-19009
zig objcopy: support --add-section
2024-10-04 19:45:39 -07:00
Alex Rønne Petersen
98b85f72a6
Merge pull request #21593 from alexrp/dlopen-null
`std.c`: Make `dlopen()` accept null for the `path` parameter.
2024-10-05 04:05:24 +02:00
David Rubin
043b1adb8d
remove @fence (#21585)
closes #11650
2024-10-04 22:21:27 +00:00
Andrew Kelley
163d505e27 std.Target: add missing propeller switch prongs
Seems to have been an invisible merge conflict.
2024-10-04 15:03:46 -07:00
Andrew Kelley
9fca80941c
Merge pull request #21532 from marler8997/putDependencyCacheInGraph
Put dependency cache in graph
2024-10-04 14:00:15 -07:00
Felix Queißner
7c74edec8d
Adds new cpu architectures propeller1 and propeller2. (#21563)
* Adds new cpu architectures propeller1 and propeller2.

These cpu architectures allow targeting the Parallax Propeller 1 and Propeller 2, which are both very special microcontrollers with 512 registers and 8 cpu cores.

Resolves #21559

* Adds std.elf.EM.PROPELLER and std.elf.EM.PROPELLER2
* Fixes missing switch prongs in src/codegen/llvm.zig
* Fixes order in std.Target.Arch

---------

Co-authored-by: Felix "xq" Queißner <git@random-projects.net>
2024-10-04 13:53:28 -07:00
PauloCampana
3e62cb5c90
Remove old deprecated symbols in std (#21584)
Also, actually run tests inside std/tar/writer.zig
2024-10-04 13:50:25 -07:00
Alex Rønne Petersen
31d685f86f
std.c: Make dlopen() accept null for the path parameter.
Closes #21592.
2024-10-04 20:10:07 +02:00
Alex Rønne Petersen
eb363bf845
Merge pull request #21572 from alexrp/tests-llvm-targets
`test`: Rewrite the target triple list for `llvm_targets`.
2024-10-04 19:37:12 +02:00
Patrick Wickenhaeuser
e1d54b6d1a 19009: zig objcopy: integrate --add-section, --set-section-alignment and --set-section-flags into std.Build.Step.ObjCopy 2024-10-04 15:49:50 +02:00
Alex Rønne Petersen
b23a5b56c2
Merge pull request #21578 from alexrp/s390x-porting
Get module tests passing for `s390x-linux` and add it to CI
2024-10-04 14:40:32 +02:00
Alex Rønne Petersen
0345775559
Merge pull request #21577 from alexrp/mips32-stat
`std.c`: Fix `Stat` struct layout for mips/mipsel with glibc.
2024-10-04 01:30:13 +02:00
Alex Rønne Petersen
6b231b9e3f
Merge pull request #21571 from alexrp/14366-progress
Re-enable some tests that were disabled due to #14366
2024-10-04 00:31:26 +02:00
Alex Rønne Petersen
7f55fa12f4
std.posix: Skip Stat struct comparison in fstatat test for s390x-linux.
On s390x-linux, fstat() does not have nanosecond precision, but fstatat() does.
As a result, comparing Stat structs returned from these syscalls is doomed to
fail.
2024-10-04 00:26:55 +02:00
Alex Rønne Petersen
f4c23726a3
std.c: Fix Sigaction struct for s390x-linux-gnu. 2024-10-04 00:26:55 +02:00
Alex Rønne Petersen
cd6795fc06
std.os.linux: Fix mmap() syscall invocation for s390x.
The s390x mmap() syscall existed before Linux supported syscalls with 5+
parameters, so it takes a single pointer to an array of arguments instead.
2024-10-04 00:26:53 +02:00
Alex Rønne Petersen
9b273f6b9a
Merge pull request #21570 from alexrp/windows-itanium
Initial port work for `*-windows-itanium` support.
2024-10-03 21:53:22 +02:00
Saurabh Mishra
267523e136 fix typo in segset_t 2024-10-03 09:37:57 -07:00
Jakub Konka
69ce7f0e08
Merge pull request #21573 from alexrp/elf-header
Some additions to `std.elf` addressing #19830, plus some zld improvements
2024-10-03 15:19:58 +02:00
WillLillis
3bcdca07a3 fix: print correct number of provided arguments in min/max error message 2024-10-03 12:28:44 +03:00
Alex Rønne Petersen
56b0c7bd2f
std.zig.system: Force disable the small_data feature for hexagon.
This works around the fact that LLVM and LLD both have broken support for the
small data area, yet the feature is on by default for all Hexagon CPUs.

I want to eventually replace this hack with a flag in update_cpu_features.zig
for marking features that should always be off by default and not be accessible
to users. That way, the compiler will have full control over them.
2024-10-03 09:44:58 +02:00
Alex Rønne Petersen
8060fad425
generate_linux_syscalls: Rename mmap_pgoff to mmap2. 2024-10-03 09:12:35 +02:00
Alex Rønne Petersen
fe30df6b8c
std.os.linux: Add hexagon arch bits. 2024-10-03 09:12:35 +02:00
Alex Rønne Petersen
6dd19961b3
std.atomic: Provide a more accurate cache_line value for hexagon v73+. 2024-10-03 09:12:35 +02:00
Alex Rønne Petersen
c560e26fb7
std.os.linux: Rename some arch bits files to match std.Target.Cpu.Arch tags. 2024-10-03 09:12:35 +02:00
Alex Rønne Petersen
07c943598d
std.debug: Disable stack traces on s390x. 2024-10-03 06:19:23 +02:00
Alex Rønne Petersen
60f55b2bd2
std.c: Fix Stat struct layout for mips/mipsel with glibc.
std.os.linux.dev_t for mips32 is u64, but glibc uses u32.

Closes #21276.
2024-10-03 05:51:16 +02:00
Alex Rønne Petersen
3f322c49bc
std.Target: Remove Os.Tag.shadermodel.
This was a leftover from the Cpu.Arch.dxil removal.
2024-10-03 05:01:24 +02:00
Alex Rønne Petersen
c2ba6127c0
std.Target: Fix getVersionRangeTag() for bridgeos.
Until we actually figure out a version range for this, we shouldn't classify
this as using semver. Doing so results in a panic when trying to access the
version range since it's not in fact a semver value.
2024-10-03 05:01:24 +02:00
Alex Rønne Petersen
7d71e794dd
std.Target: Fix Cpu.Model.generic() for arc, csky, and xtensa.
Only targets for which we don't source CPU models/features from LLVM should use
the fallback prong in this switch. Also make it exhaustive to catch similar
mistakes in the future.
2024-10-03 05:01:24 +02:00
Alex Rønne Petersen
cb1ac0bb2f
update_cpu_features: Don't delete the output file if there are no CPU features.
At bare minimum, the compiler expects std.Target.<arch>.cpu.generic to work for
any given architecture when generating the builtin module. So rather than try to
hack that into working when the affected modules are omitted, just actually keep
them.

This affected lanai and xcore.
2024-10-03 05:01:14 +02:00
Alex Rønne Petersen
c38dd72ca7
std.zig.target: Add loongarch64-linux-gnusf. 2024-10-03 04:39:39 +02:00
Alex Rønne Petersen
1e838eba75
std.math: Re-enable isSignalNan test on most targets.
This remains disabled on arm, aarch64, and powerpc, as well as for the C
backend, as it still fails for these targets.

See: https://github.com/ziglang/zig/issues/14366
2024-10-03 04:38:53 +02:00
Chris Boesch
e22d79dacb
std.posix: Added error message 'ProcessNotFound' for reading and writing in a Linux process (#21430)
* Added error message 'ProcessNotFound' for reading and writing in a Linux
process.
This error occurs if the process to be read from or written to no longer exists.
Fixes #19875

* Added error message "ProcessNotFound" for error forwarding.

* Add error messgae for forwarding.

* Added message for forwarding.

* Error set completed.

* Fixed format error.

* Changed comments to doc comments.
2024-10-03 01:54:30 +00:00
Alex Rønne Petersen
8ee52f99ce
Merge pull request #21505 from alexrp/cpu-features-exts
`update_cpu_features`: Add support for parsing `DefaultExts` as used for aarch64.
2024-10-03 00:41:48 +02:00
Alex Rønne Petersen
e0ac776749
Merge pull request #21504 from alexrp/android-softfp
`std.Target`: Introduce `Abi.androideabi` to distinguish the soft float case.
2024-10-03 00:15:35 +02:00
Alex Rønne Petersen
26d35cc112
Merge pull request #21524 from alexrp/fix-reader-test
`std.io.Reader`: Fix test erroneously using `undefined`.
2024-10-02 23:54:23 +02:00
Alex Rønne Petersen
038e002b1c
Merge pull request #21527 from alexrp/elf-emulations
`link.Elf`: Make `getLDMOption()` exhaustive with regards to LLD's `parseEmulation()`.
2024-10-02 23:22:44 +02:00
Alex Rønne Petersen
e652318c13
Merge pull request #21513 from pseudocc/rtattr
std.os.linux: extend rtattr.type to support IFA_*
2024-10-02 22:59:57 +02:00
Alex Rønne Petersen
c13713dd02
std.math: Re-enable snan() test.
This now passes on all targets that we test in CI.

See: https://github.com/ziglang/zig/issues/14366
2024-10-02 04:08:24 +02:00
Alex Rønne Petersen
b569ead29e
std.elf: Make int() and int32() functions private.
These have no callers outside std.elf. Even if the standard library should
provide functions like these, std.elf is probably not the place, given how
general they are.
2024-10-01 04:35:14 +02:00
Alex Rønne Petersen
9bbfc864af
std.elf: Parse and make available some extra fields on Header.
Closes #19830.
2024-10-01 03:54:42 +02:00
Alex Rønne Petersen
604ff131dd
std.elf: Add OSABI enum sourced from binutils. 2024-10-01 03:54:22 +02:00
Alex Rønne Petersen
5db04e0595
std.elf: Define EI_(OSABI,ABIVERSION,PAD) constants. 2024-10-01 03:53:58 +02:00
Alex Rønne Petersen
496a067d3f
std.elf: Define ET.(LOOS,HIOS) constants. 2024-10-01 03:53:27 +02:00
Michael Ortmann
3b465ebec5
std.start: dont query stack limit for wanted stack size 0 (#21533) 2024-09-28 23:06:28 -07:00
Alex Rønne Petersen
537a873b17
Initial port work for *-windows-itanium support.
https://llvm.org/docs/HowToBuildWindowsItaniumPrograms.html

This is a weird middle ground between `*-windows-gnu` and `*-windows-msvc`. It
uses the C++ ABI of the former while using the system libraries of the latter.
2024-09-28 21:43:52 +02:00
Jonathan Marler
e0fdbfb705 build: make dependency cache hash map unmanaged
Allows Build.Graph to initialize dependency_cache with a default value.
2024-09-27 09:44:44 -06:00
Jonathan Marler
28189b0fa5 build: move dependency cache into Graph
The dependency cache is shared amongst all Build objects. This is currently
done by allocating a single instance and storing a reference to it in each
Build object.  However, the Graph object already exists to host shared
state so by moving it there we reuse the same pattern for shared state
and avoid an extra object on the heap.
2024-09-27 09:38:59 -06:00
Andrew Kelley
7f4c0e010d update safety test cases to new panic API
although they would also pass simply reverted to master branch because
I made the deprecated API still work for now (to be removed after 0.14.0
is tagged)
2024-09-26 17:14:17 -07:00
Andrew Kelley
db8c074476 fix still calling std.builtin.panic sometimes 2024-09-26 16:46:02 -07:00
Andrew Kelley
1b491e640d fixes and make sema report errors when std.builtin wrong
instead of panicking
2024-09-26 16:06:05 -07:00
Andrew Kelley
c9c080a187 embrace panic helpers
Introduces `std.builtin.Panic` which is a complete interface for
panicking. Provide `std.debug.FormattedPanic` and
`std.debug.SimplePanic` and let the user choose, or make their own.
2024-09-26 16:06:05 -07:00
Andrew Kelley
fcfbedc2f0 work around riscv64 backend deficiencies 2024-09-26 16:06:05 -07:00
Alex Rønne Petersen
59ae51199e
std.Target: Return EM_ARC_COMPACT instead of EM_ARC_COMPACT2 for arc.
Also fix an incorrect related comment in start.zig.
2024-09-26 21:45:49 +02:00
Alex Rønne Petersen
2e3599c7d0
std.Target: Handle ve in toElfMachine(). 2024-09-26 21:44:27 +02:00
Andrew Kelley
f2c8940aa6 reintroduce the std.builtin safety panic helpers
motivated by performance
2024-09-26 12:35:14 -07:00
Andrew Kelley
76f0b6e7d8 delete the old panic stuff again
now that we have a zig1.wasm update it's not needed
2024-09-26 12:35:14 -07:00
Andrew Kelley
9ccf8d3332 fixes for this branch
I had to bring back some of the old API so that I could compile the new
compiler with an old compiler.
2024-09-26 12:35:14 -07:00
Andrew Kelley
4f8d244e7e remove formatted panics
implements #17969
2024-09-26 12:35:14 -07:00
Andrew Kelley
04e694ad11 move std.time.sleep to std.Thread.sleep 2024-09-26 12:35:14 -07:00
Alex Rønne Petersen
2db3c77060
std.io.Reader: Fix test erroneously using undefined. 2024-09-26 17:04:36 +02:00
dave caruso
085cc54aad replace TranslateC.addIncludeDir with variants with LazyPath/library names 2024-09-25 21:50:55 -07:00
pseudoc
0d00c733de std.os.linux: extend rtattr.type to support IFA_*
This is a breaking change which updates the `rtattr.type` from `IFLA` to
`union { IFLA, IFA }`. `IFLA` is for the `RTM_*LINK` messages and `IFA`
is for the `RTM_*ADDR` messages.
2024-09-26 10:54:18 +08:00
Andrew Kelley
4442288656 std: fix inappropriate use of unreachable in fanotify_init 2024-09-25 16:07:04 -07:00
Andrew Kelley
efc98fcbeb disallow non-scalar sentinel types
see #17969
2024-09-25 03:02:05 -07:00