From 7d69aa453630c63bba640d287d0781db518b5a53 Mon Sep 17 00:00:00 2001 From: dfr Date: Mon, 15 Oct 2001 18:48:42 +0000 Subject: Add ia64 support. Various adjustments were made to existing targets to cope with a few interface changes required by the ia64. In particular, function pointers on ia64 need special treatment in rtld. --- libexec/rtld-elf/i386/reloc.c | 5 +++-- libexec/rtld-elf/i386/rtld_machdep.h | 20 ++++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) (limited to 'libexec/rtld-elf/i386') diff --git a/libexec/rtld-elf/i386/reloc.c b/libexec/rtld-elf/i386/reloc.c index aff70b0..3954452 100644 --- a/libexec/rtld-elf/i386/reloc.c +++ b/libexec/rtld-elf/i386/reloc.c @@ -237,7 +237,7 @@ reloc_jmpslots(Obj_Entry *obj) return 0; rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); for (rel = obj->pltrel; rel < rellim; rel++) { - Elf_Addr *where; + Elf_Addr *where, target; const Elf_Sym *def; const Obj_Entry *defobj; @@ -246,7 +246,8 @@ reloc_jmpslots(Obj_Entry *obj) def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, true, NULL); if (def == NULL) return -1; - reloc_jmpslot(where, (Elf_Addr)(defobj->relocbase + def->st_value)); + target = (Elf_Addr)(defobj->relocbase + def->st_value); + reloc_jmpslot(where, target, defobj); } obj->jmpslots_done = true; return 0; diff --git a/libexec/rtld-elf/i386/rtld_machdep.h b/libexec/rtld-elf/i386/rtld_machdep.h index 37a81d3..a26394f 100644 --- a/libexec/rtld-elf/i386/rtld_machdep.h +++ b/libexec/rtld-elf/i386/rtld_machdep.h @@ -29,17 +29,25 @@ #ifndef RTLD_MACHDEP_H #define RTLD_MACHDEP_H 1 +struct Struct_Obj_Entry; + /* Return the address of the .dynamic section in the dynamic linker. */ #define rtld_dynamic(obj) \ ((const Elf_Dyn *)((obj)->relocbase + (Elf_Addr)&_DYNAMIC)) /* Fixup the jump slot at "where" to transfer control to "target". */ -#define reloc_jmpslot(where, target) \ - do { \ - dbg("reloc_jmpslot: *%p = %p", (void *)(where), \ - (void *)(target)); \ - (*(Elf_Addr *)(where) = (Elf_Addr)(target)); \ - } while (0) +static inline Elf_Addr +reloc_jmpslot(Elf_Addr *where, Elf_Addr target, + const struct Struct_Obj_Entry *obj) +{ + dbg("reloc_jmpslot: *%p = %p", (void *)(where), + (void *)(target)); + (*(Elf_Addr *)(where) = (Elf_Addr)(target)); + return target; +} + +#define make_function_pointer(def, defobj) \ + ((defobj)->relocbase + (def)->st_value) static inline void atomic_decr_int(volatile int *p) -- cgit v1.1