| ... | ... | @@ -300,6 +300,12 @@ fn _start() callconv(.Naked) noreturn { |
| 300 | 300 | \\ and sp, #-16 |
| 301 | 301 | \\ b %[posixCallMainAndExit] |
| 302 | 302 | , |
| 303 | .loongarch64 => |
| 304 | \\ move $fp, $zero |
| 305 | \\ move $a0, $sp |
| 306 | \\ bstrins.d $sp, $zero, 3, 0 |
| 307 | \\ b %[posixCallMainAndExit] |
| 308 | , |
| 303 | 309 | .riscv64 => |
| 304 | 310 | \\ li s0, 0 |
| 305 | 311 | \\ li ra, 0 |
| ... | ... | @@ -307,6 +313,14 @@ fn _start() callconv(.Naked) noreturn { |
| 307 | 313 | \\ andi sp, sp, -16 |
| 308 | 314 | \\ tail %[posixCallMainAndExit]@plt |
| 309 | 315 | , |
| 316 | .m68k => |
| 317 | // Note that the - 8 is needed because pc in the jsr instruction points into the middle |
| 318 | // of the jsr instruction. (The lea is 6 bytes, the jsr is 4 bytes.) |
| 319 | \\ suba.l %%fp, %%fp |
| 320 | \\ move.l %%sp, -(%%sp) |
| 321 | \\ lea %[posixCallMainAndExit] - . - 8, %%a0 |
| 322 | \\ jsr (%%pc, %%a0) |
| 323 | , |
| 310 | 324 | .mips, .mipsel => |
| 311 | 325 | // The lr is already zeroed on entry, as specified by the ABI. |
| 312 | 326 | \\ addiu $fp, $zero, 0 |
| ... | ... | @@ -340,8 +354,8 @@ fn _start() callconv(.Naked) noreturn { |
| 340 | 354 | , |
| 341 | 355 | .powerpc64, .powerpc64le => |
| 342 | 356 | // Setup the initial stack frame and clear the back chain pointer. |
| 343 | | \\ addis 2, 12, .TOC. - _start@ha |
| 344 | | \\ addi 2, 2, .TOC. - _start@l |
| 357 | \\ addis 2, 12, .TOC. - %[_start]@ha |
| 358 | \\ addi 2, 2, .TOC. - %[_start]@l |
| 345 | 359 | \\ mr 3, 1 |
| 346 | 360 | \\ clrrdi 1, 1, 4 |
| 347 | 361 | \\ li 0, 0 |
| ... | ... | @@ -349,6 +363,15 @@ fn _start() callconv(.Naked) noreturn { |
| 349 | 363 | \\ mtlr 0 |
| 350 | 364 | \\ b %[posixCallMainAndExit] |
| 351 | 365 | , |
| 366 | .s390x => |
| 367 | // Set up the stack frame (register save area and cleared back-chain slot). |
| 368 | // Note: Stack pointer is guaranteed by ABI to be 8-byte aligned as required. |
| 369 | \\ lgr %r2, %r15 |
| 370 | \\ aghi %r15, -160 |
| 371 | \\ lghi %r0, 0 |
| 372 | \\ stg %r0, 0(%r15) |
| 373 | \\ jg %[posixCallMainAndExit] |
| 374 | , |
| 352 | 375 | .sparc64 => |
| 353 | 376 | // argc is stored after a register window (16 registers) plus stack bias |
| 354 | 377 | \\ mov %%g0, %%i6 |
| ... | ... | @@ -359,7 +382,8 @@ fn _start() callconv(.Naked) noreturn { |
| 359 | 382 | else => @compileError("unsupported arch"), |
| 360 | 383 | } |
| 361 | 384 | : |
| 362 | | : [posixCallMainAndExit] "X" (&posixCallMainAndExit), |
| 385 | : [_start] "X" (_start), |
| 386 | [posixCallMainAndExit] "X" (&posixCallMainAndExit), |
| 363 | 387 | ); |
| 364 | 388 | } |
| 365 | 389 | |