diff options
Diffstat (limited to 'elf')
-rw-r--r-- | elf/Makefile | 2 | ||||
-rw-r--r-- | elf/Versions | 35 | ||||
-rw-r--r-- | elf/dl-load.c | 19 | ||||
-rw-r--r-- | elf/libdl.map | 7 | ||||
-rw-r--r-- | elf/rtld.c | 20 |
5 files changed, 65 insertions, 18 deletions
diff --git a/elf/Makefile b/elf/Makefile index dedc3d5074..243761cd04 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -35,7 +35,7 @@ elide-routines.os = $(dl-routines) dl-support enbl-secure # ld.so uses those routines, plus some special stuff for being the program # interpreter and operating independent of libc. rtld-routines := rtld $(dl-routines) dl-sysdep dl-minimal -ld-map = $(..)libc.map +ld-map = $(common-objpfx)libc.map distribute = $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \ dl-hash.h soinit.c sofini.c ldd.sh.in ldd.bash.in eval.c \ genrtldtbl.awk atomicity.h dl-procinfo.h ldsodefs.h \ diff --git a/elf/Versions b/elf/Versions new file mode 100644 index 0000000000..d908c59fd4 --- /dev/null +++ b/elf/Versions @@ -0,0 +1,35 @@ +libc { + GLIBC_2.0 { + # global variables + _dl_debug_impcalls; _dl_debug_fd; + + # functions used in other libraries + _dl_open; _dl_close; _dl_addr; _dl_sysdep_output; _dl_debug_message; + + # Those are in the dynamic linker, but used by libc.so. + __libc_enable_secure; _dl_catch_error; _dl_check_all_versions; + _dl_debug_initialize; _dl_debug_state; _dl_default_scope; + _dl_global_scope_end; _dl_init_next; _dl_lookup_symbol; + _dl_map_object; _dl_map_object_deps; _dl_object_relocation_scope; + _dl_relocate_object; _dl_signal_error; _dl_starting_up; + _dl_sysdep_start; _r_debug; + _dl_global_scope; _dl_lookup_symbol_skip; + _dl_lookup_versioned_symbol; _dl_lookup_versioned_symbol_skip; + } + GLIBC_2.1 { + # global variables + _dl_profile; _dl_profile_map; _dl_profile_output; _dl_start_profile; + + # functions used in other libraries + _dl_mcount; _dl_mcount_wrapper; + } +} + +libdl { + GLIBC_2.0 { + dladdr; dlclose; dlerror; dlopen; dlsym; + } + GLIBC_2.1 { + dlvsym; + } +} diff --git a/elf/dl-load.c b/elf/dl-load.c index ad981bc238..b14e52f101 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -204,13 +204,14 @@ fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep, { const char **trun = trusted; - /* All trusted directory must be complete name. */ + /* All trusted directories must be complete names. */ if (cp[0] != '/') continue; while (*trun != NULL && (memcmp (*trun, cp, len) != 0 - || ((*trun)[len] != '/' && (*trun)[len + 1] != '\0'))) + || (*trun)[len] != '/' + || (*trun)[len + 1] != '\0')) ++trun; if (*trun == NULL) @@ -392,7 +393,7 @@ _dl_init_paths (const char *llp) if (rtld_search_dirs[0] == NULL) _dl_signal_error (ENOMEM, NULL, "cannot create cache for search path"); - pelem = all_dirs= rtld_search_dirs[0]; + pelem = all_dirs = rtld_search_dirs[0]; for (strp = system_dirs; *strp != NULL; ++strp, pelem += round_size) { size_t cnt; @@ -904,12 +905,13 @@ open_path (const char *name, size_t namelen, int preloaded, return -1; } - buf = __alloca (max_dirnamelen + max_capstrlen + namelen + 1); + buf = __alloca (max_dirnamelen + max_capstrlen + namelen); do { struct r_search_path_elem *this_dir = *dirs; size_t buflen = 0; size_t cnt; + char *edp; /* If we are debugging the search for libraries print the path now if it hasn't happened now. */ @@ -919,6 +921,7 @@ open_path (const char *name, size_t namelen, int preloaded, print_search_path (dirs, current_what, this_dir->where); } + edp = (char *) __mempcpy (buf, this_dir->dirname, this_dir->dirnamelen); for (cnt = 0; fd == -1 && cnt < ncapstr; ++cnt) { /* Skip this directory if we know it does not exist. */ @@ -926,8 +929,7 @@ open_path (const char *name, size_t namelen, int preloaded, continue; buflen = - ((char *) __mempcpy (__mempcpy (__mempcpy (buf, this_dir->dirname, - this_dir->dirnamelen), + ((char *) __mempcpy (__mempcpy (edp, capstr[cnt].str, capstr[cnt].len), name, namelen) - buf); @@ -946,12 +948,11 @@ open_path (const char *name, size_t namelen, int preloaded, test whether there is any directory at all. */ struct stat st; - buf[this_dir->dirnamelen - + MAX (capstr[cnt].len - 1, 0)] = '\0'; + buf[buflen - namelen - 1] = '\0'; if (__xstat (_STAT_VER, buf, &st) != 0 || ! S_ISDIR (st.st_mode)) - /* The directory does not exist ot it is no directory. */ + /* The directory does not exist or it is no directory. */ this_dir->status[cnt] = nonexisting; else this_dir->status[cnt] = existing; diff --git a/elf/libdl.map b/elf/libdl.map deleted file mode 100644 index 4bd2145a47..0000000000 --- a/elf/libdl.map +++ /dev/null @@ -1,7 +0,0 @@ -GLIBC_2.0 { - global: - dladdr; dlclose; dlerror; dlopen; dlsym; dlvsym; - - local: - *; -}; diff --git a/elf/rtld.c b/elf/rtld.c index 5bd4b7cd97..bf4a142dba 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -968,6 +968,22 @@ process_dl_debug (const char *dl_debug) switch (len) { + case 3: + /* This option is not documented since it is not generally + useful. */ + if (memcmp (dl_debug, "all", 3) == 0) + { + _dl_debug_libs = 1; + _dl_debug_impcalls = 1; + _dl_debug_reloc = 1; + _dl_debug_files = 1; + _dl_debug_symbols = 1; + _dl_debug_bindings = 1; + _dl_debug_versions = 1; + any_debug = 1; + } + break; + case 4: if (memcmp (dl_debug, "help", 4) == 0) { @@ -1117,7 +1133,9 @@ process_envvars (enum mode *modep, int *lazyp) case 8: /* Do we bind early? */ - if (memcmp (&envline[3], "BIND_NOW", 8) == 0) + if (memcmp (&envline[3], "BIND_NOW", 8) == 0 + && (envline[12] == '1' || envline[12] == 'y' + || envline[12] == 'Y')) bind_now = 1; break; |