From 7f637f2bb2ae5510edd8461a7ccc1ab9bb20c34d Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 29 Oct 2001 10:10:10 +0000 Subject: Update rtld for the "new" ia64 ABI. In the old toolchain, the DT_INIT and DT_FINI tags pointed to fptr records. In 2.11.2, it points to the actuall address of the function. On IA64 you cannot just take an address of a function, store it in a function pointer variable and call it.. the function pointers point to a fptr data block that has the target gp and address in it. This is absolutely necessary for using the in-tree binutils toolchain, but (unfortunately) will not work with old shared libraries. Save your old ld-elf.so.1 if you want to use old ones still. Do not mix-and-match. This is a no-op change for i386 and alpha. Reviewed by: dfr --- libexec/rtld-elf/ia64/reloc.c | 12 ++++++++++++ libexec/rtld-elf/ia64/rtld_machdep.h | 1 + 2 files changed, 13 insertions(+) (limited to 'libexec/rtld-elf/ia64') diff --git a/libexec/rtld-elf/ia64/reloc.c b/libexec/rtld-elf/ia64/reloc.c index 86b7ce6..8ec6860 100644 --- a/libexec/rtld-elf/ia64/reloc.c +++ b/libexec/rtld-elf/ia64/reloc.c @@ -407,6 +407,18 @@ make_function_pointer(const Elf_Sym *sym, const Obj_Entry *obj) return fptrs[index]; } +void +call_initfini_pointer(const Obj_Entry *obj, Elf_Addr target) +{ + struct fptr fptr; + + fptr.gp = (Elf_Addr) obj->pltgot; + fptr.target = target; + dbg(" initfini: target=%p, gp=%p", + (void *) fptr.target, (void *) fptr.gp); + ((InitFunc) &fptr)(); +} + /* Initialize the special PLT entries. */ void init_pltgot(Obj_Entry *obj) diff --git a/libexec/rtld-elf/ia64/rtld_machdep.h b/libexec/rtld-elf/ia64/rtld_machdep.h index 74a3f62..b4f8e2c 100644 --- a/libexec/rtld-elf/ia64/rtld_machdep.h +++ b/libexec/rtld-elf/ia64/rtld_machdep.h @@ -47,6 +47,7 @@ struct Struct_Obj_Entry; Elf_Addr reloc_jmpslot(Elf_Addr *, Elf_Addr, const struct Struct_Obj_Entry *); void *make_function_pointer(const Elf_Sym *, const struct Struct_Obj_Entry *); +void call_initfini_pointer(const struct Struct_Obj_Entry *, Elf_Addr); /* Atomic operations. */ int cmp0_and_store_int(volatile int *, int); -- cgit v1.1