[uClibc-cvs] uClibc/ldso/ldso/powerpc dl-startup.h, 1.8, 1.9 dl-sysdep.h, 1.10, 1.11

Erik Andersen andersen at uclibc.org
Tue Feb 17 10:55:58 UTC 2004


Update of /var/cvs/uClibc/ldso/ldso/powerpc
In directory nail:/tmp/cvs-serv25724/powerpc

Modified Files:
	dl-startup.h dl-sysdep.h 
Log Message:
Seperate out the startup stuff from the non-startup stuff.
Begin converting some big ugly macros to inline functions
instead


Index: dl-sysdep.h
===================================================================
RCS file: /var/cvs/uClibc/ldso/ldso/powerpc/dl-sysdep.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- dl-sysdep.h	14 Feb 2004 11:30:34 -0000	1.10
+++ dl-sysdep.h	17 Feb 2004 10:55:56 -0000	1.11
@@ -9,13 +9,6 @@
 #define ELF_USES_RELOCA
 
 /*
- * Get a pointer to the argv array.  On many platforms this can be just
- * the address if the first argument, on other platforms we need to
- * do something a little more subtle here.
- */
-#define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) ARGS)+1)
-
-/*
  * Initialization sequence for a GOT.
  */
 #define INIT_GOT(GOT_BASE,MODULE)  _dl_init_got(GOT_BASE,MODULE)
@@ -63,50 +56,6 @@
 #define PPC_ICBI(where) asm volatile ("icbi 0,%0" : : "r"(where) : "memory")
 #define PPC_DIE asm volatile ("tweq 0,0")
 
-/*
- * Here is a macro to perform a relocation.  This is only used when
- * bootstrapping the dynamic loader.  RELP is the relocation that we
- * are performing, REL is the pointer to the address we are relocating.
- * SYMBOL is the symbol involved in the relocation, and LOAD is the
- * load address.
- */
-#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \
-	{int type=ELF32_R_TYPE((RELP)->r_info);		\
-	 Elf32_Addr finaladdr=(SYMBOL)+(RELP)->r_addend;\
-	if (type==R_PPC_RELATIVE) {			\
-		*REL=(Elf32_Word)(LOAD)+(RELP)->r_addend;\
-	} else if (type==R_PPC_JMP_SLOT) {		\
-		Elf32_Sword delta=finaladdr-(Elf32_Word)(REL);\
-		*REL=OPCODE_B(delta);			\
-	} else if (type==R_PPC_ADDR32) {		\
-		*REL=finaladdr;				\
-	} else {					\
-	  _dl_exit(100+ELF32_R_TYPE((RELP)->r_info));	\
-	}						\
-	PPC_DCBST(REL); PPC_SYNC; PPC_ICBI(REL);	\
-	}
-/*
- * Transfer control to the user's application, once the dynamic loader
- * is done.  This routine has to exit the current function, then 
- * call the _dl_elf_main function.
- */
-
-/* hgb at 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.
- */
-#define START()		\
-	__asm__ volatile ( \
-		    "addi 1,%1,0\n\t" \
-		    "mtlr %0\n\t" \
-		    "blrl\n\t"	\
-		    : : "r" (_dl_elf_main), "r" (args) \
-		    : "r0")
-
-
 /* Here we define the magic numbers that this dynamic loader should accept */
 
 #define MAGIC1 EM_PPC

Index: dl-startup.h
===================================================================
RCS file: /var/cvs/uClibc/ldso/ldso/powerpc/dl-startup.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- dl-startup.h	7 Feb 2004 12:26:26 -0000	1.8
+++ dl-startup.h	17 Feb 2004 10:55:56 -0000	1.9
@@ -18,3 +18,56 @@
 );
 
 #define DL_BOOT(X) static void __attribute__ ((unused)) _dl_boot2(X)
+
+/*
+ * Get a pointer to the argv array.  On many platforms this can be just
+ * the address if the first argument, on other platforms we need to
+ * do something a little more subtle here.
+ */
+#define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) ARGS)+1)
+
+/*
+ * Here is a macro to perform a relocation.  This is only used when
+ * bootstrapping the dynamic loader.  RELP is the relocation that we
+ * are performing, REL is the pointer to the address we are relocating.
+ * SYMBOL is the symbol involved in the relocation, and LOAD is the
+ * load address.
+ */
+#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \
+	{int type=ELF32_R_TYPE((RELP)->r_info);		\
+	 Elf32_Addr finaladdr=(SYMBOL)+(RELP)->r_addend;\
+	if (type==R_PPC_RELATIVE) {			\
+		*REL=(Elf32_Word)(LOAD)+(RELP)->r_addend;\
+	} else if (type==R_PPC_JMP_SLOT) {		\
+		Elf32_Sword delta=finaladdr-(Elf32_Word)(REL);\
+		*REL=OPCODE_B(delta);			\
+	} else if (type==R_PPC_ADDR32) {		\
+		*REL=finaladdr;				\
+	} else {					\
+	  _dl_exit(100+ELF32_R_TYPE((RELP)->r_info));	\
+	}						\
+	PPC_DCBST(REL); PPC_SYNC; PPC_ICBI(REL);	\
+	}
+/*
+ * Transfer control to the user's application, once the dynamic loader
+ * is done.  This routine has to exit the current function, then
+ * call the _dl_elf_main function.
+ */
+
+/* hgb at 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.
+ */
+#define START()		\
+	__asm__ volatile ( \
+		    "addi 1,%1,0\n\t" \
+		    "mtlr %0\n\t" \
+		    "blrl\n\t"	\
+		    : : "r" (_dl_elf_main), "r" (args) \
+		    : "r0")
+
+
+




More information about the uClibc-cvs mailing list