[uClibc-cvs] uClibc/ldso/ldso/cris dl-startup.h, 1.5, 1.6 dl-sysdep.h, 1.5, 1.6

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


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

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/cris/dl-sysdep.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- dl-sysdep.h	14 Feb 2004 11:30:32 -0000	1.5
+++ dl-sysdep.h	17 Feb 2004 10:55:54 -0000	1.6
@@ -1,63 +1,13 @@
 /* CRIS can never use Elf32_Rel relocations. */
 #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)
-
-/*
- * Initialization sequence for a GOT.
- */
+/* Initialization sequence for the GOT.  */
 #define INIT_GOT(GOT_BASE,MODULE)				\
 {								\
 	GOT_BASE[1] = (unsigned long) MODULE; 			\
 	GOT_BASE[2] = (unsigned long) _dl_linux_resolve; 	\
 }
 
-/*
- * 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)	\
-	switch (ELF32_R_TYPE((RELP)->r_info)) {				\
-		case R_CRIS_GLOB_DAT:					\
-		case R_CRIS_JUMP_SLOT:					\
-		case R_CRIS_32:						\
-			*REL = SYMBOL;					\
-			break;						\
-		case R_CRIS_16_PCREL:					\
-			*(short *) *REL = SYMBOL + (RELP)->r_addend - *REL - 2;	\
-			break;						\
-		case R_CRIS_32_PCREL:					\
-			*REL = SYMBOL + (RELP)->r_addend - *REL - 4;	\
-			break;						\
-		case R_CRIS_NONE:					\
-			break;						\
-		case R_CRIS_RELATIVE:					\
-			*REL = (unsigned long) LOAD + (RELP)->r_addend;	\
-			break;						\
-		default:						\
-			_dl_exit(1);					\
-			break;						\
-	}
-
-/*
- * Transfer control to the user's application once the dynamic loader
- * is done. This routine has to exit the current function, then call
- * _dl_elf_main.
- */
-#define START() __asm__ volatile ("moveq 0,$r8\n\t" \
-				  "move $r8,$srp\n\t" \
-				  "move.d %1,$sp\n\t" \
-				  "jump %0\n\t" \
-				  : : "r" (_dl_elf_main), "r" (args))
-
 /* Defined some magic numbers that this ld.so should accept. */
 #define MAGIC1 EM_CRIS
 #undef MAGIC2
@@ -103,7 +53,6 @@
 
 	return m;
 }
-
 #define do_rem(result, n, base) result = cris_mod(n, base);
 
 /* 8192 bytes alignment */

Index: dl-startup.h
===================================================================
RCS file: /var/cvs/uClibc/ldso/ldso/cris/dl-startup.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- dl-startup.h	7 Feb 2004 12:26:14 -0000	1.5
+++ dl-startup.h	17 Feb 2004 10:55:54 -0000	1.6
@@ -1,7 +1,9 @@
 /*
- * This code fix the stack pointer so that the dynamic linker
- * can find argc, argv and auxvt (Auxillary Vector Table).
+ * Architecture specific code used by dl-startup.c
  */
+
+/* This code fixes the stack pointer so that the dynamic linker
+ * can find argc, argv and auxvt (Auxillary Vector Table).  */
 asm(""					\
 "	.text\n"			\
 "	.globl _dl_boot\n"		\
@@ -14,3 +16,48 @@
 );
 
 #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)
+
+/* Handle relocation of the symbols in the dynamic loader. */
+static inline
+void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr,
+	unsigned long symbol_addr, unsigned long load_addr, Elf32_Sym *symtab)
+{
+	switch (ELF32_R_TYPE(rpnt->r_info)) {
+		case R_CRIS_GLOB_DAT:
+		case R_CRIS_JUMP_SLOT:
+		case R_CRIS_32:
+			*reloc_addr = symbol_addr;
+			break;
+		case R_CRIS_16_PCREL:
+			*(short *) *reloc_addr = symbol_addr + rpnt->r_addend - *reloc_addr - 2;
+			break;
+		case R_CRIS_32_PCREL:
+			*reloc_addr = symbol_addr + rpnt->r_addend - *reloc_addr - 4;
+			break;
+		case R_CRIS_NONE:
+			break;
+		case R_CRIS_RELATIVE:
+			*reloc_addr = load_addr + rpnt->r_addend;
+			break;
+		default:
+			_dl_exit(1);
+			break;
+	}
+}
+
+/* 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.  */
+#define START() __asm__ volatile ("moveq 0,$r8\n\t" \
+				  "move $r8,$srp\n\t" \
+				  "move.d %1,$sp\n\t" \
+				  "jump %0\n\t" \
+				  : : "r" (_dl_elf_main), "r" (args))
+
+




More information about the uClibc-cvs mailing list