Commit Graph

31308 Commits

Author SHA1 Message Date
Jakub Konka
bae3dbffdf elf: clear dynamic relocs before repopulating 2024-10-09 12:27:30 -07:00
Jakub Konka
bc7e0342b5 elf: do not re-populate synthetic sections when updating 2024-10-09 12:27:30 -07:00
Jakub Konka
7fead5d6dd elf: track atoms within AtomList with array hash map 2024-10-09 12:27:30 -07:00
Andrew Kelley
ce5a5c361b
Merge pull request #21633 from ziglang/reduce-flush-logic
link.Elf: reduce flush logic
2024-10-09 01:43:57 -07:00
Andrew Kelley
22661f3d67 link tests: add a way to check prefix and use it 2024-10-08 21:57:08 -07:00
Andrew Kelley
31d70cb1e1 link.Elf: avoid needless file system reads in flush()
flush() must not do anything more than necessary. Determining the type
of input files must be done only once, before flush. Fortunately, we
don't even need any file system accesses to do this since that
information is statically known in most cases, and in the rest of the
cases can be determined by file extension alone.

This commit also updates the nearby code to conform to the convention
for error handling where there is exactly one error code to represent
the fact that error messages have already been emitted. This had the
side effect of improving the error message for a linker script parse
error.

"positionals" is not a linker concept; it is a command line interface
concept. Zig's linker implementation should not mention "positionals".
This commit deletes that array list in favor of directly making function
calls, eliminating that heap allocation during flush().
2024-10-08 18:02:59 -07:00
Andrew Kelley
2c41c453b6 link.Elf: avoid converting rpath data in flush()
The goal is to minimize as much as possible how much logic is inside
flush(). So let's start by moving out obvious stuff. This data can be
preformatted before flush().
2024-10-08 18:02:59 -07:00
Parzival-3141
e1e151df0d untangle skip conditions 2024-10-08 23:34:20 +02:00
Parzival-3141
7dc0014769 revert disabling aarch64 skip
I was too optimistic in disabling the aarch64 skip, assuming it was also
caused by ConEmu. Unfortunately I don't have access to a machine for testing.
2024-10-08 23:34:20 +02:00
Parzival-3141
f522fb9ca3 fix standalone/empty_env test
The problem seems to be ConEmu setting environment variables before
executing the test process. The test passes when run in Windows CMD.
2024-10-08 23:34:20 +02:00
Pavel Verigo
4b89a4c7cb stage2-wasm: airRem + airMod for floats 2024-10-08 20:58:15 +02:00
Alex Rønne Petersen
b00cbecfd3
Merge pull request #21622 from mikdusan/bsd
bsd: revive freebsd and dragonfly
2024-10-08 18:32:02 +02: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
Matthew Lugg
ea527f7a85
Merge pull request #21618 from mlugg/validate-runtime-value
Sema: add a few missing runtime value validations
2024-10-07 13:46:21 +01:00
mlugg
95857d6b21
Sema: add missing runtime value validation to global mutable variables
Resolves: #20365
2024-10-07 07:42:17 +01:00
mlugg
36243567e6
Sema: add missing runtime value validation to @memcpy and @memset 2024-10-07 07:27:50 +01:00
Alex Rønne Petersen
7a2fde973d link.Elf: Fix page size calculation for more architectures.
Sourced from binutils/bfd.
2024-10-07 07:04:05 +02: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
Alex Rønne Petersen
b6b86cb878
test: Fix powerpc-aix-eabihf target triple in llvm_targets. 2024-10-06 22:41:53 +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
1992428044
test: Add some missing x86_64-linux-* triples to llvm_targets. 2024-10-06 10:26:00 +02:00
Alex Rønne Petersen
5e9764c512
test: Add android/androideabi triples to llvm_targets. 2024-10-06 10:24:35 +02:00
Alex Rønne Petersen
e3e60491ba
test: Add ohos/ohoseabi triples to llvm_targets. 2024-10-06 10:22:39 +02: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
mlugg
ada60616b3
incr-check: minor fixes
* fix inconsistency in global cache directory name
* don't error if spawning external executor fails
* handle CRLF correctly
2024-10-05 20:52:26 +01:00
mlugg
14ccbbef9f
test: add x86_64-windows-cbe target to incremental cases
Throw another target in there just to spice things up a little!

Running the incremental cases with the C backend is pretty slow due to
the need to recompile the whole output from scratch on every update; for
this reason, we probably don't want to keep many of these targeting CBE
long-term. However, for now, while we have relatively few tests and
things are still changing quite a lot, it's better to have this little
bit of extra test coverage.
2024-10-05 20:52:26 +01:00
mlugg
dfc0a27090
incr-check: clean up temporary directory by default
The new `--preserve-tmp` flag can be used to preserve the temporary
directory for debugging purposes.
2024-10-05 20:52:26 +01:00
mlugg
5ce962eb69
incr-check: better progress output, support external executors
If no external executor is available for a successful binary, its
execution is silently skipped. This allows the CI to test, to the
fullest extent possible, incremental cross-compilation to targets whose
binaries can't be executed on the host.
2024-10-05 20:52:25 +01:00
mlugg
f60c045cef
tests: add test-incremental step
This is contained in the `test` step, so is tested by CI.

This commit also includes some enhancements to the `incr-check` tool to
make this work correctly.
2024-10-05 20:52:25 +01: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
25ee7b0ea8
compiler: Don't require PIC for aarch64-linux-ohos.
While Clang defaults to PIC for this target, it's not actually required.
2024-10-05 15:19:14 +02:00