-void __reloc_self(int c, size_t *a, size_t *dynv)
-{
- char *base;
- size_t t[20], n;
- for (a+=c+1; *a; a++);
- for (a++; *a; a+=2) if (*a<20) t[*a] = a[1];
- base = (char *)t[AT_BASE];
- if (!base) base = (char *)(t[AT_PHDR] & -t[AT_PAGESZ]);
- for (a=dynv; *a; a+=2) if (*a<20) t[*a] = a[1];
- n = t[DT_RELASZ];
- for (a=(void *)(base+t[DT_RELA]); n; a+=3, n-=12)
- if (a[1]%256 == R_PPC_RELATIVE)
- *(size_t *)(base+a[0]) = (size_t)base + a[2];
-}
+#define CRTJMP(pc,sp) __asm__ __volatile__( \
+ "mr 1,%1 ; mtlr %0 ; blr" : : "r"(pc), "r"(sp) : "memory" )
+
+#define GETFUNCSYM(fp, sym, got) __asm__ ( \
+ ".hidden " #sym " \n" \
+ " bl 1f \n" \
+ " .long " #sym "-. \n" \
+ "1: mflr %1 \n" \
+ " lwz %0, 0(%1) \n" \
+ " add %0, %0, %1 \n" \
+ : "=r"(*(fp)), "=r"((int){0}) : : "memory", "lr" )