| ... | @@ -300,6 +300,12 @@ fn _start() callconv(.Naked) noreturn { | ... | @@ -300,6 +300,12 @@ fn _start() callconv(.Naked) noreturn { |
| 300 | \\ and sp, #-16 | 300 | \\ and sp, #-16 |
| 301 | \\ b %[posixCallMainAndExit] | 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 | .riscv64 => | 309 | .riscv64 => |
| 304 | \\ li s0, 0 | 310 | \\ li s0, 0 |
| 305 | \\ li ra, 0 | 311 | \\ li ra, 0 |
| ... | @@ -307,6 +313,14 @@ fn _start() callconv(.Naked) noreturn { | ... | @@ -307,6 +313,14 @@ fn _start() callconv(.Naked) noreturn { |
| 307 | \\ andi sp, sp, -16 | 313 | \\ andi sp, sp, -16 |
| 308 | \\ tail %[posixCallMainAndExit]@plt | 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 | .mips, .mipsel => | 324 | .mips, .mipsel => |
| 311 | // The lr is already zeroed on entry, as specified by the ABI. | 325 | // The lr is already zeroed on entry, as specified by the ABI. |
| 312 | \\ addiu $fp, $zero, 0 | 326 | \\ addiu $fp, $zero, 0 |
| ... | @@ -340,8 +354,8 @@ fn _start() callconv(.Naked) noreturn { | ... | @@ -340,8 +354,8 @@ fn _start() callconv(.Naked) noreturn { |
| 340 | , | 354 | , |
| 341 | .powerpc64, .powerpc64le => | 355 | .powerpc64, .powerpc64le => |
| 342 | // Setup the initial stack frame and clear the back chain pointer. | 356 | // Setup the initial stack frame and clear the back chain pointer. |
| 343 | \\ addis 2, 12, .TOC. - _start@ha | 357 | \\ addis 2, 12, .TOC. - %[_start]@ha |
| 344 | \\ addi 2, 2, .TOC. - _start@l | 358 | \\ addi 2, 2, .TOC. - %[_start]@l |
| 345 | \\ mr 3, 1 | 359 | \\ mr 3, 1 |
| 346 | \\ clrrdi 1, 1, 4 | 360 | \\ clrrdi 1, 1, 4 |
| 347 | \\ li 0, 0 | 361 | \\ li 0, 0 |
| ... | @@ -349,6 +363,15 @@ fn _start() callconv(.Naked) noreturn { | ... | @@ -349,6 +363,15 @@ fn _start() callconv(.Naked) noreturn { |
| 349 | \\ mtlr 0 | 363 | \\ mtlr 0 |
| 350 | \\ b %[posixCallMainAndExit] | 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 | .sparc64 => | 375 | .sparc64 => |
| 353 | // argc is stored after a register window (16 registers) plus stack bias | 376 | // argc is stored after a register window (16 registers) plus stack bias |
| 354 | \\ mov %%g0, %%i6 | 377 | \\ mov %%g0, %%i6 |
| ... | @@ -359,7 +382,8 @@ fn _start() callconv(.Naked) noreturn { | ... | @@ -359,7 +382,8 @@ fn _start() callconv(.Naked) noreturn { |
| 359 | else => @compileError("unsupported arch"), | 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 | |