1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-05 12:56:08 +00:00

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
This commit is contained in:
Ed Maste 2016-12-02 14:23:26 +00:00
parent 8e349925f4
commit eeef183376
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=309411
4 changed files with 11 additions and 19 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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]);

View File

@ -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 *,