Alex Rønne Petersen
82e82b6267
start: Fix callconv for the wWinMainCRTStartup symbol.
...
This just uses the C calling convention in the vcruntime sources.
2024-11-02 10:44:18 +01:00
Alex Rønne Petersen
8a2d960627
start: Fix a calling convention check to use eql().
...
Also modernize some callconv uses.
Closes #21813 .
2024-11-02 10:44:18 +01:00
Robin Voetter
9b42bc1ce5
spirv: start.zig support for vulkan
...
* Use builtin.zig_backend instead of builtin.cpu.arch, the latter
does not yet compile under VK.
* Don't call regular _start for either opencl or vulkan. We might
even want to disable these completely.
2024-10-27 14:20:52 +01:00
mlugg
bc797a97b1
std: update for new CallingConvention
...
The old `CallingConvention` type is replaced with the new
`NewCallingConvention`. References to `NewCallingConvention` in the
compiler are updated accordingly. In addition, a few parts of the
standard library are updated to use the new type correctly.
2024-10-19 19:15:23 +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
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
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
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
b56a667ecd
start: Rewrite arm code to work for thumb1 too.
...
0ecc6332b4 improved things for thumb2, but thumb1
has a much smaller permissible instruction set. This commit makes that work.
2024-09-12 20:10:45 -07:00
Alex Rønne Petersen
0ecc6332b4
start: Fix arm stack alignment code to work for thumb too.
2024-08-31 03:38:35 +02:00
mlugg
0fe3fd01dd
std: update std.builtin.Type fields to follow naming conventions
...
The compiler actually doesn't need any functional changes for this: Sema
does reification based on the tag indices of `std.builtin.Type` already!
So, no zig1.wasm update is necessary.
This change is necessary to disallow name clashes between fields and
decls on a type, which is a prerequisite of #9938 .
2024-08-28 08:39:59 +01:00
Jacob Young
f289b82d0e
Dwarf: implement .eh_frame
2024-08-27 03:55:56 -04:00
mlugg
a3a737e9a6
lib,test,tools,doc: update usages of @export
2024-08-27 00:44:35 +01:00
Alex Rønne Petersen
ab9628dd2c
start: Avoid concatenating strings for inline asm.
...
For csky, we can just always do the gb initialization. For riscv, the gp code is
temporarily pulled above the main switch until the blocking issue is resolved.
2024-08-15 10:56:32 +02:00
Jacob Young
5d080e25d5
start: fix passing comptime-only value to inline asm
...
Also fix fmt directive typo.
2024-08-15 04:42:04 -04:00
Andrew Kelley
8184912a98
Merge pull request #20925 from alexrp/windows-tls
...
`std`: Some Windows TLS cleanup and fixes
2024-08-07 01:12:11 -07:00
Alex Rønne Petersen
c0681d6b6e
start: Add sparc32 support.
2024-08-07 01:09:18 -07:00
Alex Rønne Petersen
8056a85151
std: Move start_windows_tls.zig to os/windows/tls.zig.
...
Just to be consistent with Linux.
2024-08-03 20:35:08 +02:00
Alex Rønne Petersen
a9c7818512
start: Fix an isARM() check to use isArmOrThumb() instead.
2024-08-01 20:58:08 +02:00
Andrew Kelley
7a0da805a8
Merge pull request #20797 from alexrp/start-more-arches
...
`start`: Add POSIX arc, csky, and hexagon support
2024-08-01 01:34:33 -07:00
Andrew Kelley
91163b44dd
Merge pull request #20857 from alexrp/tls-porting
...
`std.os.linux.tls`: Refactor, improve documentation, fix a bug, and port to more architectures
2024-08-01 01:15:17 -07:00
Andrew Kelley
63aa85e7af
Merge pull request #20872 from alexrp/riscv-gp
...
start: Initialize `gp` to `__global_pointer$` on riscv.
2024-08-01 00:47:05 -07:00
David Rubin
2b8a71489a
start: remove riscv condition
2024-07-31 13:40:00 -07:00
Alex Rønne Petersen
653eb75355
start: Disable the gp initialization code for the self-hosted riscv64 backend.
2024-07-31 02:06:57 +02:00
Alex Rønne Petersen
982510f8d5
start: Initialize gp to __global_pointer$ on riscv.
2024-07-31 02:05:17 +02:00
Alex Rønne Petersen
78e581b86f
start: Copy the mips64 comment about gp to the mips32 code.
...
Also, don't incorrectly claim that it's only needed for dynamic linking/PIC.
2024-07-30 17:58:22 +02:00
Alex Rønne Petersen
108c682df0
start: Add POSIX csky support.
2024-07-30 17:47:46 +02:00
Andrew Kelley
f219286573
Merge pull request #20852 from ziglang/init-array-start-code
...
start code: implement __init_array_start, __init_array_end
2024-07-29 18:40:27 -07:00
Alex Rønne Petersen
b52e054261
std.os.linux.tls: Refactor and improve documentation.
...
* Elaborate on the sub-variants of Variant I.
* Clarify the use of the TCB term.
* Rename a bunch of stuff to be more accurate/descriptive.
* Follow Zig's style around namespacing more.
* Use a structure for the ABI TCB.
No functional change intended.
2024-07-30 02:32:32 +02:00
Andrew Kelley
38e0f049c5
Merge pull request #20389 from alexrp/riscv32
...
Some `riscv32-linux` porting work
2024-07-29 16:13:35 -07:00
Andrew Kelley
7342017404
Merge pull request #20822 from alexrp/start-mips-fixes
...
`start`: A handful of MIPS fixes
2024-07-29 12:02:59 -07:00
Andrew Kelley
3f2d1b17fc
disable the new code for self-hosted riscv backend
2024-07-29 11:38:11 -07:00
Alex Rønne Petersen
d633b35f35
start: Always inline the call to std.os.linux.pie.relocate().
...
At this stage, we're not ready to make calls yet on some architectures (e.g. MIPS).
2024-07-29 10:08:34 +02:00
Alex Rønne Petersen
d6c637c36b
start: Set std.os.linux.elf_aux_maybe after PIE relocations.
...
Accesses to this global variable can require relocations on some platforms (e.g.
MIPS). If we do it before PIE relocations have been applied, we'll crash.
2024-07-29 10:05:28 +02:00
Alex Rønne Petersen
e33af8e902
start: Perform the posixCallMainAndExit() call with jalr on mips.
...
It's actually important for the ABI that r25 (t9) contains the address of the
called function, so that this standard prologue sequence works:
lui $2, %hi(_gp_disp)
addiu $2, $2, %lo(_gp_disp)
addu $gp, $2, $t9
(This is a bit similar to the ToC situation on powerpc that was fixed in
7bc78967b400322a0fc5651f37a1b0428c37fb9d.)
2024-07-29 10:05:25 +02:00
Alex Rønne Petersen
77fc3b88fb
start: Set up the gp register on mips and mips64.
2024-07-29 10:04:54 +02:00
Alex Rønne Petersen
8b176ab303
start: Implement _start() for riscv32.
2024-07-29 09:50:09 +02:00
Andrew Kelley
728024f9f3
start code: implement __init_array_start, __init_array_end
2024-07-28 23:54:49 -07:00
David Rubin
7ff5709e1b
riscv: implement lr/sr loop logic for non-native atomics
2024-07-26 04:19:57 -07:00
David Rubin
a1f6a8ef90
riscv: airAsm rewrite
...
with this rewrite we can call functions inside of
inline assembly, enabling us to use the default start.zig logic
all that's left is to implement lr/sc loops for atomically manipulating
1 and 2 byte values, after which we can use the segfault handler logic.
2024-07-26 04:19:55 -07:00
Alex Rønne Petersen
389ce984b5
start: Add POSIX arc support.
2024-07-26 02:32:19 +02:00
Alex Rønne Petersen
7c98a65ae4
start: Add POSIX hexagon support.
2024-07-26 02:32:16 +02:00
Alex Rønne Petersen
fff5ce053f
start: Align the stack on sparc64 just in case.
...
The kernel does this as required, but we cannot trust dynamic linkers to do it.
2024-07-25 00:55:52 +02:00
Alex Rønne Petersen
ebefee6088
start: Fix mips stack alignment value (should be 8, not 16).
2024-07-25 00:55:36 +02:00
Alex Rønne Petersen
5478b0eb38
start: Simplify mips and mips64 startup code.
...
Switches from using r1 as a temporary to r2. That way, we don't have to set the
`noat` assembler option. (r1 is the scratch register used by the assembler's
pseudoinstructions; the assembler warns when code uses that register explicitly
without `noat` set.)
2024-07-25 00:55:00 +02:00
Alex Rønne Petersen
47c0464e86
start: Explicitly clear the link register on mips and mips64 just in case.
...
The kernel does this as required, but we cannot trust dynamic linkers to do it.
2024-07-24 21:56:54 +02:00
Alex Rønne Petersen
1b13d7477d
start: Properly escape percent signs in the s390x inline asm.
...
Silly mistake in 8ffc41f747 .
2024-07-24 21:56:54 +02:00
Alex Rønne Petersen
ce81525f3f
start: Align the stack on s390x just in case.
...
The kernel does this as required, but we cannot trust dynamic linkers to do it.
2024-07-24 21:56:54 +02:00
Alex Rønne Petersen
52653ec82b
start: Align the stack on powerpc just in case.
...
The kernel does this as required, but we cannot trust dynamic linkers to do it.
2024-07-24 21:56:54 +02:00
Alex Rønne Petersen
714e743393
start: Align the stack on aarch64 just in case.
...
The kernel does this as required, but we cannot trust dynamic linkers to do it.
2024-07-24 21:56:52 +02:00