about summary refs log tree commit diff
path: root/sysdeps/m68k
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/m68k')
-rw-r--r--sysdeps/m68k/bsd-_setjmp.S2
-rw-r--r--sysdeps/m68k/bsd-setjmp.S2
-rw-r--r--sysdeps/m68k/dl-machine.h27
3 files changed, 24 insertions, 7 deletions
diff --git a/sysdeps/m68k/bsd-_setjmp.S b/sysdeps/m68k/bsd-_setjmp.S
index 69aa7de04c..db777cf67d 100644
--- a/sysdeps/m68k/bsd-_setjmp.S
+++ b/sysdeps/m68k/bsd-_setjmp.S
@@ -23,7 +23,7 @@ Cambridge, MA 02139, USA.  */
 
 #include <sysdep.h>
 
-#ifdef MOTOROLA_SYNTAX
+#if defined (MOTOROLA_SYNTAX) || defined (ELF_SYNTAX)
 #define d0 %d0
 #define d1 %d1
 #define PUSH(reg)	move.l reg, -(%sp)
diff --git a/sysdeps/m68k/bsd-setjmp.S b/sysdeps/m68k/bsd-setjmp.S
index c853516824..c1794978bc 100644
--- a/sysdeps/m68k/bsd-setjmp.S
+++ b/sysdeps/m68k/bsd-setjmp.S
@@ -23,7 +23,7 @@ Cambridge, MA 02139, USA.  */
 
 #include <sysdep.h>
 
-#ifdef MOTOROLA_SYNTAX
+#if defined (MOTOROLA_SYNTAX) || defined (ELF_SYNTAX)
 #define d0 %d0
 #define d1 %d1
 #define PUSH(reg)	move.l reg, -(%sp)
diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h
index 2208cd2259..8cbb97787c 100644
--- a/sysdeps/m68k/dl-machine.h
+++ b/sysdeps/m68k/dl-machine.h
@@ -52,9 +52,22 @@ elf_machine_got (void)
 static inline Elf32_Addr
 elf_machine_load_address (void)
 {
-  ...
+  Elf32_Addr addr;
+  asm ("here:	lea here(%%pc), %0\n"
+       "	sub.l %#here, %0"
+       : "=a" (addr));
+  return addr;
 }
 
+/* The `subl' insn above will contain an R_68K_RELATIVE relocation
+   entry intended to insert the run-time address of the label `here'.
+   This will be the first relocation in the text of the dynamic
+   linker; we skip it to avoid trying to modify read-only text in this
+   early stage.  */
+#define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) \
+  ((dynamic_info)[DT_RELA]->d_un.d_ptr += sizeof (Elf32_Rela), \
+   (dynamic_info)[DT_RELASZ]->d_un.d_val -= sizeof (Elf32_Rela))
+
 /* Perform the relocation specified by RELOC and SYM (which is fully resolved).
    MAP is the object containing the reloc.  */
 
@@ -158,11 +171,13 @@ elf_machine_runtime_setup (struct link_map *l, int lazy)
 	.globl _dl_runtime_resolve
 	.type _dl_runtime_resolve, @function
 _dl_runtime_resolve:
-	| Save %a0 (struct return address).
+	| Save %a0 (struct return address) and %a1.
 	move.l %a0, -(%sp)
+	move.l %a1, -(%sp)
 	| Call the real address resolver.
-	bsr.l fixup
-	| Restore register %a0.
+	jbsr fixup
+	| Restore register %a0 and %a1.
+	move.l (%sp)+, %a1
 	move.l (%sp)+, %a0
 	| Pop parameters
 	addq.l #8, %sp
@@ -170,7 +185,9 @@ _dl_runtime_resolve:
 	jmp (%d0)
 	.size _dl_runtime_resolve, . - _dl_runtime_resolve
 ");
-#define ELF_MACHINE_RUNTIME_FIXUP_ARGS long int save_a0
+#define ELF_MACHINE_RUNTIME_FIXUP_ARGS long int save_a0, long int save_a1
+/* The PLT uses Elf32_Rela relocs.  */
+#define elf_machine_relplt elf_machine_rela
 }