summaryrefslogtreecommitdiff
path: root/ldso/ldso/cris
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-02-17 10:55:59 +0000
committerEric Andersen <andersen@codepoet.org>2004-02-17 10:55:59 +0000
commite5649e61768bfd26d48aa44076d2c1e801a3e8cb (patch)
tree948076ae77832a88ff4c774d34983b23dca769f3 /ldso/ldso/cris
parent0dccbee4ebd749c5a3408be7594226db9f9c2005 (diff)
Seperate out the startup stuff from the non-startup stuff.
Begin converting some big ugly macros to inline functions instead
Diffstat (limited to 'ldso/ldso/cris')
-rw-r--r--ldso/ldso/cris/dl-startup.h51
-rw-r--r--ldso/ldso/cris/dl-sysdep.h53
2 files changed, 50 insertions, 54 deletions
diff --git a/ldso/ldso/cris/dl-startup.h b/ldso/ldso/cris/dl-startup.h
index bf7714539..e910c235c 100644
--- a/ldso/ldso/cris/dl-startup.h
+++ b/ldso/ldso/cris/dl-startup.h
@@ -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 @@ asm("" \
);
#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))
+
+
diff --git a/ldso/ldso/cris/dl-sysdep.h b/ldso/ldso/cris/dl-sysdep.h
index baad524ee..aec396441 100644
--- a/ldso/ldso/cris/dl-sysdep.h
+++ b/ldso/ldso/cris/dl-sysdep.h
@@ -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 @@ cris_mod(unsigned long m, unsigned long p)
return m;
}
-
#define do_rem(result, n, base) result = cris_mod(n, base);
/* 8192 bytes alignment */