| ... | ... | @@ -316,6 +316,24 @@ fn _start() callconv(.Naked) noreturn { |
| 316 | 316 | \\ and sp, #-16 |
| 317 | 317 | \\ b %[posixCallMainAndExit] |
| 318 | 318 | , |
| 319 | // zig fmt: off |
| 320 | .csky => |
| 321 | if (builtin.position_independent_code) |
| 322 | // The CSKY ABI assumes that `gb` is set to the address of the GOT in order for |
| 323 | // position-independent code to work. We depend on this in `std.os.linux.start_pie` |
| 324 | // to locate `_DYNAMIC` as well. |
| 325 | \\ grs t0, 1f |
| 326 | \\ 1: |
| 327 | \\ lrw gb, 1b@GOTPC |
| 328 | \\ addu gb, t0 |
| 329 | else "" |
| 330 | ++ |
| 331 | \\ movi lr, 0 |
| 332 | \\ mov a0, sp |
| 333 | \\ andi sp, sp, -8 |
| 334 | \\ jmpi %[posixCallMainAndExit] |
| 335 | , |
| 336 | // zig fmt: on |
| 319 | 337 | .hexagon => |
| 320 | 338 | // r29 = SP, r30 = FP |
| 321 | 339 | \\ r30 = #0 |