Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools/nolibc: MIPS: drop $gp setup

The setup of the global pointer "$gp" register was necessary when the C
entrypoint was called through "jal <symbol>".
However since commit 0daf8c86a451 ("tools/nolibc: mips: load current function to $t9")
"jalr" is used instead which does not require "$gp".

Remove the unnecessary $gp setup, simplifying the code and opening the
road for some other cleanups.

Suggested-by: Maciej W. Rozycki <macro@orcam.me.uk>
Link: https://lore.kernel.org/lkml/alpine.DEB.2.21.2502172208570.65342@angie.orcam.me.uk/
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Tested-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Link: https://lore.kernel.org/r/20250623-nolibc-mips-n32-v3-1-6ae2d89f4259@weissschuh.net

-6
-6
tools/include/nolibc/arch-mips.h
··· 185 185 __asm__ volatile ( 186 186 ".set push\n" 187 187 ".set noreorder\n" 188 - "bal 1f\n" /* prime $ra for .cpload */ 189 - "nop\n" 190 - "1:\n" 191 - ".cpload $ra\n" 192 188 "move $a0, $sp\n" /* save stack pointer to $a0, as arg1 of _start_c */ 193 - "addiu $sp, $sp, -4\n" /* space for .cprestore to store $gp */ 194 - ".cprestore 0\n" 195 189 "li $t0, -8\n" 196 190 "and $sp, $sp, $t0\n" /* $sp must be 8-byte aligned */ 197 191 "addiu $sp, $sp, -16\n" /* the callee expects to save a0..a3 there */