summaryrefslogtreecommitdiff
path: root/ldso/ldso/sparc/dl-sysdep.h
diff options
context:
space:
mode:
Diffstat (limited to 'ldso/ldso/sparc/dl-sysdep.h')
-rw-r--r--ldso/ldso/sparc/dl-sysdep.h51
1 files changed, 47 insertions, 4 deletions
diff --git a/ldso/ldso/sparc/dl-sysdep.h b/ldso/ldso/sparc/dl-sysdep.h
index c6ac89e11..ddf74e21e 100644
--- a/ldso/ldso/sparc/dl-sysdep.h
+++ b/ldso/ldso/sparc/dl-sysdep.h
@@ -41,9 +41,51 @@ extern unsigned int _dl_linux_resolver(unsigned int reloc_entry,
/*
* Define this if you want a dynamic loader that works on Solaris.
*/
+#ifndef __linux__
#define SOLARIS_COMPATIBLE
+#endif
+
+#ifndef COMPILE_ASM
+/* Cheap modulo implementation, taken from arm/ld_sysdep.h. */
+static inline unsigned long
+sparc_mod(unsigned long m, unsigned long p)
+{
+ unsigned long i, t, inc;
+
+ i = p;
+ t = 0;
+
+ while (!(i & (1 << 31))) {
+ i <<= 1;
+ t++;
+ }
+
+ t--;
+
+ for (inc = t; inc > 2; inc--) {
+ i = p << inc;
-#define do_rem(result, n, base) result = (n % base)
+ if (i & (1 << 31))
+ break;
+
+ while (m >= i) {
+ m -= i;
+ i <<= 1;
+ if (i & (1 << 31))
+ break;
+ if (i < p)
+ break;
+ }
+ }
+
+ while (m >= p)
+ m -= p;
+
+ return m;
+}
+
+#define do_rem(result, n, base) result = sparc_mod(n, base);
+#endif
/*
* dbx wants the binder to have a specific name. Mustn't disappoint it.
@@ -53,9 +95,10 @@ extern unsigned int _dl_linux_resolver(unsigned int reloc_entry,
#endif
/* 4096 bytes alignment */
-#define PAGE_ALIGN 0xfffff000
-#define ADDR_ALIGN 0xfff
-#define OFFS_ALIGN 0x7ffff000
+/* ...but 8192 is required for mmap() on sparc64 kernel */
+#define PAGE_ALIGN 0xffffe000
+#define ADDR_ALIGN 0x1fff
+#define OFFS_ALIGN 0x7fffe000
/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
PLT entries should not be allowed to define the value.