summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-09-17 07:20:43 +0000
committerRich Felker <dalias@aerifal.cx>2015-09-17 07:20:43 +0000
commitcd7159e7be73451befedce2e9dfd9f6a4c3b21f0 (patch)
treee11dda44beeb755b5b0b06fdfbbcad5ca936b3d6
parent57e2dce7e46f8f94318f1d4dec590c9f1c3025dc (diff)
downloadmusl-cd7159e7be73451befedce2e9dfd9f6a4c3b21f0.tar.gz
new dlstart stage-2 chaining for mips
-rw-r--r--arch/mips/reloc.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/mips/reloc.h b/arch/mips/reloc.h
index 8aa02852..9b40e3da 100644
--- a/arch/mips/reloc.h
+++ b/arch/mips/reloc.h
@@ -29,3 +29,18 @@
#define CRTJMP(pc,sp) __asm__ __volatile__( \
"move $sp,%1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" )
+
+#define GETFUNCSYM(fp, sym, got) __asm__ ( \
+ ".hidden " #sym "\n" \
+ ".set push \n" \
+ ".set noreorder \n" \
+ " bal 1f \n" \
+ " nop \n" \
+ " .gpword . \n" \
+ " .gpword " #sym " \n" \
+ "1: lw %0, ($ra) \n" \
+ " subu %0, $ra, %0 \n" \
+ " lw $ra, 4($ra) \n" \
+ " addu %0, %0, $ra \n" \
+ ".set pop \n" \
+ : "=r"(*(fp)) : : "memory", "ra" )