diff options
author | Eric Andersen <andersen@codepoet.org> | 2003-12-17 08:05:44 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2003-12-17 08:05:44 +0000 |
commit | 0a0a648ed65342e7bb71608894c308bfb6143a4d (patch) | |
tree | 5b9bb5746fdf2c4384c3bf57dd3ca3bb6ce804c8 | |
parent | e2ec80efb27158e6a367238227ddca876054ae9e (diff) |
Patch from Paul Mundt <lethal@linux-sh.org>:
For sh64 we need implicit access to the symtab, primarily to get at the
->st_other value. This presently isn't possible, as PERFORM_BOOTSTRAP_RELOC()
is invoked as such:
PERFORM_BOOTSTRAP_RELOC(rpnt, reloc_addr, symbol_addr, load_addr);
while we can easily get the symtab_index value from rpnt->r_info, this still
doesn't buy us easy access to the actual table. As such, I've modified
PERFORM_BOOTSTRAP_RELOC() to take an additional SYMTAB argument. Most
architectures aren't going to care about this, but unfortunately we don't
have any other options for sh64.
The following patch fixes up the API for what we need for sh64, and updates
the other architectures appropriately.
-rw-r--r-- | ldso/ldso/arm/dl-sysdep.h | 2 | ||||
-rw-r--r-- | ldso/ldso/arm/ld_sysdep.h | 2 | ||||
-rw-r--r-- | ldso/ldso/cris/dl-sysdep.h | 2 | ||||
-rw-r--r-- | ldso/ldso/cris/ld_sysdep.h | 2 | ||||
-rw-r--r-- | ldso/ldso/i386/dl-sysdep.h | 50 | ||||
-rw-r--r-- | ldso/ldso/i386/ld_sysdep.h | 50 | ||||
-rw-r--r-- | ldso/ldso/ldso.c | 12 | ||||
-rw-r--r-- | ldso/ldso/m68k/dl-sysdep.h | 2 | ||||
-rw-r--r-- | ldso/ldso/m68k/ld_sysdep.h | 2 | ||||
-rw-r--r-- | ldso/ldso/mips/dl-sysdep.h | 2 | ||||
-rw-r--r-- | ldso/ldso/mips/ld_sysdep.h | 2 | ||||
-rw-r--r-- | ldso/ldso/powerpc/dl-sysdep.h | 2 | ||||
-rw-r--r-- | ldso/ldso/powerpc/ld_sysdep.h | 2 | ||||
-rw-r--r-- | ldso/ldso/sh/dl-sysdep.h | 2 | ||||
-rw-r--r-- | ldso/ldso/sh/ld_sysdep.h | 2 | ||||
-rw-r--r-- | ldso/ldso/sparc/dl-sysdep.h | 2 | ||||
-rw-r--r-- | ldso/ldso/sparc/ld_sysdep.h | 2 |
17 files changed, 71 insertions, 69 deletions
diff --git a/ldso/ldso/arm/dl-sysdep.h b/ldso/ldso/arm/dl-sysdep.h index ef994caad..04e504eda 100644 --- a/ldso/ldso/arm/dl-sysdep.h +++ b/ldso/ldso/arm/dl-sysdep.h @@ -31,7 +31,7 @@ * SYMBOL is the symbol involved in the relocation, and LOAD is the * load address. */ -#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD) \ +#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \ switch(ELF32_R_TYPE((RELP)->r_info)){ \ case R_ARM_ABS32: \ *REL += SYMBOL; \ diff --git a/ldso/ldso/arm/ld_sysdep.h b/ldso/ldso/arm/ld_sysdep.h index ef994caad..04e504eda 100644 --- a/ldso/ldso/arm/ld_sysdep.h +++ b/ldso/ldso/arm/ld_sysdep.h @@ -31,7 +31,7 @@ * SYMBOL is the symbol involved in the relocation, and LOAD is the * load address. */ -#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD) \ +#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \ switch(ELF32_R_TYPE((RELP)->r_info)){ \ case R_ARM_ABS32: \ *REL += SYMBOL; \ diff --git a/ldso/ldso/cris/dl-sysdep.h b/ldso/ldso/cris/dl-sysdep.h index cf36752fb..c127076ff 100644 --- a/ldso/ldso/cris/dl-sysdep.h +++ b/ldso/ldso/cris/dl-sysdep.h @@ -24,7 +24,7 @@ * SYMBOL is the symbol involved in the relocation, and LOAD is the * load address. */ -#define PERFORM_BOOTSTRAP_RELOC(RELP, REL, SYMBOL, LOAD) \ +#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: \ diff --git a/ldso/ldso/cris/ld_sysdep.h b/ldso/ldso/cris/ld_sysdep.h index cf36752fb..c127076ff 100644 --- a/ldso/ldso/cris/ld_sysdep.h +++ b/ldso/ldso/cris/ld_sysdep.h @@ -24,7 +24,7 @@ * SYMBOL is the symbol involved in the relocation, and LOAD is the * load address. */ -#define PERFORM_BOOTSTRAP_RELOC(RELP, REL, SYMBOL, LOAD) \ +#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: \ diff --git a/ldso/ldso/i386/dl-sysdep.h b/ldso/ldso/i386/dl-sysdep.h index 7c0f884df..f39a1966c 100644 --- a/ldso/ldso/i386/dl-sysdep.h +++ b/ldso/ldso/i386/dl-sysdep.h @@ -18,11 +18,11 @@ /* * Initialization sequence for a GOT. */ -#define INIT_GOT(GOT_BASE,MODULE) \ -{ \ - GOT_BASE[2] = (unsigned long) _dl_linux_resolve; \ - GOT_BASE[1] = (unsigned long) MODULE; \ -} +#define INIT_GOT(GOT_BASE,MODULE) \ +do { \ + GOT_BASE[2] = (unsigned long) _dl_linux_resolve; \ + GOT_BASE[1] = (unsigned long) MODULE; \ +} while(0) /* * Here is a macro to perform a relocation. This is only used when @@ -31,23 +31,23 @@ * SYMBOL is the symbol involved in the relocation, and LOAD is the * load address. */ -#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD) \ - switch(ELF32_R_TYPE((RELP)->r_info)){ \ - case R_386_32: \ - *REL += SYMBOL; \ - break; \ - case R_386_PC32: \ - *REL += SYMBOL - (unsigned long) REL; \ - break; \ - case R_386_GLOB_DAT: \ - case R_386_JMP_SLOT: \ - *REL = SYMBOL; \ - break; \ - case R_386_RELATIVE: \ - *REL += (unsigned long) LOAD; \ - break; \ - default: \ - _dl_exit(1); \ +#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \ + switch(ELF32_R_TYPE((RELP)->r_info)){ \ + case R_386_32: \ + *REL += SYMBOL; \ + break; \ + case R_386_PC32: \ + *REL += SYMBOL - (unsigned long) REL; \ + break; \ + case R_386_GLOB_DAT: \ + case R_386_JMP_SLOT: \ + *REL = SYMBOL; \ + break; \ + case R_386_RELATIVE: \ + *REL += (unsigned long) LOAD; \ + break; \ + default: \ + _dl_exit(1); \ } @@ -56,9 +56,9 @@ * is done. This routine has to exit the current function, then * call the _dl_elf_main function. */ -#define START() \ - __asm__ volatile ("leave\n\t" \ - "jmp *%%eax\n\t" \ +#define START() \ + __asm__ volatile ("leave\n\t" \ + "jmp *%%eax\n\t" \ : "=a" (status) : "a" (_dl_elf_main)) diff --git a/ldso/ldso/i386/ld_sysdep.h b/ldso/ldso/i386/ld_sysdep.h index 7c0f884df..f39a1966c 100644 --- a/ldso/ldso/i386/ld_sysdep.h +++ b/ldso/ldso/i386/ld_sysdep.h @@ -18,11 +18,11 @@ /* * Initialization sequence for a GOT. */ -#define INIT_GOT(GOT_BASE,MODULE) \ -{ \ - GOT_BASE[2] = (unsigned long) _dl_linux_resolve; \ - GOT_BASE[1] = (unsigned long) MODULE; \ -} +#define INIT_GOT(GOT_BASE,MODULE) \ +do { \ + GOT_BASE[2] = (unsigned long) _dl_linux_resolve; \ + GOT_BASE[1] = (unsigned long) MODULE; \ +} while(0) /* * Here is a macro to perform a relocation. This is only used when @@ -31,23 +31,23 @@ * SYMBOL is the symbol involved in the relocation, and LOAD is the * load address. */ -#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD) \ - switch(ELF32_R_TYPE((RELP)->r_info)){ \ - case R_386_32: \ - *REL += SYMBOL; \ - break; \ - case R_386_PC32: \ - *REL += SYMBOL - (unsigned long) REL; \ - break; \ - case R_386_GLOB_DAT: \ - case R_386_JMP_SLOT: \ - *REL = SYMBOL; \ - break; \ - case R_386_RELATIVE: \ - *REL += (unsigned long) LOAD; \ - break; \ - default: \ - _dl_exit(1); \ +#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \ + switch(ELF32_R_TYPE((RELP)->r_info)){ \ + case R_386_32: \ + *REL += SYMBOL; \ + break; \ + case R_386_PC32: \ + *REL += SYMBOL - (unsigned long) REL; \ + break; \ + case R_386_GLOB_DAT: \ + case R_386_JMP_SLOT: \ + *REL = SYMBOL; \ + break; \ + case R_386_RELATIVE: \ + *REL += (unsigned long) LOAD; \ + break; \ + default: \ + _dl_exit(1); \ } @@ -56,9 +56,9 @@ * is done. This routine has to exit the current function, then * call the _dl_elf_main function. */ -#define START() \ - __asm__ volatile ("leave\n\t" \ - "jmp *%%eax\n\t" \ +#define START() \ + __asm__ volatile ("leave\n\t" \ + "jmp *%%eax\n\t" \ : "=a" (status) : "a" (_dl_elf_main)) diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index a5826b671..601da6283 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -287,7 +287,7 @@ LD_BOOT(unsigned long args) __asm__("\tbl _GLOBAL_OFFSET_TABLE_-4@local\n\t":"=l"(got)); #elif defined(__mips__) __asm__("\tmove %0, $28\n\tsubu %0,%0,0x7ff0\n\t":"=r"(got)); -#elif defined(__sh__) +#elif defined(__sh__) && !defined(__SH5__) __asm__( " mov.l 1f, %0\n" " mova 1f, r0\n" @@ -583,11 +583,13 @@ LD_BOOT(unsigned long args) SEND_STDERR(strtab + symtab[symtab_index].st_name); SEND_STDERR("\n"); #endif + PERFORM_BOOTSTRAP_RELOC(rpnt, reloc_addr, symbol_addr, load_addr, &symtab[symtab_index]); + } else { + /* + * Use this machine-specific macro to perform the actual relocation. + */ + PERFORM_BOOTSTRAP_RELOC(rpnt, reloc_addr, symbol_addr, load_addr, NULL); } - /* - * Use this machine-specific macro to perform the actual relocation. - */ - PERFORM_BOOTSTRAP_RELOC(rpnt, reloc_addr, symbol_addr, load_addr); } } diff --git a/ldso/ldso/m68k/dl-sysdep.h b/ldso/ldso/m68k/dl-sysdep.h index 2a8dcca5f..2cbc7d46b 100644 --- a/ldso/ldso/m68k/dl-sysdep.h +++ b/ldso/ldso/m68k/dl-sysdep.h @@ -22,7 +22,7 @@ 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) \ +#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \ switch (ELF32_R_TYPE ((RELP)->r_info)) \ { \ case R_68K_8: \ diff --git a/ldso/ldso/m68k/ld_sysdep.h b/ldso/ldso/m68k/ld_sysdep.h index 2a8dcca5f..2cbc7d46b 100644 --- a/ldso/ldso/m68k/ld_sysdep.h +++ b/ldso/ldso/m68k/ld_sysdep.h @@ -22,7 +22,7 @@ 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) \ +#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \ switch (ELF32_R_TYPE ((RELP)->r_info)) \ { \ case R_68K_8: \ diff --git a/ldso/ldso/mips/dl-sysdep.h b/ldso/ldso/mips/dl-sysdep.h index 6b87e6578..17ce7cf71 100644 --- a/ldso/ldso/mips/dl-sysdep.h +++ b/ldso/ldso/mips/dl-sysdep.h @@ -86,7 +86,7 @@ do { \ * 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) \ +#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \ switch(ELF32_R_TYPE((RELP)->r_info)) { \ case R_MIPS_REL32: \ if (symtab_index) { \ diff --git a/ldso/ldso/mips/ld_sysdep.h b/ldso/ldso/mips/ld_sysdep.h index 6b87e6578..17ce7cf71 100644 --- a/ldso/ldso/mips/ld_sysdep.h +++ b/ldso/ldso/mips/ld_sysdep.h @@ -86,7 +86,7 @@ do { \ * 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) \ +#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \ switch(ELF32_R_TYPE((RELP)->r_info)) { \ case R_MIPS_REL32: \ if (symtab_index) { \ diff --git a/ldso/ldso/powerpc/dl-sysdep.h b/ldso/ldso/powerpc/dl-sysdep.h index abd426830..da6630428 100644 --- a/ldso/ldso/powerpc/dl-sysdep.h +++ b/ldso/ldso/powerpc/dl-sysdep.h @@ -71,7 +71,7 @@ * load address. */ // finaladdr = LOAD ? -#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD) \ +#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \ {int type=ELF32_R_TYPE((RELP)->r_info); \ if(type==R_PPC_NONE){ \ }else if(type==R_PPC_ADDR32){ \ diff --git a/ldso/ldso/powerpc/ld_sysdep.h b/ldso/ldso/powerpc/ld_sysdep.h index abd426830..da6630428 100644 --- a/ldso/ldso/powerpc/ld_sysdep.h +++ b/ldso/ldso/powerpc/ld_sysdep.h @@ -71,7 +71,7 @@ * load address. */ // finaladdr = LOAD ? -#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD) \ +#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \ {int type=ELF32_R_TYPE((RELP)->r_info); \ if(type==R_PPC_NONE){ \ }else if(type==R_PPC_ADDR32){ \ diff --git a/ldso/ldso/sh/dl-sysdep.h b/ldso/ldso/sh/dl-sysdep.h index 70241e2d7..cd110895c 100644 --- a/ldso/ldso/sh/dl-sysdep.h +++ b/ldso/ldso/sh/dl-sysdep.h @@ -31,7 +31,7 @@ * SYMBOL is the symbol involved in the relocation, and LOAD is the * load address. */ -#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD) \ +#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \ switch(ELF32_R_TYPE((RELP)->r_info)){ \ case R_SH_REL32: \ *(REL) = (SYMBOL) + (RELP)->r_addend \ diff --git a/ldso/ldso/sh/ld_sysdep.h b/ldso/ldso/sh/ld_sysdep.h index 70241e2d7..cd110895c 100644 --- a/ldso/ldso/sh/ld_sysdep.h +++ b/ldso/ldso/sh/ld_sysdep.h @@ -31,7 +31,7 @@ * SYMBOL is the symbol involved in the relocation, and LOAD is the * load address. */ -#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD) \ +#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \ switch(ELF32_R_TYPE((RELP)->r_info)){ \ case R_SH_REL32: \ *(REL) = (SYMBOL) + (RELP)->r_addend \ diff --git a/ldso/ldso/sparc/dl-sysdep.h b/ldso/ldso/sparc/dl-sysdep.h index a5773111b..1930a937f 100644 --- a/ldso/ldso/sparc/dl-sysdep.h +++ b/ldso/ldso/sparc/dl-sysdep.h @@ -40,7 +40,7 @@ * 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) \ +#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; \ diff --git a/ldso/ldso/sparc/ld_sysdep.h b/ldso/ldso/sparc/ld_sysdep.h index a5773111b..1930a937f 100644 --- a/ldso/ldso/sparc/ld_sysdep.h +++ b/ldso/ldso/sparc/ld_sysdep.h @@ -40,7 +40,7 @@ * 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) \ +#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; \ |