diff options
author | emaste <emaste@FreeBSD.org> | 2017-01-03 15:59:39 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2017-01-03 15:59:39 +0000 |
commit | 5df83a3fc7480f81535cc69515ec073d7a30fbbd (patch) | |
tree | a0400ddf435e410b8e72cce719bbf293f1e3cb59 /libexec | |
parent | fddc6060074fdfdf9d2087cd342da4d1e7ff3708 (diff) | |
download | FreeBSD-src-5df83a3fc7480f81535cc69515ec073d7a30fbbd.zip FreeBSD-src-5df83a3fc7480f81535cc69515ec073d7a30fbbd.tar.gz |
MFC r309411: 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
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 4610143..84f060f 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 46387e7..4fb4947 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 0653a16..a562363 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; @@ -1916,22 +1913,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 b53f797..6e86e65 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 *, |