[uClibc-cvs] uClibc/ldso/ldso/sparc dl-startup.h, 1.4, 1.5 dl-sysdep.h, 1.6, 1.7

Erik Andersen andersen at uclibc.org
Tue Feb 17 10:56:02 UTC 2004


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

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/sparc/dl-sysdep.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- dl-sysdep.h	14 Feb 2004 11:30:38 -0000	1.6
+++ dl-sysdep.h	17 Feb 2004 10:55:59 -0000	1.7
@@ -5,20 +5,10 @@
  */
 #define LINUXBIN
 
-/*
- * Define this if the system uses RELOCA.
- */
+/* Define this if the system uses RELOCA.  */
 #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.  We assume that argc is stored
- * at the word just below the argvp that we return here.
- */
-#define GET_ARGV(ARGVP, ARGS) __asm__("\tadd %%fp,68,%0\n" : "=r" (ARGVP));
-
-/*
  * Initialization sequence for a GOT.  For the Sparc, this points to the
  * PLT, and we need to initialize a couple of the slots.  The PLT should
  * look like:
@@ -36,54 +26,10 @@
    GOT_BASE[3] = (int) MODULE;					\
 }
 
-/*
- * Here is a macro to perform a relocation.  This is only used when
- * bootstrapping the dynamic loader.
- */
-#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \
-	switch(ELF32_R_TYPE((RELP)->r_info)) {		\
-	case R_SPARC_32:				\
-	  *REL = SYMBOL + (RELP)->r_addend;		\
-	  break;					\
-	case R_SPARC_GLOB_DAT:				\
-	  *REL = SYMBOL + (RELP)->r_addend;		\
-	  break;					\
-	case R_SPARC_JMP_SLOT:				\
-	  REL[1] = 0x03000000 | ((SYMBOL >> 10) & 0x3fffff);	\
-	  REL[2] = 0x81c06000 | (SYMBOL & 0x3ff);	\
-	  break;					\
-	case R_SPARC_NONE:				\
-	  break;					\
-        case R_SPARC_WDISP30:				\
-          break;                                        \
-	case R_SPARC_RELATIVE:				\
-	  *REL += (unsigned int) LOAD + (RELP)->r_addend; \
-	  break;					\
-	default:					\
-	  _dl_exit(1);					\
-	}
-
-
-/*
- * Transfer control to the user's application, once the dynamic loader
- * is done.  The crt calls atexit with $g1 if not null, so we need to
- * ensure that it contains NULL.
- */
-
-#define START()		\
-	__asm__ volatile ( \
-	                   "add %%g0,%%g0,%%g1\n\t" \
-			   "jmpl %0, %%o7\n\t"	\
-			   "restore %%g0,%%g0,%%g0\n\t" \
-		    	: /*"=r" (status) */ :	\
-		    	  "r" (_dl_elf_main): "g1", "o0", "o1")
-
-
-
 /* Here we define the magic numbers that this dynamic loader should accept */
-
 #define MAGIC1 EM_SPARC
 #undef  MAGIC2
+
 /* Used for error messages */
 #define ELF_TARGET "Sparc"
 

Index: dl-startup.h
===================================================================
RCS file: /var/cvs/uClibc/ldso/ldso/sparc/dl-startup.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- dl-startup.h	7 Feb 2004 12:26:36 -0000	1.4
+++ dl-startup.h	17 Feb 2004 10:55:59 -0000	1.5
@@ -4,4 +4,59 @@
  * can be done.
  */
 
-#define DL_BOOT(X) void __attribute__ ((unused)) _dl_boot (X)
+#define DL_BOOT(X) __attribute__ ((unused)) void _dl_boot (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.  We assume that argc is stored
+ * at the word just below the argvp that we return here.
+ */
+#define GET_ARGV(ARGVP, ARGS) __asm__("\tadd %%fp,68,%0\n" : "=r" (ARGVP));
+
+/*
+ * Here is a macro to perform a relocation.  This is only used when
+ * bootstrapping the dynamic loader.
+ */
+#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \
+	switch(ELF32_R_TYPE((RELP)->r_info)) {		\
+	case R_SPARC_32:				\
+	  *REL = SYMBOL + (RELP)->r_addend;		\
+	  break;					\
+	case R_SPARC_GLOB_DAT:				\
+	  *REL = SYMBOL + (RELP)->r_addend;		\
+	  break;					\
+	case R_SPARC_JMP_SLOT:				\
+	  REL[1] = 0x03000000 | ((SYMBOL >> 10) & 0x3fffff);	\
+	  REL[2] = 0x81c06000 | (SYMBOL & 0x3ff);	\
+	  break;					\
+	case R_SPARC_NONE:				\
+	  break;					\
+        case R_SPARC_WDISP30:				\
+          break;                                        \
+	case R_SPARC_RELATIVE:				\
+	  *REL += (unsigned int) LOAD + (RELP)->r_addend; \
+	  break;					\
+	default:					\
+	  _dl_exit(1);					\
+	}
+
+
+/*
+ * Transfer control to the user's application, once the dynamic loader
+ * is done.  The crt calls atexit with $g1 if not null, so we need to
+ * ensure that it contains NULL.
+ */
+
+#define START()		\
+	__asm__ volatile ( \
+	                   "add %%g0,%%g0,%%g1\n\t" \
+			   "jmpl %0, %%o7\n\t"	\
+			   "restore %%g0,%%g0,%%g0\n\t" \
+		    	: /*"=r" (status) */ :	\
+		    	  "r" (_dl_elf_main): "g1", "o0", "o1")
+
+
+
+




More information about the uClibc-cvs mailing list