fixup general __syscall breakage introduced in x32 port
[musl] / arch / mips / reloc.h
index f5e9c77..07fa10a 100644 (file)
@@ -1,7 +1,14 @@
 #include <string.h>
 #include <elf.h>
+#include <endian.h>
 
-#define ETC_LDSO_PATH "/etc/ld-musl-mips.path"
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define ENDIAN_SUFFIX "el"
+#else
+#define ENDIAN_SUFFIX ""
+#endif
+
+#define LDSO_ARCH "mips" ENDIAN_SUFFIX
 
 #define IS_COPY(x) ((x)==R_MIPS_COPY)
 #define IS_PLT(x) 1
@@ -44,7 +51,7 @@ void __reloc_self(int c, size_t *a, size_t *dynv, size_t *got)
        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] & -4096);
+       if (!base) base = (char *)(t[AT_PHDR] & -t[AT_PAGESZ]);
        for (a=dynv; *a; a+=2) if (*a-0x70000000UL<20) t[*a&31] = a[1];
        n = t[DT_MIPS_LOCAL_GOTNO - 0x70000000];
        for (a=got; n; a++, n--) *a += (size_t)base;