aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-12-12 00:21:26 +0000
committerUlrich Drepper <drepper@redhat.com>2001-12-12 00:21:26 +0000
commit32e6df3621edc5067dfd6e87a387e1751f67f708 (patch)
tree957300a92ed16417fb46ce240d19f965fe773181
parent4be601a15e63d03adf55c48c19dda2d2e7377d8a (diff)
downloadglibc-32e6df3621edc5067dfd6e87a387e1751f67f708.tar.xz
glibc-32e6df3621edc5067dfd6e87a387e1751f67f708.zip
Update.
2001-12-11 Jakub Jelinek <jakub@redhat.com> * elf/Makefile (dl-routines): Add conflict. (rtld-ldscript-in, rtld-ldscript, rtld-parms): Remove. (ld.so): Add _begin local symbol. * elf/elf.h (DT_VALTAGIDX, DT_VALNUM, DT_ADDRTAGIDX, DT_ADDRNUM): Define. * elf/dl-deps.c (_dl_build_local_scope): New. (_dl_map_object_deps): If LD_TRACE_PRELINKING, compute local scopes of all libraries. * elf/do-rel.h (VALIDX): Define. (elf_dynamic_do_rel): If ELF_MACHINE_PLT_REL is defined, don't do lazy binding for RELA. If DT_GNU_PRELINKED, DT_RELACOUNT relocations can be skipped. * elf/dl-conflict.c: New file. * elf/dl-lookup.c (_dl_debug_bindings): New. (_dl_lookup_symbol): Use _dl_debug_bindings. Reference_name is always non-NULL. (_dl_lookup_symbol_skip): Likewise. (_dl_lookup_versioned_symbol): Likewise. (_dl_lookup_versioned_symbol_skip): Likewise. * elf/dl-runtime.c (PLTREL): If ELF_MACHINE_PLT_REL is defined, define to ElfW(Rel). * elf/dynamic-link.h (elf_get_dynamic_info): Record selected dynamic tags in the DT_VALRNGLO..DT_VALRNGHI and DT_ADDRRNGLO..DT_ADDRRNGHI ranges. Don't adjust address dynamic tags if l_addr is 0. * elf/rtld.c (_dl_trace_prelink, _dl_trace_prelink_map): New variables. (_dl_start): Skip ELF_DYNAMIC_RELOCATE if ld.so is prelinked. (VALIDX, ADDRIDX): Define. (_dl_start_final): Initialize _dl_rtld_map's l_map_start and l_map_end. (dl_main): Print library list for LD_TRACE_PRELINKING. If prelinking information can be used, skip relocating libraries and call _dl_resolve_conflicts instead. (process_envvars): Handle LD_TRACE_PRELINKING envvar. * elf/dl-load.c (_dl_map_object): Don't create fake libs if LD_TRACE_PRELINKING. * include/link.h (struct link_map) [l_info]: Add DT_VALNUM + DT_ADDRNUM. * sysdeps/generic/ldsodefs.h (_dl_trace_prelink_map): New declaration. (DL_DEBUG_PRELINK): Define. (_dl_resolve_conflicts): Add prototype. * sysdeps/alpha/dl-machine.h (elf_machine_runtime_setup): Reinitialize .plt for prelinked libraries where prelinking info cannot be used. (elf_machine_rela): If relocating R_ALPHA_JMP_SLOT in .gnu.conflict section, use RESOLVE_CONFLICT_FIND_MAP to find out reloc's link_map. * sysdeps/arm/bits/link.h: New file. * sysdeps/arm/dl-machine.h (elf_machine_runtime_setup): Save original content of .got[1]. (ELF_MACHINE_NO_RELA): Only define if RTLD_BOOTSTRAP. (ELF_MACHINE_PLT_REL): Define. (elf_machine_rela, elf_machine_rela_relative): New. (elf_machine_lazy_rel): Reinitialize R_ARM_JUMP_SLOT address instead of adjusting it if prelinked and prelinking cannot be used. * sysdeps/i386/bits/link.h: New file. * sysdeps/i386/dl-machine.h (elf_machine_runtime_setup): Save original content of .got[1]. (ELF_MACHINE_NO_RELA): Only define if RTLD_BOOTSTRAP. (ELF_MACHINE_PLT_REL): Define. (elf_machine_rela, elf_machine_rela_relative): New. (elf_machine_lazy_rel): Reinitialize R_386_JUMP_SLOT address instead of adjusting it if prelinked and prelinking cannot be used. * sysdeps/powerpc/dl-machine.h (elf_machine_rela): If relocating conflicts, skip finaladdr computation. Use RESOLVE_CONFLICT_FIND_MAP to find out map for R_PPC_JMP_SLOT relocs. * sysdeps/sparc/sparc32/dl-machine.h (VALIDX): Define. (OPCODE_BA): Define. (elf_machine_runtime_setup): Reinitialize .plt for prelinked libraries where prelinking info cannot be used. (sparc_fixup_plt): Renamed from elf_machine_fixup_plt. (elf_machine_fixup_plt): Call sparc_fixup_plt. (elf_machine_rela): Set value to 0 if relocating conflicts. Call sparc_fixup_plt for R_SPARC_JMP_SLOT. * sysdeps/sparc/sparc64/dl-machine.h (VALIDX): Define. (sparc64_fixup_plt): Fix a typo. (elf_machine_rela): Set value to 0 if relocating conflicts. Handle R_SPARC_JMP_SLOT relocs when relocating conflicts. (elf_machine_runtime_setup): Reinitialize .plt for prelinked libraries where prelinking info cannot be used. * sysdeps/sh/bits/link.h: New file. * sysdeps/sh/dl-machine.h (elf_machine_runtime_setup): Save original content of .got[1]. (elf_machine_lazy_rel): Reinitialize R_SH_JMP_SLOT address instead of adjusting it if prelinked and prelinking cannot be used. * sysdeps/s390/s390-32/bits/link.h: New file. * sysdeps/s390/s390-32/dl-machine.h (elf_machine_runtime_setup): Save original content of .got[1]. (elf_machine_lazy_rel): Reinitialize R_390_JMP_SLOT address instead of adjusting it if prelinked and prelinking cannot be used. * sysdeps/s390/s390-64/bits/link.h: New file. * sysdeps/s390/s390-64/dl-machine.h (elf_machine_runtime_setup): Save original content of .got[1]. (elf_machine_lazy_rel): Reinitialize R_390_JMP_SLOT address instead of adjusting it if prelinked and prelinking cannot be used. * sysdeps/x86_64/bits/link.h: New file. * sysdeps/x86_64/dl-machine.h (elf_machine_runtime_setup): Save original content of .got[1]. (elf_machine_lazy_rel): Reinitialize R_X86_64_JMP_SLOT address instead of adjusting it if prelinked and prelinking cannot be used.
-rw-r--r--ChangeLog101
-rw-r--r--elf/Makefile36
-rw-r--r--elf/dl-conflict.c66
-rw-r--r--elf/dl-deps.c61
-rw-r--r--elf/dl-load.c3
-rw-r--r--elf/dl-lookup.c229
-rw-r--r--elf/dl-runtime.c3
-rw-r--r--elf/do-rel.h11
-rw-r--r--elf/dynamic-link.h60
-rw-r--r--elf/elf.h4
-rw-r--r--elf/rtld.c167
-rw-r--r--include/link.h16
-rw-r--r--sysdeps/alpha/dl-machine.h43
-rw-r--r--sysdeps/arm/bits/link.h4
-rw-r--r--sysdeps/arm/dl-machine.h90
-rw-r--r--sysdeps/generic/ldsodefs.h8
-rw-r--r--sysdeps/i386/bits/link.h5
-rw-r--r--sysdeps/i386/dl-machine.h82
-rw-r--r--sysdeps/powerpc/dl-machine.h6
-rw-r--r--sysdeps/s390/s390-32/bits/link.h5
-rw-r--r--sysdeps/s390/s390-32/dl-machine.h17
-rw-r--r--sysdeps/s390/s390-64/bits/link.h5
-rw-r--r--sysdeps/s390/s390-64/dl-machine.h17
-rw-r--r--sysdeps/sh/bits/link.h5
-rw-r--r--sysdeps/sh/dl-machine.h17
-rw-r--r--sysdeps/sparc/sparc32/dl-machine.h99
-rw-r--r--sysdeps/sparc/sparc64/dl-machine.h66
-rw-r--r--sysdeps/x86_64/bits/link.h5
-rw-r--r--sysdeps/x86_64/dl-machine.h17
29 files changed, 1045 insertions, 203 deletions
diff --git a/ChangeLog b/ChangeLog
index ac20bdcbc1..8c54b4da47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,104 @@
+2001-12-11 Jakub Jelinek <jakub@redhat.com>
+
+ * elf/Makefile (dl-routines): Add conflict.
+ (rtld-ldscript-in, rtld-ldscript, rtld-parms): Remove.
+ (ld.so): Add _begin local symbol.
+ * elf/elf.h (DT_VALTAGIDX, DT_VALNUM, DT_ADDRTAGIDX, DT_ADDRNUM):
+ Define.
+ * elf/dl-deps.c (_dl_build_local_scope): New.
+ (_dl_map_object_deps): If LD_TRACE_PRELINKING, compute local scopes
+ of all libraries.
+ * elf/do-rel.h (VALIDX): Define.
+ (elf_dynamic_do_rel): If ELF_MACHINE_PLT_REL is defined, don't do
+ lazy binding for RELA. If DT_GNU_PRELINKED, DT_RELACOUNT relocations
+ can be skipped.
+ * elf/dl-conflict.c: New file.
+ * elf/dl-lookup.c (_dl_debug_bindings): New.
+ (_dl_lookup_symbol): Use _dl_debug_bindings. Reference_name is always
+ non-NULL.
+ (_dl_lookup_symbol_skip): Likewise.
+ (_dl_lookup_versioned_symbol): Likewise.
+ (_dl_lookup_versioned_symbol_skip): Likewise.
+ * elf/dl-runtime.c (PLTREL): If ELF_MACHINE_PLT_REL is defined,
+ define to ElfW(Rel).
+ * elf/dynamic-link.h (elf_get_dynamic_info): Record selected dynamic
+ tags in the DT_VALRNGLO..DT_VALRNGHI and DT_ADDRRNGLO..DT_ADDRRNGHI
+ ranges.
+ Don't adjust address dynamic tags if l_addr is 0.
+ * elf/rtld.c (_dl_trace_prelink, _dl_trace_prelink_map): New variables.
+ (_dl_start): Skip ELF_DYNAMIC_RELOCATE if ld.so is prelinked.
+ (VALIDX, ADDRIDX): Define.
+ (_dl_start_final): Initialize _dl_rtld_map's l_map_start and l_map_end.
+ (dl_main): Print library list for LD_TRACE_PRELINKING.
+ If prelinking information can be used, skip relocating libraries and
+ call _dl_resolve_conflicts instead.
+ (process_envvars): Handle LD_TRACE_PRELINKING envvar.
+ * elf/dl-load.c (_dl_map_object): Don't create fake libs
+ if LD_TRACE_PRELINKING.
+ * include/link.h (struct link_map) [l_info]: Add DT_VALNUM
+ + DT_ADDRNUM.
+ * sysdeps/generic/ldsodefs.h (_dl_trace_prelink_map): New declaration.
+ (DL_DEBUG_PRELINK): Define.
+ (_dl_resolve_conflicts): Add prototype.
+
+ * sysdeps/alpha/dl-machine.h (elf_machine_runtime_setup): Reinitialize
+ .plt for prelinked libraries where prelinking info cannot be used.
+ (elf_machine_rela): If relocating R_ALPHA_JMP_SLOT in .gnu.conflict
+ section, use RESOLVE_CONFLICT_FIND_MAP to find out reloc's link_map.
+ * sysdeps/arm/bits/link.h: New file.
+ * sysdeps/arm/dl-machine.h (elf_machine_runtime_setup): Save original
+ content of .got[1].
+ (ELF_MACHINE_NO_RELA): Only define if RTLD_BOOTSTRAP.
+ (ELF_MACHINE_PLT_REL): Define.
+ (elf_machine_rela, elf_machine_rela_relative): New.
+ (elf_machine_lazy_rel): Reinitialize R_ARM_JUMP_SLOT address instead
+ of adjusting it if prelinked and prelinking cannot be used.
+ * sysdeps/i386/bits/link.h: New file.
+ * sysdeps/i386/dl-machine.h (elf_machine_runtime_setup): Save original
+ content of .got[1].
+ (ELF_MACHINE_NO_RELA): Only define if RTLD_BOOTSTRAP.
+ (ELF_MACHINE_PLT_REL): Define.
+ (elf_machine_rela, elf_machine_rela_relative): New.
+ (elf_machine_lazy_rel): Reinitialize R_386_JUMP_SLOT address instead
+ of adjusting it if prelinked and prelinking cannot be used.
+ * sysdeps/powerpc/dl-machine.h (elf_machine_rela): If relocating
+ conflicts, skip finaladdr computation. Use RESOLVE_CONFLICT_FIND_MAP
+ to find out map for R_PPC_JMP_SLOT relocs.
+ * sysdeps/sparc/sparc32/dl-machine.h (VALIDX): Define.
+ (OPCODE_BA): Define.
+ (elf_machine_runtime_setup): Reinitialize .plt for prelinked
+ libraries where prelinking info cannot be used.
+ (sparc_fixup_plt): Renamed from elf_machine_fixup_plt.
+ (elf_machine_fixup_plt): Call sparc_fixup_plt.
+ (elf_machine_rela): Set value to 0 if relocating conflicts.
+ Call sparc_fixup_plt for R_SPARC_JMP_SLOT.
+ * sysdeps/sparc/sparc64/dl-machine.h (VALIDX): Define.
+ (sparc64_fixup_plt): Fix a typo.
+ (elf_machine_rela): Set value to 0 if relocating conflicts.
+ Handle R_SPARC_JMP_SLOT relocs when relocating conflicts.
+ (elf_machine_runtime_setup): Reinitialize .plt for prelinked
+ libraries where prelinking info cannot be used.
+ * sysdeps/sh/bits/link.h: New file.
+ * sysdeps/sh/dl-machine.h (elf_machine_runtime_setup): Save original
+ content of .got[1].
+ (elf_machine_lazy_rel): Reinitialize R_SH_JMP_SLOT address instead
+ of adjusting it if prelinked and prelinking cannot be used.
+ * sysdeps/s390/s390-32/bits/link.h: New file.
+ * sysdeps/s390/s390-32/dl-machine.h (elf_machine_runtime_setup):
+ Save original content of .got[1].
+ (elf_machine_lazy_rel): Reinitialize R_390_JMP_SLOT address instead
+ of adjusting it if prelinked and prelinking cannot be used.
+ * sysdeps/s390/s390-64/bits/link.h: New file.
+ * sysdeps/s390/s390-64/dl-machine.h (elf_machine_runtime_setup):
+ Save original content of .got[1].
+ (elf_machine_lazy_rel): Reinitialize R_390_JMP_SLOT address instead
+ of adjusting it if prelinked and prelinking cannot be used.
+ * sysdeps/x86_64/bits/link.h: New file.
+ * sysdeps/x86_64/dl-machine.h (elf_machine_runtime_setup):
+ Save original content of .got[1].
+ (elf_machine_lazy_rel): Reinitialize R_X86_64_JMP_SLOT address instead
+ of adjusting it if prelinked and prelinking cannot be used.
+
2001-12-11 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/ptsname.c (__ptsname_r): Use sizeof
diff --git a/elf/Makefile b/elf/Makefile
index b39034c7bf..f1245328f5 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -29,7 +29,7 @@ routines = $(dl-routines) dl-open dl-close dl-support dl-iteratephdr \
# profiled libraries.
dl-routines = $(addprefix dl-,load cache lookup object reloc deps \
runtime error init fini debug misc \
- version profile)
+ version profile conflict)
all-dl-routines = $(dl-routines) $(sysdep-dl-routines)
# But they are absent from the shared libc, because that code is in ld.so.
elide-routines.os = $(all-dl-routines) dl-support enbl-secure \
@@ -154,30 +154,16 @@ $(objpfx)dl-allobjs.os: $(all-rtld-routines:%=$(objpfx)%.os)
$(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
$(reloc-link) '-Wl,-(' $^ -lgcc '-Wl,-)'
-# Do we need a linker script?
-rtld-ldscript-in := $(firstword $(wildcard $(+sysdep_dirs:%=%/rtld-ldscript.in)))
-
-ifneq (,$(rtld-ldscript-in))
-rtld-ldscript = $(objpfx)rtld-ldscript
-generated += rtld-ldscript
-
-LDFLAGS-rtld = -T $(rtld-ldscript)
-before-compile += $(rtld-ldscript)
-
-rtld-parms = $(wildcard $(+sysdep_dirs:%=%/rtld-parms))
-include $(rtld-parms)
-
-$(rtld-ldscript): $(rtld-ldscript-in) $(rtld-parms)
- sed -e 's#@@rtld-oformat@@#$(rtld-oformat)#' \
- -e 's#@@rtld-arch@@#$(rtld-arch)#' \
- -e 's#@@rtld-entry@@#$(rtld-entry)#' \
- -e 's#@@rtld-base@@#$(rtld-base)#' $< >$@
-endif
-
-$(objpfx)ld.so: $(objpfx)librtld.os $(rtld-ldscript) $(ld-map)
- $(LINK.o) -nostdlib -nostartfiles -shared -o $@ $(LDFLAGS-rtld) \
- $(filter-out $(rtld-ldscript) $(map-file),$^) \
- $(load-map-file) -Wl,-soname=$(rtld-installed-name)
+$(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
+ $(LINK.o) -nostdlib -nostartfiles -shared \
+ $(LDFLAGS-rtld) -Wl,--verbose 2>&1 | \
+ sed -e '/^=========/,/^=========/!d;/^=========/d' \
+ -e 's/\. = 0 + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \
+ > $@.lds; \
+ $(LINK.o) -nostdlib -nostartfiles -shared -o $@ $(LDFLAGS-rtld) \
+ $(filter-out $(map-file),$^) $(load-map-file) \
+ -Wl,-soname=$(rtld-installed-name) -T $@.lds; \
+ rm -f $@.lds
# interp.c exists just to get this string into the libraries.
CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"'
diff --git a/elf/dl-conflict.c b/elf/dl-conflict.c
new file mode 100644
index 0000000000..5426a5ad44
--- /dev/null
+++ b/elf/dl-conflict.c
@@ -0,0 +1,66 @@
+/* Resolve conflicts against already prelinked libraries.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 2001.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <libintl.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include "dynamic-link.h"
+
+extern unsigned long int _dl_num_cache_relocations; /* in dl-lookup.c */
+
+void
+_dl_resolve_conflicts (struct link_map *l, ElfW(Rela) *conflict,
+ ElfW(Rela) *conflictend)
+{
+ if (__builtin_expect (_dl_debug_mask & DL_DEBUG_RELOC, 0))
+ _dl_printf ("\nconflict processing: %s\n",
+ l->l_name[0] ? l->l_name : _dl_argv[0]);
+
+ {
+ /* Do the conflict relocation of the object and library GOT and other
+ data. */
+
+ /* This macro is used as a callback from the ELF_DYNAMIC_RELOCATE code. */
+#define RESOLVE_MAP(ref, version, flags) (*ref = NULL, 0)
+#define RESOLVE(ref, version, flags) (*ref = NULL, 0)
+#define RESOLVE_CONFLICT_FIND_MAP(map, r_offset) \
+do \
+ { \
+ while (resolve_conflict_map->l_map_end < (r_offset) \
+ || resolve_conflict_map->l_map_start > (r_offset)) \
+ resolve_conflict_map \
+ = resolve_conflict_map->l_next; \
+ (map) = resolve_conflict_map; \
+ } while (0)
+
+ struct link_map *resolve_conflict_map = _dl_loaded;
+
+#include "dynamic-link.h"
+
+ _dl_num_cache_relocations += conflictend - conflict;
+
+ for (; conflict < conflictend; ++conflict)
+ elf_machine_rela (l, conflict, NULL, NULL, (void *) conflict->r_offset);
+ }
+}
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index ec61326614..af39de1023 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -21,6 +21,7 @@
#include <dlfcn.h>
#include <errno.h>
#include <libintl.h>
+#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -70,6 +71,21 @@ openaux (void *a)
args->trace_mode, 0);
}
+static ptrdiff_t
+internal_function
+_dl_build_local_scope (struct link_map **list, struct link_map *map)
+{
+ struct link_map **p = list;
+ struct link_map **q;
+
+ *p++ = map;
+ map->l_reserved = 1;
+ if (map->l_initfini)
+ for (q = map->l_initfini + 1; *q; ++q)
+ if (! (*q)->l_reserved)
+ p += _dl_build_local_scope (p, *q);
+ return p - list;
+}
/* We use a very special kind of list to track the path
@@ -491,6 +507,51 @@ _dl_map_object_deps (struct link_map *map,
runp->map->l_reserved = 0;
}
+ if (__builtin_expect(_dl_debug_mask & DL_DEBUG_PRELINK, 0) != 0
+ && map == _dl_loaded)
+ {
+ /* If we are to compute conflicts, we have to build local scope
+ for each library, not just the ultimate loader. */
+ for (i = 0; i < nlist; ++i)
+ {
+ struct link_map *l = map->l_searchlist.r_list[i];
+ unsigned int j, cnt;
+
+ /* The local scope has been already computed. */
+ if (l == map
+ || (l->l_local_scope[0]
+ && l->l_local_scope[0]->r_nlist) != 0)
+ continue;
+
+ if (l->l_info[AUXTAG] || l->l_info[FILTERTAG])
+ {
+ /* As current DT_AUXILIARY/DT_FILTER implementation needs to be
+ rewritten, no need to bother with prelinking the old
+ implementation. */
+ _dl_signal_error (EINVAL, l->l_name, NULL, N_("\
+Filters not supported with LD_TRACE_PRELINKING"));
+ }
+
+ cnt = _dl_build_local_scope (map->l_initfini, l);
+ assert (cnt <= nlist);
+ for (j = 0; j < cnt; j++)
+ map->l_initfini[j]->l_reserved = 0;
+
+ l->l_local_scope[0] =
+ (struct r_scope_elem *) malloc (sizeof (struct r_scope_elem)
+ + (cnt
+ * sizeof (struct link_map *)));
+ if (l->l_local_scope[0] == NULL)
+ _dl_signal_error (ENOMEM, map->l_name, NULL,
+ N_("cannot allocate symbol search list"));
+ l->l_local_scope[0]->r_nlist = cnt;
+ l->l_local_scope[0]->r_list =
+ (struct link_map **) (l->l_local_scope[0] + 1);
+ memcpy (l->l_local_scope[0]->r_list, map->l_initfini,
+ cnt * sizeof (struct link_map *));
+ }
+ }
+
/* Maybe we can remove some relocation dependencies now. */
assert (map->l_searchlist.r_list[0] == map);
for (i = 0; i < map->l_reldepsact; ++i)
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 0bc01eca20..4b9af501c1 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1782,7 +1782,8 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
if (__builtin_expect (fd, 0) == -1)
{
- if (trace_mode)
+ if (trace_mode
+ && __builtin_expect (_dl_debug_mask & DL_DEBUG_PRELINK, 0) == 0)
{
/* We haven't found an appropriate library. But since we
are only interested in the list of libraries this isn't
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 5fa50fc457..ae3f0b1e34 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -194,6 +194,12 @@ _dl_do_lookup_versioned (const char *undef_name, unsigned long int hash,
const struct r_found_version *const version,
struct link_map *skip, int type_class);
+static void
+internal_function
+_dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
+ const ElfW(Sym) **ref, struct r_scope_elem *symbol_scope[],
+ struct sym_val *value, const struct r_found_version *version,
+ int type_class, int protected);
/* Search loaded objects' symbol tables for a definition of the symbol
UNDEF_NAME. */
@@ -204,7 +210,7 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
const ElfW(Sym) **ref, struct r_scope_elem *symbol_scope[],
int type_class, int explicit)
{
- unsigned long int hash = _dl_elf_hash (undef_name);
+ const unsigned long int hash = _dl_elf_hash (undef_name);
struct sym_val current_value = { NULL, NULL };
struct r_scope_elem **scope;
int protect