diff options
author | Ed Maste <emaste@FreeBSD.org> | 2016-12-02 14:23:26 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2016-12-02 14:23:26 +0000 |
commit | eeef1833769d407ef2f71f2d85a97c751cd71fc3 (patch) | |
tree | 14837357d5a001bcb86331912670534049b1aa10 /libexec | |
parent | 8e349925f439c439539b1bdb045f5e5e7e0efff8 (diff) | |
download | src-eeef1833769d407ef2f71f2d85a97c751cd71fc3.tar.gz src-eeef1833769d407ef2f71f2d85a97c751cd71fc3.zip |
Retire long-broken/unused static rtld support
rtld-elf has some vestigial support for building as a static executable.
r45501 introduced a partial implementation with a prescient note that it
"might never be enabled." r153515 introduced ELF symbol versioning
support, and removed part of the unused build infrastructure for static
rtld.
GNU ld populates rela relocation addends and GOT entries with the same
values, and rtld's run-time dynamic executable check relied on this.
Alternate toolchains may not populate the GOT entries, which caused
RTLD_IS_DYNAMIC to return false. Simplify rtld by just removing the
unused check.
If we want to restore static rtld support later on we ought to introduce
a build-time #ifdef flag.
PR: 214972
Reviewed by: kan
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8687
Notes
Notes:
svn path=/head/; revision=309411
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/rtld-elf/aarch64/rtld_machdep.h | 1 | ||||
-rw-r--r-- | libexec/rtld-elf/riscv/rtld_machdep.h | 1 | ||||
-rw-r--r-- | libexec/rtld-elf/rtld.c | 27 | ||||
-rw-r--r-- | libexec/rtld-elf/sparc64/rtld_machdep.h | 1 |
4 files changed, 11 insertions, 19 deletions
diff --git a/libexec/rtld-elf/aarch64/rtld_machdep.h b/libexec/rtld-elf/aarch64/rtld_machdep.h index 461014325678..84f060f77062 100644 --- a/libexec/rtld-elf/aarch64/rtld_machdep.h +++ b/libexec/rtld-elf/aarch64/rtld_machdep.h @@ -45,7 +45,6 @@ struct Struct_Obj_Entry; 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, diff --git a/libexec/rtld-elf/riscv/rtld_machdep.h b/libexec/rtld-elf/riscv/rtld_machdep.h index 46387e7bcdd8..4fb494778e38 100644 --- a/libexec/rtld-elf/riscv/rtld_machdep.h +++ b/libexec/rtld-elf/riscv/rtld_machdep.h @@ -52,7 +52,6 @@ uint64_t set_gp(struct Struct_Obj_Entry *obj); __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, diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 24f1bf49ce8f..ce152f8157ff 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -200,9 +200,6 @@ Elf_Sym sym_zero; /* For resolving undefined weak refs. */ 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 @@ init_rtld(caddr_t mapbase, Elf_Auxinfo **aux_info) #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]); diff --git a/libexec/rtld-elf/sparc64/rtld_machdep.h b/libexec/rtld-elf/sparc64/rtld_machdep.h index b53f79795e18..6e86e65b2692 100644 --- a/libexec/rtld-elf/sparc64/rtld_machdep.h +++ b/libexec/rtld-elf/sparc64/rtld_machdep.h @@ -37,7 +37,6 @@ struct Struct_Obj_Entry; /* 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 *, |