From 3c2a68b9dc9ae45f5eb0971a3e6583af732c3f91 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Thu, 9 Apr 2009 07:38:04 +0000 Subject: The attached patches fixes the problems found bringing up uclibc on coldfire M5485 processor 1. Disable mmap2() if we're compiling for coldfire and fall back to mmap(). It seems to map a different file area on a 2.6.25 linux kernel. 2. Uses pc-relative addresing[1], computes ADDR_ALIGN, PAGE_ALIGN and OFFSET_ALIGN relatively to _dl_pagesize[3]. On coldfire/M5485 _dl_pagesize is 0x2000. Signed-off-by: Groleo Marius --- ldso/ldso/m68k/dl-sysdep.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'ldso/ldso/m68k/dl-sysdep.h') diff --git a/ldso/ldso/m68k/dl-sysdep.h b/ldso/ldso/m68k/dl-sysdep.h index 259cb84be..b5eda4e9c 100644 --- a/ldso/ldso/m68k/dl-sysdep.h +++ b/ldso/ldso/m68k/dl-sysdep.h @@ -42,19 +42,29 @@ extern unsigned long _dl_linux_resolver (struct elf_resolve *, int); static __always_inline Elf32_Addr elf_machine_dynamic (void) { - register Elf32_Addr *got __asm__ ("%a5"); - return *got; + Elf32_Addr got; + + __asm__ ("move.l _DYNAMIC@GOT.w(%%a5), %0" + : "=a" (got)); + return got; } +#ifdef __mcoldfire__ +#define PCREL_OP(OP, SRC, DST, TMP, PC) \ + "move.l #" SRC " - ., " TMP "\n\t" OP " (-8, " PC ", " TMP "), " DST +#else +#define PCREL_OP(OP, SRC, DST, TMP, PC) \ + OP " " SRC "(" PC "), " DST +#endif /* Return the run-time load address of the shared object. */ static __always_inline Elf32_Addr elf_machine_load_address (void) { Elf32_Addr addr; - __asm__ ("lea _dl_start(%%pc), %0\n\t" - "sub.l _dl_start@GOT.w(%%a5), %0" - : "=a" (addr)); + __asm__ (PCREL_OP ("lea", "_dl_start", "%0", "%0", "%%pc") "\n\t" + "sub.l _dl_start@GOT.w(%%a5), %0" + : "=a" (addr)); return addr; } -- cgit v1.2.3