diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2002-04-29 15:52:31 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2002-04-29 15:52:31 +0000 |
commit | be5da28bf760481cf2c10351d5815e8673d7a7f6 (patch) | |
tree | 7ea6c0c0f30358f6edcc88bdb06aa9c7e65ddbdd | |
parent | 0debf8d70e6d5f23184b5e925bfe13bd4ecf0ce3 (diff) |
Clean up RELOC_RELATIVE reloction type, do correct relocation instead
of incorrect symbol handling for it. RELOC_RELA() is not a macro, so
remove extra () from the code, try to print error and exit if unknown
relocation type is encountered.
-rw-r--r-- | libexec/ld.so/powerpc/archdep.h | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/libexec/ld.so/powerpc/archdep.h b/libexec/ld.so/powerpc/archdep.h index 299f635bad9..d544e286524 100644 --- a/libexec/ld.so/powerpc/archdep.h +++ b/libexec/ld.so/powerpc/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.4 2002/02/21 23:17:53 drahn Exp $ */ +/* $OpenBSD: archdep.h,v 1.5 2002/04/29 15:52:30 drahn Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -69,19 +69,12 @@ _dl_dcbf(Elf32_Addr *addr) } static inline void -RELOC_RELA(Elf32_Rela *r, - const Elf32_Sym *s, Elf32_Addr *p, int v) +RELOC_RELA(Elf32_Rela *r, const Elf32_Sym *s, Elf32_Addr *p, unsigned long v) { - if(ELF32_R_TYPE((r)->r_info) == RELOC_RELATIVE) { - if((ELF32_ST_BIND((s)->st_info) == STB_LOCAL) && - ((ELF32_ST_TYPE((s)->st_info) == STT_SECTION) || - (ELF32_ST_TYPE((s)->st_info) == STT_NOTYPE)) ) { - *(p) = (v) + (r)->r_addend; - } else { - *(p) = (v) + (s)->st_value + (r)->r_addend; - } - } else if(ELF32_R_TYPE((r)->r_info) == RELOC_JMP_SLOT) { - Elf32_Addr val = (v) + (s)->st_value + (r)->r_addend - + if(ELF32_R_TYPE(r->r_info) == RELOC_RELATIVE) { + *p = v + r->r_addend; + } else if(ELF32_R_TYPE(r->r_info) == RELOC_JMP_SLOT) { + Elf32_Addr val = v + s->st_value + r->r_addend - (Elf32_Addr)(p); if (((val & 0xfe000000) != 0) && ((val & 0xfe000000) != 0xfe000000)) @@ -91,12 +84,14 @@ RELOC_RELA(Elf32_Rela *r, } val &= ~0xfc000000; val |= 0x48000000; - *(p) = val; + *p = val; _dl_dcbf(p); } else if(ELF32_R_TYPE((r)->r_info) == RELOC_GLOB_DAT) { - *(p) = (v) + (s)->st_value + (r)->r_addend; + *p = v + s->st_value + r->r_addend; } else { - /* error */ + /* XXX - printf might not work here, but we give it a shot. */ + _dl_printf("Unknown bootstrap relocation.\n"); + _dl_exit(6); } } |