Jelajahi Sumber

Joakim Tjernlund writes:

Hi

I just noticed that gcc has an "b"(Address base register) operand that
will match all "r" registers but r0. It is a better fix then adding
r0 to the clobber list.

What do you think?
Eric Andersen 20 tahun lalu
induk
melakukan
38cd8e780f
1 mengubah file dengan 4 tambahan dan 8 penghapusan
  1. 4 8
      ldso/ldso/powerpc/dl-startup.h

+ 4 - 8
ldso/ldso/powerpc/dl-startup.h

@@ -54,20 +54,16 @@ asm("" \
  * call the _dl_elf_main function.
  */
 
-/* hgb@ifi.uio.no:
- * Adding a clobber list consisting of r0 for %1.  addi on PowerPC
- * takes a register as the second argument, but if the register is
- * r0, the value 0 is used instead.  If r0 is used here, the stack
- * pointer (r1) will be zeroed, and the dynamically linked
- * application will seg.fault immediatly when receiving control.
+/*
+ * Use "b"(Address base register) operand for %1 since "b" excludes
+ * r0 which is important for the addi instruction in this case. 
  */
 #define START()		\
 	__asm__ volatile ( \
 		    "addi 1,%1,0\n\t" \
 		    "mtlr %0\n\t" \
 		    "blrl\n\t"	\
-		    : : "r" (_dl_elf_main), "r" (args) \
-		    : "r0")
+		    : : "r" (_dl_elf_main), "b" (args))