Index: head/libexec/rtld-elf/aarch64/rtld_machdep.h =================================================================== --- head/libexec/rtld-elf/aarch64/rtld_machdep.h +++ head/libexec/rtld-elf/aarch64/rtld_machdep.h @@ -45,7 +45,6 @@ asm volatile("adr %0, _DYNAMIC" : "=&r"(_dynamic_addr)); \ (const Elf_Dyn *)_dynamic_addr; \ }) -#define RTLD_IS_DYNAMIC() (1) Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const struct Struct_Obj_Entry *defobj, Index: head/libexec/rtld-elf/riscv/rtld_machdep.h =================================================================== --- head/libexec/rtld-elf/riscv/rtld_machdep.h +++ head/libexec/rtld-elf/riscv/rtld_machdep.h @@ -52,7 +52,6 @@ __asm __volatile("lla %0, _DYNAMIC" : "=r"(_dynamic_addr)); \ (const Elf_Dyn *)_dynamic_addr; \ }) -#define RTLD_IS_DYNAMIC() (1) Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const struct Struct_Obj_Entry *defobj, Index: head/libexec/rtld-elf/rtld.c =================================================================== --- head/libexec/rtld-elf/rtld.c +++ head/libexec/rtld-elf/rtld.c @@ -200,9 +200,6 @@ extern Elf_Dyn _DYNAMIC; #pragma weak _DYNAMIC -#ifndef RTLD_IS_DYNAMIC -#define RTLD_IS_DYNAMIC() (&_DYNAMIC != NULL) -#endif int dlclose(void *) __exported; char *dlerror(void) __exported; @@ -1920,22 +1917,20 @@ #ifdef PIC objtmp.relocbase = mapbase; #endif - if (RTLD_IS_DYNAMIC()) { - objtmp.dynamic = rtld_dynamic(&objtmp); - digest_dynamic1(&objtmp, 1, &dyn_rpath, &dyn_soname, &dyn_runpath); - assert(objtmp.needed == NULL); + + objtmp.dynamic = rtld_dynamic(&objtmp); + digest_dynamic1(&objtmp, 1, &dyn_rpath, &dyn_soname, &dyn_runpath); + assert(objtmp.needed == NULL); #if !defined(__mips__) - /* MIPS has a bogus DT_TEXTREL. */ - assert(!objtmp.textrel); + /* MIPS has a bogus DT_TEXTREL. */ + assert(!objtmp.textrel); #endif + /* + * Temporarily put the dynamic linker entry into the object list, so + * that symbols can be found. + */ + relocate_objects(&objtmp, true, &objtmp, 0, NULL); - /* - * Temporarily put the dynamic linker entry into the object list, so - * that symbols can be found. - */ - - relocate_objects(&objtmp, true, &objtmp, 0, NULL); - } ehdr = (Elf_Ehdr *)mapbase; objtmp.phdr = (Elf_Phdr *)((char *)mapbase + ehdr->e_phoff); objtmp.phsize = ehdr->e_phnum * sizeof(objtmp.phdr[0]); Index: head/libexec/rtld-elf/sparc64/rtld_machdep.h =================================================================== --- head/libexec/rtld-elf/sparc64/rtld_machdep.h +++ head/libexec/rtld-elf/sparc64/rtld_machdep.h @@ -37,7 +37,6 @@ /* Return the address of the .dynamic section in the dynamic linker. */ Elf_Dyn *rtld_dynamic_addr(void); #define rtld_dynamic(obj) rtld_dynamic_addr() -#define RTLD_IS_DYNAMIC() (rtld_dynamic_addr() != NULL) Elf_Addr reloc_jmpslot(Elf_Addr *, Elf_Addr, const struct Struct_Obj_Entry *,