mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
tools/nolibc: mips: load current function to $t9
The MIPS calling convention requires the address of the current function to be available in $t9. This was not done so far. For GCC this seems to have worked, but when compiled with clang the executable segfault instantly. Properly load the address of _start_c() into $t9 before calling it. Acked-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/r/20240807-nolibc-llvm-v2-2-c20f2f5fc7c2@weissschuh.net Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
This commit is contained in:
parent
55850eb4e5
commit
0daf8c86a4
1 changed files with 3 additions and 1 deletions
|
@ -194,7 +194,9 @@ void __attribute__((weak, noreturn, optimize("Os", "omit-frame-pointer"))) __no_
|
|||
"li $t0, -8\n"
|
||||
"and $sp, $sp, $t0\n" /* $sp must be 8-byte aligned */
|
||||
"addiu $sp, $sp, -16\n" /* the callee expects to save a0..a3 there */
|
||||
"jal _start_c\n" /* transfer to c runtime */
|
||||
"lui $t9, %hi(_start_c)\n" /* ABI requires current function address in $t9 */
|
||||
"ori $t9, %lo(_start_c)\n"
|
||||
"jalr $t9\n" /* transfer to c runtime */
|
||||
" nop\n" /* delayed slot */
|
||||
".set pop\n"
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue