| ... | @@ -272,21 +272,27 @@ fn _start() callconv(.Naked) noreturn { | ... | @@ -272,21 +272,27 @@ fn _start() callconv(.Naked) noreturn { |
| 272 | \\ bstrins.d $sp, $zero, 3, 0 | 272 | \\ bstrins.d $sp, $zero, 3, 0 |
| 273 | \\ b %[posixCallMainAndExit] | 273 | \\ b %[posixCallMainAndExit] |
| 274 | , | 274 | , |
| | 275 | // zig fmt: off |
| 275 | .riscv32, .riscv64 => | 276 | .riscv32, .riscv64 => |
| 276 | // The RISC-V ELF ABI assumes that `gp` is set to the value of `__global_pointer$` at | 277 | // The self-hosted riscv64 backend is not able to assemble this yet. |
| 277 | // startup in order for GP relaxation to work, even in static builds. | 278 | if (builtin.zig_backend != .stage2_riscv64) |
| 278 | \\ .weak __global_pointer$ | 279 | // The RISC-V ELF ABI assumes that `gp` is set to the value of `__global_pointer$` at |
| 279 | \\ .hidden __global_pointer$ | 280 | // startup in order for GP relaxation to work, even in static builds. |
| 280 | \\ .option push | 281 | \\ .weak __global_pointer$ |
| 281 | \\ .option norelax | 282 | \\ .hidden __global_pointer$ |
| 282 | \\ lla gp, __global_pointer$ | 283 | \\ .option push |
| 283 | \\ .option pop | 284 | \\ .option norelax |
| | 285 | \\ lla gp, __global_pointer$ |
| | 286 | \\ .option pop |
| | 287 | else "" |
| | 288 | ++ |
| 284 | \\ li s0, 0 | 289 | \\ li s0, 0 |
| 285 | \\ li ra, 0 | 290 | \\ li ra, 0 |
| 286 | \\ mv a0, sp | 291 | \\ mv a0, sp |
| 287 | \\ andi sp, sp, -16 | 292 | \\ andi sp, sp, -16 |
| 288 | \\ tail %[posixCallMainAndExit]@plt | 293 | \\ tail %[posixCallMainAndExit]@plt |
| 289 | , | 294 | , |
| | 295 | // zig fmt: off |
| 290 | .m68k => | 296 | .m68k => |
| 291 | // Note that the - 8 is needed because pc in the jsr instruction points into the middle | 297 | // Note that the - 8 is needed because pc in the jsr instruction points into the middle |
| 292 | // of the jsr instruction. (The lea is 6 bytes, the jsr is 4 bytes.) | 298 | // of the jsr instruction. (The lea is 6 bytes, the jsr is 4 bytes.) |