svn commit: r282118 - stable/10/libexec/rtld-elf
Ed Maste
emaste at FreeBSD.org
Tue Apr 28 01:15:18 UTC 2015
Author: emaste
Date: Tue Apr 28 01:15:17 2015
New Revision: 282118
URL: https://svnweb.freebsd.org/changeset/base/282118
Log:
MFC r281005: Make die available as rtld_die for use by MD relocation code
Sponsored by: The FreeBSD Foundation
Modified:
stable/10/libexec/rtld-elf/rtld.c
stable/10/libexec/rtld-elf/rtld.h
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/libexec/rtld-elf/rtld.c
==============================================================================
--- stable/10/libexec/rtld-elf/rtld.c Mon Apr 27 21:58:41 2015 (r282117)
+++ stable/10/libexec/rtld-elf/rtld.c Tue Apr 28 01:15:17 2015 (r282118)
@@ -78,7 +78,6 @@ typedef void * (*path_enum_proc) (const
* Function declarations.
*/
static const char *basename(const char *);
-static void die(void) __dead2;
static void digest_dynamic1(Obj_Entry *, int, const Elf_Dyn **,
const Elf_Dyn **, const Elf_Dyn **);
static void digest_dynamic2(Obj_Entry *, const Elf_Dyn *, const Elf_Dyn *,
@@ -422,7 +421,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
unsetenv(LD_ "DEBUG") || unsetenv(LD_ "ELF_HINTS_PATH") ||
unsetenv(LD_ "LOADFLTR") || unsetenv(LD_ "LIBRARY_PATH_RPATH")) {
_rtld_error("environment corrupt; aborting");
- die();
+ rtld_die();
}
}
ld_debug = getenv(LD_ "DEBUG");
@@ -470,7 +469,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
obj_main = map_object(fd, argv0, NULL);
close(fd);
if (obj_main == NULL)
- die();
+ rtld_die();
max_stack_flags = obj->stack_flags;
} else { /* Main program already loaded. */
const Elf_Phdr *phdr;
@@ -487,7 +486,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
assert(aux_info[AT_ENTRY] != NULL);
entry = (caddr_t) aux_info[AT_ENTRY]->a_un.a_ptr;
if ((obj_main = digest_phdr(phdr, phnum, entry, argv0)) == NULL)
- die();
+ rtld_die();
}
if (aux_info[AT_EXECPATH] != 0) {
@@ -554,12 +553,12 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
dbg("loading LD_PRELOAD libraries");
if (load_preload_objects() == -1)
- die();
+ rtld_die();
preload_tail = obj_tail;
dbg("loading needed objects");
if (load_needed_objects(obj_main, 0) == -1)
- die();
+ rtld_die();
/* Make a list of all objects loaded at startup. */
last_interposer = obj_main;
@@ -575,7 +574,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
dbg("checking for required versions");
if (rtld_verify_versions(&list_main) == -1 && !ld_tracing)
- die();
+ rtld_die();
if (ld_tracing) { /* We're done */
trace_loaded_objects(obj_main);
@@ -604,11 +603,11 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
if (relocate_objects(obj_main,
ld_bind_now != NULL && *ld_bind_now != '\0',
&obj_rtld, SYMLOOK_EARLY, NULL) == -1)
- die();
+ rtld_die();
dbg("doing copy relocations");
if (do_copy_relocations(obj_main) == -1)
- die();
+ rtld_die();
if (getenv(LD_ "DUMP_REL_POST") != NULL) {
dump_relocations(obj_main);
@@ -640,7 +639,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
if (resolve_objects_ifunc(obj_main,
ld_bind_now != NULL && *ld_bind_now != '\0', SYMLOOK_EARLY,
NULL) == -1)
- die();
+ rtld_die();
if (!obj_main->crt_no_init) {
/*
@@ -707,7 +706,7 @@ _rtld_bind(Obj_Entry *obj, Elf_Size relo
def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, true, NULL,
&lockstate);
if (def == NULL)
- die();
+ rtld_die();
if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC)
target = (Elf_Addr)rtld_resolve_ifunc(defobj, def);
else
@@ -856,8 +855,8 @@ origin_subst(char *real, const char *ori
return (res4);
}
-static void
-die(void)
+void
+rtld_die(void)
{
const char *msg = dlerror();
@@ -1207,7 +1206,7 @@ digest_dynamic2(Obj_Entry *obj, const El
if (obj->z_origin && obj->origin_path == NULL) {
obj->origin_path = xmalloc(PATH_MAX);
if (rtld_dirname_abs(obj->path, obj->origin_path) == -1)
- die();
+ rtld_die();
}
if (dyn_runpath != NULL) {
@@ -1911,7 +1910,7 @@ init_pagesizes(Elf_Auxinfo **aux_info)
}
if (sysctl(mib, len, psa, &size, NULL, 0) == -1) {
_rtld_error("sysctl for hw.pagesize(s) failed");
- die();
+ rtld_die();
}
psa_filled:
pagesizes = psa;
@@ -4496,7 +4495,7 @@ allocate_module_tls(int index)
}
if (!obj) {
_rtld_error("Can't find module with TLS index %d", index);
- die();
+ rtld_die();
}
p = malloc_aligned(obj->tlssize, obj->tlsalign);
@@ -4637,7 +4636,7 @@ locate_dependency(const Obj_Entry *obj,
}
_rtld_error("%s: Unexpected inconsistency: dependency %s not found",
obj->path, name);
- die();
+ rtld_die();
}
static int
@@ -4944,7 +4943,7 @@ __stack_chk_fail(void)
{
_rtld_error("stack overflow detected; terminated");
- die();
+ rtld_die();
}
__weak_reference(__stack_chk_fail, __stack_chk_fail_local);
@@ -4953,7 +4952,7 @@ __chk_fail(void)
{
_rtld_error("buffer overflow detected; terminated");
- die();
+ rtld_die();
}
const char *
Modified: stable/10/libexec/rtld-elf/rtld.h
==============================================================================
--- stable/10/libexec/rtld-elf/rtld.h Mon Apr 27 21:58:41 2015 (r282117)
+++ stable/10/libexec/rtld-elf/rtld.h Tue Apr 28 01:15:17 2015 (r282118)
@@ -355,6 +355,7 @@ typedef struct Struct_SymLook {
} SymLook;
void _rtld_error(const char *, ...) __printflike(1, 2) __exported;
+void rtld_die(void) __dead2;
const char *rtld_strerror(int);
Obj_Entry *map_object(int, const char *, const struct stat *);
void *xcalloc(size_t, size_t);
More information about the svn-src-stable-10
mailing list