| ... | @@ -273,6 +273,14 @@ fn _start() callconv(.Naked) noreturn { | ... | @@ -273,6 +273,14 @@ fn _start() callconv(.Naked) noreturn { |
| 273 | \\ b %[posixCallMainAndExit] | 273 | \\ b %[posixCallMainAndExit] |
| 274 | , | 274 | , |
| 275 | .riscv32, .riscv64 => | 275 | .riscv32, .riscv64 => |
| | 276 | // The RISC-V ELF ABI assumes that `gp` is set to the value of `__global_pointer$` at |
| | 277 | // startup in order for GP relaxation to work, even in static builds. |
| | 278 | \\ .weak __global_pointer$ |
| | 279 | \\ .hidden __global_pointer$ |
| | 280 | \\ .option push |
| | 281 | \\ .option norelax |
| | 282 | \\ lla gp, __global_pointer$ |
| | 283 | \\ .option pop |
| 276 | \\ li s0, 0 | 284 | \\ li s0, 0 |
| 277 | \\ li ra, 0 | 285 | \\ li ra, 0 |
| 278 | \\ mv a0, sp | 286 | \\ mv a0, sp |