Index: head/libexec/rtld-elf/amd64/rtld_machdep.h =================================================================== --- head/libexec/rtld-elf/amd64/rtld_machdep.h +++ head/libexec/rtld-elf/amd64/rtld_machdep.h @@ -35,8 +35,8 @@ 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)) +Elf_Dyn *rtld_dynamic_addr(void); +#define rtld_dynamic(obj) rtld_dynamic_addr() /* Fixup the jump slot at "where" to transfer control to "target". */ static inline Elf_Addr Index: head/libexec/rtld-elf/amd64/rtld_start.S =================================================================== --- head/libexec/rtld-elf/amd64/rtld_start.S +++ head/libexec/rtld-elf/amd64/rtld_start.S @@ -156,4 +156,16 @@ .cfi_endproc .size _rtld_bind_start, . - _rtld_bind_start + .align 4 + .globl rtld_dynamic_addr + .type rtld_dynamic_addr,@function +rtld_dynamic_addr: + .cfi_startproc + .weak _DYNAMIC + .hidden _DYNAMIC + lea _DYNAMIC(%rip),%rax + ret + .cfi_endproc + .size rtld_dynamic_addr, . - rtld_dynamic_addr + .section .note.GNU-stack,"",%progbits