aboutsummaryrefslogtreecommitdiff
path: root/lib/std/start.zig
AgeCommit message (Collapse)Author
2024-07-24start: Properly escape percent signs in the s390x inline asm.Alex Rønne Petersen
Silly mistake in 8ffc41f74705246e61f3c02c253d40b1464ea2bf.
2024-07-24start: Align the stack on s390x just in case.Alex Rønne Petersen
The kernel does this as required, but we cannot trust dynamic linkers to do it.
2024-07-24start: Align the stack on powerpc just in case.Alex Rønne Petersen
The kernel does this as required, but we cannot trust dynamic linkers to do it.
2024-07-24start: Align the stack on aarch64 just in case.Alex Rønne Petersen
The kernel does this as required, but we cannot trust dynamic linkers to do it.
2024-07-24start: Simplify the sparc64 inline asm a bit.Alex Rønne Petersen
2024-07-24start: Add a comment explaining the sparc64 stack bias.Alex Rønne Petersen
2024-07-24start: Add a comment explaining our paranoid stance on ABI guarantees.Alex Rønne Petersen
2024-07-24start: Handle loongarch32 together with loongarch64.Alex Rønne Petersen
Nothing bitness-specific about this startup code.
2024-07-23Merge pull request #20706 from alexrp/sigaction-nosysAndrew Kelley
`std.posix`: Make `sigaction()` infallible
2024-07-23Merge pull request #20725 from ziglang/fuzzAndrew Kelley
initial support for integrated fuzzing
2024-07-22update start code to use `@disableInstrumentation`Andrew Kelley
This prevents it from trying to access thread local storage before it has set up thread local storage, particularly when code coverage instrumentation is enabled.
2024-07-22start: Add POSIX s390x startup code.Alex Rønne Petersen
2024-07-22start: Add POSIX loongarch64 startup code.Alex Rønne Petersen
2024-07-22start: Add POSIX m68k startup code.Alex Rønne Petersen
2024-07-22start: Pass _start() into its own inline asm as an operand.Alex Rønne Petersen
2024-07-22start: Add clrrdi to align the stack pointer on powerpc64.Alex Rønne Petersen
2024-07-22start: Fix _start() to initialize the ToC for powerpc64.Alex Rønne Petersen
The previous version of this function referenced the argc_argv_ptr global variable as an inline asm operand. This caused LLVM to generate prologue code to initialize the ToC so that the global variable can actually be accessed. Ordinarily, there's nothing wrong with that. But _start() is a naked function! This makes it actually super surprising that LLVM did this. It also means that the old version only really worked by accident. Once the reference to the global variable was removed, no ToC was set up, thus violating the calling convention once we got to posixCallMainAndExit(). This then caused any attempt to access global variables here to crash - namely when setting std.os.linux.elf_aux_maybe. The fix is to just initialize the ToC manually in _start().
2024-07-21start: Avoid going through the argc_argv_ptr global variable.Alex Rønne Petersen
This is problematic for PIE. There's nothing but luck preventing the accesses to this global variable from requiring relocations. I've observed this being an issue on MIPS and PowerPC personally, but others may be affected. Besides, we're really just passing the initial stack pointer value to posixCallMainAndExit(), so... just do that.
2024-07-21std.posix: Consider invalid signal numbers to sigaction() to be programmer ↵Alex Rønne Petersen
error. The set of signals that cannot have their action changed is documented in POSIX, and any additional, non-standard signals are documented by the specific OS. I see no valid reason why EINVAL should be considered an unpredictable error here.
2024-07-17Merge pull request #20474 from Rexicon226/riscvJakub Konka
more RISC-V backend progress
2024-07-15start: refactor callMain return type checkinggooncreeper
2024-07-14riscv: vectors part 3David Rubin
2024-06-16Revert "start: workaround for LLVM 17 regression"Alex Rønne Petersen
This reverts commit d7daf7c203f583ed440efc68df6ee690ee8f8f32. This is no longer needed with the LLVM 18 upgrade, and it was breaking PIE. Closes #20306.
2024-05-11riscv: finally fix bug + `airAggregateInit`David Rubin
i just hadn't realized that I placed the `riscv_start` branch in the non-simplified starts
2024-05-11riscv: big rewrite to use latest livenessDavid Rubin
this one is even harder to document then the last large overhaul. TLDR; - split apart Emit.zig into an Emit.zig and a Lower.zig - created seperate files for the encoding, and now adding a new instruction is as simple as just adding it to a couple of switch statements and providing the encoding. - relocs are handled in a more sane maner, and we have a clear defining boundary between lea_symbol and load_symbol now. - a lot of different abstractions for things like the stack, memory, registers, and others. - we're using x86_64's FrameIndex now, which simplifies a lot of the tougher design process. - a lot more that I don't have the energy to document. at this point, just read the commit itself :p
2024-05-11riscv: add enough components to get a test runner workingDavid Rubin
2024-05-11riscv: update `start.zig` and restore ra from the proper stack offsetDavid Rubin
2024-05-09handle visionos target OS tag in the compilerJakub Konka
* rename .xros to .visionos as agreed in the tracking issue * add support for VisionOS platform in the MachO linker
2024-03-30cbe: rewrite `CType`Jacob Young
Closes #14904
2024-03-19extract std.posix from std.osAndrew Kelley
closes #5019
2024-03-11std.builtin: make link mode fields lowercaseTristan Ross
2024-02-01std.start: remove event loop integrationVeikka Tuominen
2024-01-08stage2 AArch64: get empty file compiling againjoachimschmidt557
2023-11-05Merge pull request #17815 from Luukdegram/wasm-no-entryAndrew Kelley
wasm-linker: implement `-fno-entry` and correctly pass `--shared` and `--pie` when given
2023-11-03start.zig: Replace kernel32 usage with ntdllRyan Liptak
Co-authored-by: e4m2 <git@e4m2.com>
2023-11-03wasm-linker: implement `-fno-entry` flagLuuk de Gram
This adds support for the `-fno-entry` and `-fentry` flags respectively, for zig build-{exe/lib} and the build system. For `zig cc` we use the `--no-entry` flag to be compatible with clang and existing tooling. In `start.zig` we now make the main function optional when the target is WebAssembly, as to allow for the build-exe command in combination with `-fno-entry`. When the execution model is set, and is set to 'reactor', we now verify when an entry name is given it matches what is expected. When no entry point is given, we set it to `_initialize` by default. This means the user will also be met with an error when they use the reactor model, but did not provide the correct function.
2023-11-02start: Make wWinMain nCmdShow setting match Windows betterRyan Liptak
It won't match perfectly; see https://github.com/ziglang/zig/issues/17808
2023-10-28delete std.os.windows.user32Andrew Kelley
This is progress towards #4426 Closes #17417
2023-10-12lib: Fix asm code in _start for SPARCKoakuma
SPARCs have delayed branches, that is, it will unconditionally run the next instruction following a branch. Slightly reorder the _start code sequence to prevent it from accidentally executing stray instructions, which may result in odd program behavior.
2023-09-19start: workaround for LLVM 17 regressionJacob Young
Tracking issue #16799
2023-08-02Plan 9: add more features to std.os.plan9Jacob G-W
* Replaces the exit assembly with the function from std. * Reads the top-of-stack struct at program startup that can get information like the pid. * Changes the read and write functions to use the Pread and Pwrite syscalls instead of the depreciated _READ and _WRITE * Changes the openat function to use flags instead of perms. Plan9 does not support perms when opening, just when creating. * Adds an errstr function to read the errstr buf created by the kernel
2023-07-31std: finish cleanup up asmJacob Young
This also required implementing the necessary syntax in the x86_64 backend.
2023-07-31std: cleanup asm usageJacob Young
After fixing some issues with inline assembly in the C backend, the std cleanups have the side effect of making these functions compatible with the backend, allowing it to be used on linux without linking libc.
2023-07-28std.start | Remove unused importZachary Raineri
Removes the unused import tlcsprng
2023-07-27linux: do not set stack size hard limitMichael Dusan
At main startup, if the ELF auxiliary vector contains a stacksize value, use it as a hint for the minimum stacksize required by the executable. 1. Never lower the hard-limit. Once a hard-limit is lowered, then it can never be increased (including child processes). 2. If hint exceeds hard-limit then clamp hint to hard-limit. 3. If soft-limit exceeds hint then do nothing.
2023-06-24all: migrate code to new cast builtin syntaxmlugg
Most of this migration was performed automatically with `zig fmt`. There were a few exceptions which I had to manually fix: * `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten * `@truncate`'s fixup is incorrect for vectors * Test cases are not formatted, and their error locations change
2023-06-19all: zig fmt and rename "@XToY" to "@YFromX"Eric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-16plan9: flesh out stdlib enough to allow not using simplified start logicJacob G-W
2023-05-01x86_64: enable normal start/test_runner logic on more targetsJacob Young
2023-04-14wasm: no longer use simplified `start.zig`Luuk de Gram
The Wasm backend now supports all features required to use the full `start.zig` logic, rather than the simplified version. With this commit we remove all references to the simplified logic for Wasm specifically.