fix statfs struct on mips
[musl] / arch / mips / reloc.h
index f5e9c77..4ca8125 100644 (file)
@@ -1,7 +1,20 @@
 #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
+
+#ifdef __mips_soft_float
+#define FP_SUFFIX "-sf"
+#else
+#define FP_SUFFIX ""
+#endif
+
+#define LDSO_ARCH "mips" ENDIAN_SUFFIX FP_SUFFIX
 
 #define IS_COPY(x) ((x)==R_MIPS_COPY)
 #define IS_PLT(x) 1
@@ -44,7 +57,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;