summaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/Makefile53
-rw-r--r--elf/cache.c2
-rw-r--r--elf/chroot_canon.c2
-rw-r--r--elf/dl-addr.c2
-rw-r--r--elf/dl-cache.c2
-rw-r--r--elf/dl-caller.c2
-rw-r--r--elf/dl-close.c19
-rw-r--r--elf/dl-conflict.c2
-rw-r--r--elf/dl-debug.c2
-rw-r--r--elf/dl-deps.c2
-rw-r--r--elf/dl-dst.h2
-rw-r--r--elf/dl-environ.c2
-rw-r--r--elf/dl-error.c2
-rw-r--r--elf/dl-execstack.c2
-rw-r--r--elf/dl-fini.c195
-rw-r--r--elf/dl-fptr.c2
-rw-r--r--elf/dl-hwcaps.c2
-rw-r--r--elf/dl-init.c2
-rw-r--r--elf/dl-iteratephdr.c4
-rw-r--r--elf/dl-libc.c2
-rw-r--r--elf/dl-load.c87
-rw-r--r--elf/dl-load.h2
-rw-r--r--elf/dl-lookup.c25
-rw-r--r--elf/dl-machine-reject-phdr.h2
-rw-r--r--elf/dl-map-segments.h2
-rw-r--r--elf/dl-minimal.c9
-rw-r--r--elf/dl-misc.c2
-rw-r--r--elf/dl-object.c2
-rw-r--r--elf/dl-open.c4
-rw-r--r--elf/dl-origin.c2
-rw-r--r--elf/dl-profile.c2
-rw-r--r--elf/dl-profstub.c2
-rw-r--r--elf/dl-reloc.c2
-rw-r--r--elf/dl-runtime.c4
-rw-r--r--elf/dl-scope.c2
-rw-r--r--elf/dl-support.c8
-rw-r--r--elf/dl-sym.c2
-rw-r--r--elf/dl-symaddr.c2
-rw-r--r--elf/dl-sysdep-open.h45
-rw-r--r--elf/dl-sysdep.c2
-rw-r--r--elf/dl-tls.c2
-rw-r--r--elf/dl-tsd.c2
-rw-r--r--elf/dl-unmap-segments.h2
-rw-r--r--elf/dl-version.c2
-rw-r--r--elf/dl-writev.h4
-rw-r--r--elf/do-rel.h2
-rw-r--r--elf/dynamic-link.h19
-rw-r--r--elf/elf.h2
-rw-r--r--elf/enbl-secure.c2
-rw-r--r--elf/genrtldtbl.awk2
-rw-r--r--elf/get-dynamic-info.h2
-rw-r--r--elf/interp.c2
-rw-r--r--elf/ldconfig.c4
-rw-r--r--elf/ldd.bash.in4
-rw-r--r--elf/link.h2
-rw-r--r--elf/pldd-xx.c2
-rw-r--r--elf/pldd.c4
-rw-r--r--elf/readelflib.c2
-rw-r--r--elf/readlib.c2
-rw-r--r--elf/rtld-Rules2
-rw-r--r--elf/rtld.c19
-rw-r--r--elf/setup-vdso.h2
-rw-r--r--elf/sln.c9
-rw-r--r--elf/sotruss-lib.c2
-rwxr-xr-xelf/sotruss.sh4
-rw-r--r--elf/sprof.c4
-rw-r--r--elf/static-stubs.c2
-rw-r--r--elf/tlsdeschtab.h2
-rw-r--r--elf/tst-align.c2
-rw-r--r--elf/tst-align2.c2
-rw-r--r--elf/tst-alignmod.c2
-rw-r--r--elf/tst-alignmod2.c2
-rw-r--r--elf/tst-audit11.c36
-rw-r--r--elf/tst-audit11mod1.c24
-rw-r--r--elf/tst-audit11mod2.c23
-rw-r--r--elf/tst-audit11mod2.map22
-rw-r--r--elf/tst-audit12.c49
-rw-r--r--elf/tst-audit12mod1.c24
-rw-r--r--elf/tst-audit12mod2.c23
-rw-r--r--elf/tst-audit12mod2.map22
-rw-r--r--elf/tst-audit12mod3.c23
-rw-r--r--elf/tst-auditmod11.c39
-rw-r--r--elf/tst-auditmod12.c43
-rw-r--r--elf/tst-auxv.c2
-rw-r--r--elf/tst-dl-iter-static.c2
-rw-r--r--elf/tst-dlmodcount.c9
-rw-r--r--elf/tst-dlmopen1.c7
-rw-r--r--elf/tst-dlopen-aout.c2
-rw-r--r--elf/tst-dlopenrpath.c2
-rw-r--r--elf/tst-dlopenrpathmod.c2
-rw-r--r--elf/tst-nodelete-opened-lib.c2
-rw-r--r--elf/tst-nodelete-opened.c2
-rw-r--r--elf/tst-nodelete2.c37
-rw-r--r--elf/tst-nodelete2mod.c (renamed from elf/tst-znodelete-zlib.cc)3
-rw-r--r--elf/tst-null-argv-lib.c2
-rw-r--r--elf/tst-null-argv.c2
-rw-r--r--elf/tst-order-main.c7
-rwxr-xr-xelf/tst-pathopt.sh4
-rw-r--r--elf/tst-pie2.c9
-rw-r--r--elf/tst-prelink.c30
-rw-r--r--elf/tst-prelink.exp1
-rw-r--r--elf/tst-protected1a.c2
-rw-r--r--elf/tst-protected1b.c2
-rw-r--r--elf/tst-protected1mod.h2
-rw-r--r--elf/tst-protected1moda.c2
-rw-r--r--elf/tst-protected1modb.c2
-rw-r--r--elf/tst-ptrguard1.c2
-rwxr-xr-xelf/tst-rtld-load-self.sh4
-rw-r--r--elf/tst-stackguard1.c2
-rw-r--r--elf/tst-tlsalign-extern.c2
-rw-r--r--elf/tst-tlsalign.c2
-rw-r--r--elf/tst-unique1.c2
-rw-r--r--elf/tst-unique1mod1.c2
-rw-r--r--elf/tst-unique1mod2.c2
-rw-r--r--elf/tst-unique2.c4
-rw-r--r--elf/tst-unique2mod1.c2
-rw-r--r--elf/tst-unique2mod2.c2
-rw-r--r--elf/vismain.c2
-rw-r--r--elf/vismod1.c2
-rw-r--r--elf/vismod2.c2
-rw-r--r--elf/vismod3.c2
121 files changed, 829 insertions, 296 deletions
diff --git a/elf/Makefile b/elf/Makefile
index 4ceeaf89be..63a535502c 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2015 Free Software Foundation, Inc.
+# Copyright (C) 1995-2016 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -148,7 +148,8 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4 \
tst-nodelete) \
tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
- tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened
+ tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
+ tst-nodelete2 tst-audit11 tst-audit12
# reldep9
ifeq ($(build-hardcoded-path-in-tests),yes)
tests += tst-dlopen-aout
@@ -218,13 +219,22 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
tst-initorder2d \
tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \
tst-array5dep tst-null-argv-lib \
- tst-tlsalign-lib tst-nodelete-opened-lib
+ tst-tlsalign-lib tst-nodelete-opened-lib tst-nodelete2mod \
+ tst-audit11mod1 tst-audit11mod2 tst-auditmod11 \
+ tst-audit12mod1 tst-audit12mod2 tst-audit12mod3 tst-auditmod12
ifeq (yes,$(have-protected-data))
modules-names += tst-protected1moda tst-protected1modb
tests += tst-protected1a tst-protected1b
$(objpfx)tst-protected1a: $(addprefix $(objpfx),tst-protected1moda.so tst-protected1modb.so)
$(objpfx)tst-protected1b: $(addprefix $(objpfx),tst-protected1modb.so tst-protected1moda.so)
tst-protected1modb.so-no-z-defs = yes
+# These tests fail with GCC versions prior to 5.1 and with some versions
+# of binutils. See https://sourceware.org/bugzilla/show_bug.cgi?id=17709
+# and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248 for details.
+# Perhaps in future we can make these XFAILs conditional on some detection
+# of compiler/linker behavior/version.
+test-xfail-tst-protected1a = yes
+test-xfail-tst-protected1b = yes
endif
ifeq (yesyes,$(have-fpie)$(build-shared))
modules-names += tst-piemod1
@@ -291,6 +301,14 @@ endif
check-abi: $(objpfx)check-abi-ld.out
tests-special += $(objpfx)check-abi-ld.out
update-abi: update-abi-ld
+update-all-abi: update-all-abi-ld
+
+ifeq ($(have-glob-dat-reloc),yes)
+tests += tst-prelink
+ifeq ($(run-built-tests),yes)
+tests-special += $(objpfx)tst-prelink-cmp.out
+endif
+endif
include ../Rules
@@ -594,6 +612,7 @@ tst-auditmod9b.so-no-z-defs = yes
tst-nodelete-uniquemod.so-no-z-defs = yes
tst-nodelete-rtldmod.so-no-z-defs = yes
tst-nodelete-zmod.so-no-z-defs = yes
+tst-nodelete2mod.so-no-z-defs = yes
ifeq ($(build-shared),yes)
# Build all the modules even when not actually running test programs.
@@ -872,6 +891,7 @@ endif
ifeq ($(have-z-execstack),yes)
$(objpfx)tst-execstack: $(libdl)
$(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
+CPPFLAGS-tst-execstack.c = -DUSE_PTHREADS=0
LDFLAGS-tst-execstack = -Wl,-z,noexecstack
LDFLAGS-tst-execstack-mod = -Wl,-z,execstack
@@ -1164,6 +1184,11 @@ $(objpfx)tst-nodelete.out: $(objpfx)tst-nodelete-uniquemod.so \
LDFLAGS-tst-nodelete = -rdynamic
LDFLAGS-tst-nodelete-zmod.so = -Wl,--enable-new-dtags,-z,nodelete
+$(objpfx)tst-nodelete2: $(libdl)
+$(objpfx)tst-nodelete2.out: $(objpfx)tst-nodelete2mod.so
+
+LDFLAGS-tst-nodelete2 = -rdynamic
+
$(objpfx)tst-initorder-cmp.out: tst-initorder.exp $(objpfx)tst-initorder.out
cmp $^ > $@; \
$(evaluate-test)
@@ -1205,3 +1230,25 @@ $(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
$(objpfx)tst-unused-dep-cmp.out: $(objpfx)tst-unused-dep.out
cmp $< /dev/null > $@; \
$(evaluate-test)
+
+$(objpfx)tst-audit11.out: $(objpfx)tst-auditmod11.so $(objpfx)tst-audit11mod1.so
+$(objpfx)tst-audit11: $(libdl)
+tst-audit11-ENV = LD_AUDIT=$(objpfx)tst-auditmod11.so
+$(objpfx)tst-audit11mod1.so: $(objpfx)tst-audit11mod2.so
+LDFLAGS-tst-audit11mod2.so = -Wl,--version-script=tst-audit11mod2.map,-soname,tst-audit11mod2.so
+
+$(objpfx)tst-audit12.out: $(objpfx)tst-auditmod12.so $(objpfx)tst-audit12mod1.so $(objpfx)tst-audit12mod3.so
+$(objpfx)tst-audit12: $(libdl)
+tst-audit12-ENV = LD_AUDIT=$(objpfx)tst-auditmod12.so
+$(objpfx)tst-audit12mod1.so: $(objpfx)tst-audit12mod2.so
+LDFLAGS-tst-audit12mod2.so = -Wl,--version-script=tst-audit12mod2.map
+
+tst-prelink-ENV = LD_TRACE_PRELINKING=1
+
+$(objpfx)tst-prelink-conflict.out: $(objpfx)tst-prelink.out
+ grep stdout $< | grep conflict | $(AWK) '{ print $$10, $$11 }' > $@
+
+$(objpfx)tst-prelink-cmp.out: tst-prelink.exp \
+ $(objpfx)tst-prelink-conflict.out
+ cmp $^ > $@; \
+ $(evaluate-test)
diff --git a/elf/cache.c b/elf/cache.c
index bde7984924..fbee172012 100644
--- a/elf/cache.c
+++ b/elf/cache.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2015 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1999.
diff --git a/elf/chroot_canon.c b/elf/chroot_canon.c
index 05a824103a..d1c4d01013 100644
--- a/elf/chroot_canon.c
+++ b/elf/chroot_canon.c
@@ -1,5 +1,5 @@
/* Return the canonical absolute name of a given file inside chroot.
- Copyright (C) 1996-2015 Free Software Foundation, Inc.
+ Copyright (C) 1996-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
diff --git a/elf/dl-addr.c b/elf/dl-addr.c
index a025652c08..291ff55816 100644
--- a/elf/dl-addr.c
+++ b/elf/dl-addr.c
@@ -1,5 +1,5 @@
/* Locate the shared object symbol nearest a given address.
- Copyright (C) 1996-2015 Free Software Foundation, Inc.
+ Copyright (C) 1996-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-cache.c b/elf/dl-cache.c
index dec49bc0f2..cfa335eb32 100644
--- a/elf/dl-cache.c
+++ b/elf/dl-cache.c
@@ -1,5 +1,5 @@
/* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
- Copyright (C) 1996-2015 Free Software Foundation, Inc.
+ Copyright (C) 1996-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-caller.c b/elf/dl-caller.c
index bfef108be2..4526da085e 100644
--- a/elf/dl-caller.c
+++ b/elf/dl-caller.c
@@ -1,5 +1,5 @@
/* Check whether caller comes from the right place.
- Copyright (C) 2004-2015 Free Software Foundation, Inc.
+ Copyright (C) 2004-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 910527746e..687d7de874 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -1,5 +1,5 @@
/* Close a shared object opened by `_dl_open'.
- Copyright (C) 1996-2015 Free Software Foundation, Inc.
+ Copyright (C) 1996-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -25,7 +25,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <bits/libc-lock.h>
+#include <libc-lock.h>
#include <ldsodefs.h>
#include <sys/types.h>
#include <sys/mman.h>
@@ -144,6 +144,14 @@ _dl_close_worker (struct link_map *map, bool force)
char done[nloaded];
struct link_map *maps[nloaded];
+ /* Clear DF_1_NODELETE to force object deletion. We don't need to touch
+ l_tls_dtor_count because forced object deletion only happens when an
+ error occurs during object load. Destructor registration for TLS
+ non-POD objects should not have happened till then for this
+ object. */
+ if (force)
+ map->l_flags_1 &= ~DF_1_NODELETE;
+
/* Run over the list and assign indexes to the link maps and enter
them into the MAPS array. */
int idx = 0;
@@ -153,13 +161,6 @@ _dl_close_worker (struct link_map *map, bool force)
maps[idx] = l;
++idx;
- /* Clear DF_1_NODELETE to force object deletion. We don't need to touch
- l_tls_dtor_count because forced object deletion only happens when an
- error occurs during object load. Destructor registration for TLS
- non-POD objects should not have happened till then for this
- object. */
- if (force)
- l->l_flags_1 &= ~DF_1_NODELETE;
}
assert (idx == nloaded);
diff --git a/elf/dl-conflict.c b/elf/dl-conflict.c
index 47a946e413..d9ed24d884 100644
--- a/elf/dl-conflict.c
+++ b/elf/dl-conflict.c
@@ -1,5 +1,5 @@
/* Resolve conflicts against already prelinked libraries.
- Copyright (C) 2001-2015 Free Software Foundation, Inc.
+ Copyright (C) 2001-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2001.
diff --git a/elf/dl-debug.c b/elf/dl-debug.c
index e32a5a64e4..30eee97981 100644
--- a/elf/dl-debug.c
+++ b/elf/dl-debug.c
@@ -1,5 +1,5 @@
/* Communicate dynamic linker state to the debugger at runtime.
- Copyright (C) 1996-2015 Free Software Foundation, Inc.
+ Copyright (C) 1996-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index eee146a242..6a82987799 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -1,5 +1,5 @@
/* Load the dependencies of a mapped object.
- Copyright (C) 1996-2015 Free Software Foundation, Inc.
+ Copyright (C) 1996-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-dst.h b/elf/dl-dst.h
index 817b415c77..26bfe65de9 100644
--- a/elf/dl-dst.h
+++ b/elf/dl-dst.h
@@ -1,5 +1,5 @@
/* Handling of dynamic sring tokens.
- Copyright (C) 1999-2015 Free Software Foundation, Inc.
+ Copyright (C) 1999-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-environ.c b/elf/dl-environ.c
index d3463544f4..5240e9de40 100644
--- a/elf/dl-environ.c
+++ b/elf/dl-environ.c
@@ -1,5 +1,5 @@
/* Environment handling for dynamic loader.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-error.c b/elf/dl-error.c
index 0fc3fd846e..bd22ec6cf0 100644
--- a/elf/dl-error.c
+++ b/elf/dl-error.c
@@ -1,5 +1,5 @@
/* Error handling for runtime dynamic linker.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-execstack.c b/elf/dl-execstack.c
index dd3eb3d671..69c966e8e2 100644
--- a/elf/dl-execstack.c
+++ b/elf/dl-execstack.c
@@ -1,5 +1,5 @@
/* Stack executability handling for GNU dynamic linker. Stub version.
- Copyright (C) 2003-2015 Free Software Foundation, Inc.
+ Copyright (C) 2003-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-fini.c b/elf/dl-fini.c
index 6cfe6519c4..5864b8e066 100644
--- a/elf/dl-fini.c
+++ b/elf/dl-fini.c
@@ -1,5 +1,5 @@
/* Call the termination functions of loaded shared objects.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,7 +16,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <alloca.h>
#include <assert.h>
#include <string.h>
#include <ldsodefs.h>
@@ -140,8 +139,6 @@ _dl_fini (void)
using `dlopen' there are possibly several other modules with its
dependencies to be taken into account. Therefore we have to start
determining the order of the modules once again from the beginning. */
- struct link_map **maps = NULL;
- size_t maps_size = 0;
/* We run the destructors of the main namespaces last. As for the
other namespaces, we pick run the destructors in them in reverse
@@ -155,7 +152,6 @@ _dl_fini (void)
/* Protect against concurrent loads and unloads. */
__rtld_lock_lock_recursive (GL(dl_load_lock));
- unsigned int nmaps = 0;
unsigned int nloaded = GL(dl_ns)[ns]._ns_nloaded;
/* No need to do anything for empty namespaces or those used for
auditing DSOs. */
@@ -164,118 +160,107 @@ _dl_fini (void)
|| GL(dl_ns)[ns]._ns_loaded->l_auditing != do_audit
#endif
)
- goto out;
-
- /* XXX Could it be (in static binaries) that there is no object
- loaded? */
- assert (ns != LM_ID_BASE || nloaded > 0);
-
- /* Now we can allocate an array to hold all the pointers and copy
- the pointers in. */
- if (maps_size < nloaded * sizeof (struct link_map *))
+ __rtld_lock_unlock_recursive (GL(dl_load_lock));
+ else
{
- if (maps_size == 0)
+ /* Now we can allocate an array to hold all the pointers and
+ copy the pointers in. */
+ struct link_map *maps[nloaded];
+
+ unsigned int i;
+ struct link_map *l;
+ assert (nloaded != 0 || GL(dl_ns)[ns]._ns_loaded == NULL);
+ for (l = GL(dl_ns)[ns]._ns_loaded, i = 0; l != NULL; l = l->l_next)
+ /* Do not handle ld.so in secondary namespaces. */
+ if (l == l->l_real)
+ {
+ assert (i < nloaded);
+
+ maps[i] = l;
+ l->l_idx = i;
+ ++i;
+
+ /* Bump l_direct_opencount of all objects so that they
+ are not dlclose()ed from underneath us. */
+ ++l->l_direct_opencount;
+ }
+ assert (ns != LM_ID_BASE || i == nloaded);
+ assert (ns == LM_ID_BASE || i == nloaded || i == nloaded - 1);
+ unsigned int nmaps = i;
+
+ /* Now we have to do the sorting. */
+ _dl_sort_fini (maps, nmaps, NULL, ns);
+
+ /* We do not rely on the linked list of loaded object anymore
+ from this point on. We have our own list here (maps). The
+ various members of this list cannot vanish since the open
+ count is too high and will be decremented in this loop. So
+ we release the lock so that some code which might be called
+ from a destructor can directly or indirectly access the
+ lock. */
+ __rtld_lock_unlock_recursive (GL(dl_load_lock));
+
+ /* 'maps' now contains the objects in the right order. Now
+ call the destructors. We have to process this array from
+ the front. */
+ for (i = 0; i < nmaps; ++i)
{
- maps_size = nloaded * sizeof (struct link_map *);
- maps = (struct link_map **) alloca (maps_size);
- }
- else
- maps = (struct link_map **)
- extend_alloca (maps, maps_size,
- nloaded * sizeof (struct link_map *));
- }
+ struct link_map *l = maps[i];
- unsigned int i;
- struct link_map *l;
- assert (nloaded != 0 || GL(dl_ns)[ns]._ns_loaded == NULL);
- for (l = GL(dl_ns)[ns]._ns_loaded, i = 0; l != NULL; l = l->l_next)
- /* Do not handle ld.so in secondary namespaces. */
- if (l == l->l_real)
- {
- assert (i < nloaded);
-
- maps[i] = l;
- l->l_idx = i;
- ++i;
-
- /* Bump l_direct_opencount of all objects so that they are
- not dlclose()ed from underneath us. */
- ++l->l_direct_opencount;
- }
- assert (ns != LM_ID_BASE || i == nloaded);
- assert (ns == LM_ID_BASE || i == nloaded || i == nloaded - 1);
- nmaps = i;
-
- /* Now we have to do the sorting. */
- _dl_sort_fini (maps, nmaps, NULL, ns);
-
- /* We do not rely on the linked list of loaded object anymore from
- this point on. We have our own list here (maps). The various
- members of this list cannot vanish since the open count is too
- high and will be decremented in this loop. So we release the
- lock so that some code which might be called from a destructor
- can directly or indirectly access the lock. */
- out:
- __rtld_lock_unlock_recursive (GL(dl_load_lock));
-
- /* 'maps' now contains the objects in the right order. Now call the
- destructors. We have to process this array from the front. */
- for (i = 0; i < nmaps; ++i)
- {
- l = maps[i];
-
- if (l->l_init_called)
- {
- /* Make sure nothing happens if we are called twice. */
- l->l_init_called = 0;
-
- /* Is there a destructor function? */
- if (l->l_info[DT_FINI_ARRAY] != NULL
- || l->l_info[DT_FINI] != NULL)
+ if (l->l_init_called)
{
- /* When debugging print a message first. */
- if (__builtin_expect (GLRO(dl_debug_mask)
- & DL_DEBUG_IMPCALLS, 0))
- _dl_debug_printf ("\ncalling fini: %s [%lu]\n\n",
- DSO_FILENAME (l->l_name),
- ns);
-
- /* First see whether an array is given. */
- if (l->l_info[DT_FINI_ARRAY] != NULL)
+ /* Make sure nothing happens if we are called twice. */
+ l->l_init_called = 0;
+
+ /* Is there a destructor function? */
+ if (l->l_info[DT_FINI_ARRAY] != NULL
+ || l->l_info[DT_FINI] != NULL)
{
- ElfW(Addr) *array =
- (ElfW(Addr) *) (l->l_addr
- + l->l_info[DT_FINI_ARRAY]->d_un.d_ptr);
- unsigned int i = (l->l_info[DT_FINI_ARRAYSZ]->d_un.d_val
- / sizeof (ElfW(Addr)));
- while (i-- > 0)
- ((fini_t) array[i]) ();
+ /* When debugging print a message first. */
+ if (__builtin_expect (GLRO(dl_debug_mask)
+ & DL_DEBUG_IMPCALLS, 0))
+ _dl_debug_printf ("\ncalling fini: %s [%lu]\n\n",
+ DSO_FILENAME (l->l_name),
+ ns);
+
+ /* First see whether an array is given. */
+ if (l->l_info[DT_FINI_ARRAY] != NULL)
+ {
+ ElfW(Addr) *array =
+ (ElfW(Addr) *) (l->l_addr
+ + l->l_info[DT_FINI_ARRAY]->d_un.d_ptr);
+ unsigned int i = (l->l_info[DT_FINI_ARRAYSZ]->d_un.d_val
+ / sizeof (ElfW(Addr)));
+ while (i-- > 0)
+ ((fini_t) array[i]) ();
+ }
+
+ /* Next try the old-style destructor. */
+ if (l->l_info[DT_FINI] != NULL)
+ DL_CALL_DT_FINI
+ (l, l->l_addr + l->l_info[DT_FINI]->d_un.d_ptr);
}
- /* Next try the old-style destructor. */
- if (l->l_info[DT_FINI] != NULL)
- DL_CALL_DT_FINI(l, l->l_addr + l->l_info[DT_FINI]->d_un.d_ptr);
- }
-
#ifdef SHARED
- /* Auditing checkpoint: another object closed. */
- if (!do_audit && __builtin_expect (GLRO(dl_naudit) > 0, 0))
- {
- struct audit_ifaces *afct = GLRO(dl_audit);
- for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt)
+ /* Auditing checkpoint: another object closed. */
+ if (!do_audit && __builtin_expect (GLRO(dl_naudit) > 0, 0))
{
- if (afct->objclose != NULL)
- /* Return value is ignored. */
- (void) afct->objclose (&l->l_audit[cnt].cookie);
-
- afct = afct->next;
+ struct audit_ifaces *afct = GLRO(dl_audit);
+ for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt)
+ {
+ if (afct->objclose != NULL)
+ /* Return value is ignored. */
+ (void) afct->objclose (&l->l_audit[cnt].cookie);
+
+ afct = afct->next;
+ }
}
- }
#endif
- }
+ }
- /* Correct the previous increment. */
- --l->l_direct_opencount;
+ /* Correct the previous increment. */
+ --l->l_direct_opencount;
+ }
}
}
diff --git a/elf/dl-fptr.c b/elf/dl-fptr.c
index 0137eec05c..1eb360faad 100644
--- a/elf/dl-fptr.c
+++ b/elf/dl-fptr.c
@@ -1,5 +1,5 @@
/* Manage function descriptors. Generic version.
- Copyright (C) 1999-2015 Free Software Foundation, Inc.
+ Copyright (C) 1999-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-hwcaps.c b/elf/dl-hwcaps.c
index 39328edd48..6004ff264d 100644
--- a/elf/dl-hwcaps.c
+++ b/elf/dl-hwcaps.c
@@ -1,5 +1,5 @@
/* Hardware capability support for run-time dynamic loader.
- Copyright (C) 2012-2015 Free Software Foundation, Inc.
+ Copyright (C) 2012-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-init.c b/elf/dl-init.c
index 2f85731ff3..818c3aa37c 100644
--- a/elf/dl-init.c
+++ b/elf/dl-init.c
@@ -1,5 +1,5 @@
/* Run initializers for newly loaded objects.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-iteratephdr.c b/elf/dl-iteratephdr.c
index 906c9ce6f5..1cb6e26233 100644
--- a/elf/dl-iteratephdr.c
+++ b/elf/dl-iteratephdr.c
@@ -1,5 +1,5 @@
/* Get loaded objects program headers.
- Copyright (C) 2001-2015 Free Software Foundation, Inc.
+ Copyright (C) 2001-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2001.
@@ -20,7 +20,7 @@
#include <errno.h>
#include <ldsodefs.h>
#include <stddef.h>
-#include <bits/libc-lock.h>
+#include <libc-lock.h>
static void
cancel_handler (void *arg __attribute__((unused)))
diff --git a/elf/dl-libc.c b/elf/dl-libc.c
index df2732425a..d56de1a57a 100644
--- a/elf/dl-libc.c
+++ b/elf/dl-libc.c
@@ -1,5 +1,5 @@
/* Handle loading and unloading shared objects for internal libc purposes.
- Copyright (C) 1999-2015 Free Software Foundation, Inc.
+ Copyright (C) 1999-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Zack Weinberg <zack@rabi.columbia.edu>, 1999.
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 0c052e449a..c0d6249373 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1,5 +1,5 @@
/* Map in a shared object's segments from the file.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -36,12 +36,14 @@
#include <caller.h>
#include <sysdep.h>
#include <stap-probe.h>
+#include <libc-internal.h>
#include <dl-dst.h>
#include <dl-load.h>
#include <dl-map-segments.h>
#include <dl-unmap-segments.h>
#include <dl-machine-reject-phdr.h>
+#include <dl-sysdep-open.h>
#include <endian.h>
@@ -862,9 +864,10 @@ lose (int code, int fd, const char *name, char *realname, struct link_map *l,
static
#endif
struct link_map *
-_dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
- char *realname, struct link_map *loader, int l_type,
- int mode, void **stack_endp, Lmid_t nsid)
+_dl_map_object_from_fd (const char *name, const char *origname, int fd,
+ struct filebuf *fbp, char *realname,
+ struct link_map *loader, int l_type, int mode,
+ void **stack_endp, Lmid_t nsid)
{
struct link_map *l = NULL;
const ElfW(Ehdr) *header;
@@ -1077,12 +1080,11 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
}
struct loadcmd *c = &loadcmds[nloadcmds++];
- c->mapstart = ph->p_vaddr & ~(GLRO(dl_pagesize) - 1);
- c->mapend = ((ph->p_vaddr + ph->p_filesz + GLRO(dl_pagesize) - 1)
- & ~(GLRO(dl_pagesize) - 1));
+ c->mapstart = ALIGN_DOWN (ph->p_vaddr, GLRO(dl_pagesize));
+ c->mapend = ALIGN_UP (ph->p_vaddr + ph->p_filesz, GLRO(dl_pagesize));
c->dataend = ph->p_vaddr + ph->p_filesz;
c->allocend = ph->p_vaddr + ph->p_memsz;
- c->mapoff = ph->p_offset & ~(GLRO(dl_pagesize) - 1);
+ c->mapoff = ALIGN_DOWN (ph->p_offset, GLRO(dl_pagesize));
/* Determine whether there is a gap between the last segment
and this one. */
@@ -1391,6 +1393,17 @@ cannot enable executable stack as shared object requires");
/* Finally the file information. */
l->l_file_id = id;
+#ifdef SHARED
+ /* When auditing is used the recorded names might not include the
+ name by which the DSO is actually known. Add that as well. */
+ if (__glibc_unlikely (origname != NULL))
+ add_name_to_object (l, origname);
+#else
+ /* Audit modules only exist when linking is dynamic so ORIGNAME
+ cannot be non-NULL. */
+ assert (origname == NULL);
+#endif
+
/* When we profile the SONAME might be needed for something else but
loading. Add it right away. */
if (__glibc_unlikely (GLRO(dl_profile) != NULL)
@@ -1471,9 +1484,13 @@ print_search_path (struct r_search_path_elem **list,
ignore only ELF files for other architectures. Non-ELF files and
ELF files with different header information cause fatal errors since
this could mean there is something wrong in the installation and the
- user might want to know about this. */
+ user might want to know about this.
+
+ If FD is not -1, then the file is already open and FD refers to it.
+ In that case, FD is consumed for both successful and error returns. */
static int
-open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
+open_verify (const char *name, int fd,
+ struct filebuf *fbp, struct link_map *loader,
int whatcode, int mode, bool *found_other_class, bool free_name)
{
/* This is the expected ELF header. */
@@ -1514,6 +1531,7 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
if (__glibc_unlikely (GLRO(dl_naudit) > 0) && whatcode != 0
&& loader->l_auditing == 0)
{
+ const char *original_name = name;
struct audit_ifaces *afct = GLRO(dl_audit);
for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt)
{
@@ -1528,11 +1546,21 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
afct = afct->next;
}
+
+ if (fd != -1 && name != original_name && strcmp (name, original_name))
+ {
+ /* An audit library changed what we're supposed to open,
+ so FD no longer matches it. */
+ __close (fd);
+ fd = -1;
+ }
}
#endif
- /* Open the file. We always open files read-only. */
- int fd = __open (name, O_RDONLY | O_CLOEXEC);
+ if (fd == -1)
+ /* Open the file. We always open files read-only. */
+ fd = __open (name, O_RDONLY | O_CLOEXEC);
+
if (fd != -1)
{
ElfW(Ehdr) *ehdr;
@@ -1801,7 +1829,7 @@ open_path (const char *name, size_t namelen, int mode,
if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
_dl_debug_printf (" trying file=%s\n", buf);
- fd = open_verify (buf, fbp, loader, whatcode, mode,
+ fd = open_verify (buf, -1, fbp, loader, whatcode, mode,
found_other_class, false);
if (this_dir->status[cnt] == unknown)
{
@@ -1904,6 +1932,7 @@ _dl_map_object (struct link_map *loader, const char *name,
int type, int trace_mode, int mode, Lmid_t nsid)
{
int fd;
+ const char *origname = NULL;
char *realname;
char *name_copy;
struct link_map *l;
@@ -1961,6 +1990,7 @@ _dl_map_object (struct link_map *loader, const char *name,
{
if (afct->objsearch != NULL)
{
+ const char *before = name;
name = afct->objsearch (name, &loader->l_audit[cnt].cookie,
LA_SER_ORIG);
if (name == NULL)
@@ -1969,6 +1999,15 @@ _dl_map_object (struct link_map *loader, const char *name,
fd = -1;
goto no_file;
}
+ if (before != name && strcmp (before, name) != 0)
+ {
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
+ _dl_debug_printf ("audit changed filename %s -> %s\n",
+ before, name);
+
+ if (origname == NULL)
+ origname = before;
+ }
}
afct = afct->next;
@@ -2041,6 +2080,20 @@ _dl_map_object (struct link_map *loader, const char *name,
&loader->l_runpath_dirs, &realname, &fb, loader,
LA_SER_RUNPATH, &found_other_class);
+ if (fd == -1)
+ {
+ realname = _dl_sysdep_open_object (name, namelen, &fd);
+ if (realname != NULL)
+ {
+ fd = open_verify (realname, fd,
+ &fb, loader ?: GL(dl_ns)[nsid]._ns_loaded,
+ LA_SER_CONFIG, mode, &found_other_class,
+ false);
+ if (fd == -1)
+ free (realname);
+ }
+ }
+
#ifdef USE_LDCONFIG
if (fd == -1
&& (__glibc_likely ((mode & __RTLD_SECURE) == 0)
@@ -2086,7 +2139,7 @@ _dl_map_object (struct link_map *loader, const char *name,
if (cached != NULL)
{
- fd = open_verify (cached,
+ fd = open_verify (cached, -1,
&fb, loader ?: GL(dl_ns)[nsid]._ns_loaded,
LA_SER_CONFIG, mode, &found_other_class,
false);
@@ -2121,7 +2174,7 @@ _dl_map_object (struct link_map *loader, const char *name,
fd = -1;
else
{
- fd = open_verify (realname, &fb,
+ fd = open_verify (realname, -1, &fb,
loader ?: GL(dl_ns)[nsid]._ns_loaded, 0, mode,
&found_other_class, true);
if (__glibc_unlikely (fd == -1))
@@ -2183,8 +2236,8 @@ _dl_map_object (struct link_map *loader, const char *name,
}
void *stack_end = __libc_stack_end;
- return _dl_map_object_from_fd (name, fd, &fb, realname, loader, type, mode,
- &stack_end, nsid);
+ return _dl_map_object_from_fd (name, origname, fd, &fb, realname, loader,
+ type, mode, &stack_end, nsid);
}
struct add_path_state
diff --git a/elf/dl-load.h b/elf/dl-load.h
index 1aa638ce6d..9fe7118cc7 100644
--- a/elf/dl-load.h
+++ b/elf/dl-load.h
@@ -1,5 +1,5 @@
/* Map in a shared object's segments from the file.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 11cb44b451..f577759a9d 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -1,5 +1,5 @@
/* Look up a symbol in the loaded objects.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -25,7 +25,7 @@
#include <dl-hash.h>
#include <dl-machine.h>
#include <sysdep-cancel.h>
-#include <bits/libc-lock.h>
+#include <libc-lock.h>
#include <tls.h>
#include <atomic.h>
@@ -1016,6 +1016,18 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
#ifdef SHARED
if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
{
+/* ELF_RTYPE_CLASS_XXX must match RTYPE_CLASS_XXX used by prelink with
+ LD_TRACE_PRELINKING. */
+#define RTYPE_CLASS_VALID 8
+#define RTYPE_CLASS_PLT (8|1)
+#define RTYPE_CLASS_COPY (8|2)
+#define RTYPE_CLASS_TLS (8|4)
+#if ELF_RTYPE_CLASS_PLT != 0 && ELF_RTYPE_CLASS_PLT != 1
+# error ELF_RTYPE_CLASS_PLT must be 0 or 1!
+#endif
+#if ELF_RTYPE_CLASS_COPY != 0 && ELF_RTYPE_CLASS_COPY != 2
+# error ELF_RTYPE_CLASS_COPY must be 0 or 2!
+#endif
int conflict = 0;
struct sym_val val = { NULL, NULL };
@@ -1071,12 +1083,17 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
if (value->s)
{
+ /* Keep only ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY
+ bits since since prelink only uses them. */
+ type_class &= ELF_RTYPE_CLASS_PLT | ELF_RTYPE_CLASS_COPY;
if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info)
== STT_TLS))
- type_class = 4;
+ /* Clear the RTYPE_CLASS_VALID bit in RTYPE_CLASS_TLS. */
+ type_class = RTYPE_CLASS_TLS & ~RTYPE_CLASS_VALID;
else if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info)
== STT_GNU_IFUNC))
- type_class |= 8;
+ /* Set the RTYPE_CLASS_VALID bit. */
+ type_class |= RTYPE_CLASS_VALID;
}
if (conflict
diff --git a/elf/dl-machine-reject-phdr.h b/elf/dl-machine-reject-phdr.h
index f071c69b12..bd36ee4e36 100644
--- a/elf/dl-machine-reject-phdr.h
+++ b/elf/dl-machine-reject-phdr.h
@@ -1,5 +1,5 @@
/* Machine-dependent program header inspection for the ELF loader.
- Copyright (C) 2014-2015 Free Software Foundation, Inc.
+ Copyright (C) 2014-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-map-segments.h b/elf/dl-map-segments.h
index baaa8135df..e583f64b3e 100644
--- a/elf/dl-map-segments.h
+++ b/elf/dl-map-segments.h
@@ -1,5 +1,5 @@
/* Map in a shared object's segments. Generic version.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-minimal.c b/elf/dl-minimal.c
index ec7fe88d30..762e65b4d0 100644
--- a/elf/dl-minimal.c
+++ b/elf/dl-minimal.c
@@ -1,5 +1,5 @@
/* Minimal replacements for basic facilities used in the dynamic linker.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -324,11 +324,8 @@ __strtoul_internal (const char *nptr, char **endptr, int base, int group)
also has to be present and it is never about speed when these
functions are used. */
char *
-_itoa (value, buflim, base, upper_case)
- unsigned long long int value;
- char *buflim;
- unsigned int base;
- int upper_case;
+_itoa (unsigned long long int value, char *buflim, unsigned int base,
+ int upper_case)
{
assert (! upper_case);
diff --git a/elf/dl-misc.c b/elf/dl-misc.c
index 2c8b6c5d40..c724e042a8 100644
--- a/elf/dl-misc.c
+++ b/elf/dl-misc.c
@@ -1,5 +1,5 @@
/* Miscellaneous support functions for dynamic linker
- Copyright (C) 1997-2015 Free Software Foundation, Inc.
+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-object.c b/elf/dl-object.c
index 1d58bbc48c..362992b261 100644
--- a/elf/dl-object.c
+++ b/elf/dl-object.c
@@ -1,5 +1,5 @@
/* Storage management for the chain of loaded shared objects.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 2db1c02148..6f178b333d 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -1,5 +1,5 @@
/* Load a shared object at runtime, relocate it, and run its initializer.
- Copyright (C) 1996-2015 Free Software Foundation, Inc.
+ Copyright (C) 1996-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -26,7 +26,7 @@
#include <unistd.h>
#include <sys/mman.h> /* Check whether MAP_COPY is defined. */
#include <sys/param.h>
-#include <bits/libc-lock.h>
+#include <libc-lock.h>
#include <ldsodefs.h>
#include <caller.h>
#include <sysdep-cancel.h>
diff --git a/elf/dl-origin.c b/elf/dl-origin.c
index 206ffb0e95..0204d268d9 100644
--- a/elf/dl-origin.c
+++ b/elf/dl-origin.c
@@ -1,5 +1,5 @@
/* Find path of executable.
- Copyright (C) 1998-2015 Free Software Foundation, Inc.
+ Copyright (C) 1998-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index d97a847c9f..dd7d57079d 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -1,5 +1,5 @@
/* Profiling of shared libraries.
- Copyright (C) 1997-2015 Free Software Foundation, Inc.
+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
Based on the BSD mcount implementation.
diff --git a/elf/dl-profstub.c b/elf/dl-profstub.c
index a74517dce6..8b0c89837d 100644
--- a/elf/dl-profstub.c
+++ b/elf/dl-profstub.c
@@ -1,5 +1,5 @@
/* Helper definitions for profiling of shared libraries.
- Copyright (C) 1998-2015 Free Software Foundation, Inc.
+ Copyright (C) 1998-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
index 61252d7697..14709f960d 100644
--- a/elf/dl-reloc.c
+++ b/elf/dl-reloc.c
@@ -1,5 +1,5 @@
/* Relocate a shared object and resolve its references to other loaded objects.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-runtime.c b/elf/dl-runtime.c
index bd9a1b1c68..92596acf99 100644
--- a/elf/dl-runtime.c
+++ b/elf/dl-runtime.c
@@ -1,5 +1,5 @@
/* On-demand PLT fixup for shared objects.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -57,7 +57,7 @@
function. */
DL_FIXUP_VALUE_TYPE
-__attribute ((noinline)) ARCH_FIXUP_ATTRIBUTE
+attribute_hidden __attribute ((noinline)) ARCH_FIXUP_ATTRIBUTE
_dl_fixup (
# ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS
ELF_MACHINE_RUNTIME_FIXUP_ARGS,
diff --git a/elf/dl-scope.c b/elf/dl-scope.c
index 8cfea660b4..32b276751a 100644
--- a/elf/dl-scope.c
+++ b/elf/dl-scope.c
@@ -1,5 +1,5 @@
/* Memory handling for the scope data structures.
- Copyright (C) 2009-2015 Free Software Foundation, Inc.
+ Copyright (C) 2009-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 4d036f12dd..c30194c7b7 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -1,5 +1,5 @@
/* Support for dynamic linking code in static libc.
- Copyright (C) 1996-2015 Free Software Foundation, Inc.
+ Copyright (C) 1996-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -27,7 +27,7 @@
#include <stdint.h>
#include <ldsodefs.h>
#include <dl-machine.h>
-#include <bits/libc-lock.h>
+#include <libc-lock.h>
#include <dl-cache.h>
#include <dl-librecon.h>
#include <dl-procinfo.h>
@@ -91,7 +91,6 @@ static struct link_map _dl_main_map =
.l_scope = _dl_main_map.l_scope_mem,
.l_local_scope = { &_dl_main_map.l_searchlist },
.l_used = 1,
- .l_flags_1 = DF_1_NODEFLIB,
.l_tls_offset = NO_TLS_OFFSET,
.l_serial = 1,
};
@@ -245,6 +244,9 @@ _dl_aux_init (ElfW(auxv_t) *av)
case AT_PHNUM:
GL(dl_phnum) = av->a_un.a_val;
break;
+ case AT_PLATFORM:
+ GLRO(dl_platform) = (void *) av->a_un.a_val;
+ break;
case AT_HWCAP:
GLRO(dl_hwcap) = (unsigned long int) av->a_un.a_val;
break;
diff --git a/elf/dl-sym.c b/elf/dl-sym.c
index 56fea86fa8..6431c22614 100644
--- a/elf/dl-sym.c
+++ b/elf/dl-sym.c
@@ -1,5 +1,5 @@
/* Look up a symbol in a shared object loaded by `dlopen'.
- Copyright (C) 1999-2015 Free Software Foundation, Inc.
+ Copyright (C) 1999-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-symaddr.c b/elf/dl-symaddr.c
index e18a203184..b3b97418c5 100644
--- a/elf/dl-symaddr.c
+++ b/elf/dl-symaddr.c
@@ -1,5 +1,5 @@
/* Get the symbol address. Generic version.
- Copyright (C) 1999-2015 Free Software Foundation, Inc.
+ Copyright (C) 1999-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-sysdep-open.h b/elf/dl-sysdep-open.h
new file mode 100644
index 0000000000..471315270d
--- /dev/null
+++ b/elf/dl-sysdep-open.h
@@ -0,0 +1,45 @@
+/* System-specific call to open a shared object by name. Stub version.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _DL_SYSDEP_OPEN_H
+#define _DL_SYSDEP_OPEN_H 1
+
+#include <assert.h>
+#include <stddef.h>
+
+/* NAME is a name without slashes, as it appears in a DT_NEEDED entry
+ or a dlopen call's argument or suchlike. NAMELEN is (strlen (NAME) + 1).
+
+ Find NAME in an OS-dependent fashion, and return its "real" name.
+ Optionally fill in *FD with a file descriptor open on that file (or
+ else leave its initial value of -1). The return value is a new
+ malloc'd string, which will be free'd by the caller. If NAME is
+ resolved to an actual file that can be opened, then the return
+ value should name that file (and if *FD was not set, then a normal
+ __open call on that string will be made). If *FD was set by some
+ other means than a normal open and there is no "real" name to use,
+ then __strdup (NAME) is fine (modulo error checking). */
+
+static inline char *
+_dl_sysdep_open_object (const char *name, size_t namelen, int *fd)
+{
+ assert (*fd == -1);
+ return NULL;
+}
+
+#endif /* dl-sysdep-open.h */
diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c
index 1cc7ea344d..eaa71556d2 100644
--- a/elf/dl-sysdep.c
+++ b/elf/dl-sysdep.c
@@ -1,5 +1,5 @@
/* Operating system support for run-time dynamic linker. Generic Unix version.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-tls.c b/elf/dl-tls.c
index 20c7e33c41..ed13fd950b 100644
--- a/elf/dl-tls.c
+++ b/elf/dl-tls.c
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. Generic version.
- Copyright (C) 2002-2015 Free Software Foundation, Inc.
+ Copyright (C) 2002-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-tsd.c b/elf/dl-tsd.c
index e3e4d972b6..7181e1c9e0 100644
--- a/elf/dl-tsd.c
+++ b/elf/dl-tsd.c
@@ -1,5 +1,5 @@
/* Thread-local data used by error handling for runtime dynamic linker.
- Copyright (C) 2002-2015 Free Software Foundation, Inc.
+ Copyright (C) 2002-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-unmap-segments.h b/elf/dl-unmap-segments.h
index ae802003ce..44d91c4398 100644
--- a/elf/dl-unmap-segments.h
+++ b/elf/dl-unmap-segments.h
@@ -1,5 +1,5 @@
/* Unmap a shared object's segments. Generic version.
- Copyright (C) 2014-2015 Free Software Foundation, Inc.
+ Copyright (C) 2014-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dl-version.c b/elf/dl-version.c
index f6e5cd9e75..3843f8fdf0 100644
--- a/elf/dl-version.c
+++ b/elf/dl-version.c
@@ -1,5 +1,5 @@
/* Handle symbol and library versioning.
- Copyright (C) 1997-2015 Free Software Foundation, Inc.
+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
diff --git a/elf/dl-writev.h b/elf/dl-writev.h
index 3e6d2f4975..0c8c787cc9 100644
--- a/elf/dl-writev.h
+++ b/elf/dl-writev.h
@@ -1,5 +1,5 @@
/* Message-writing for the dynamic linker. Generic version.
- Copyright (C) 2013-2015 Free Software Foundation, Inc.
+ Copyright (C) 2013-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -18,7 +18,7 @@
#include <sys/uio.h>
#include <ldsodefs.h>
-#include <bits/libc-lock.h>
+#include <libc-lock.h>
/* This is used from only one place: dl-misc.c:_dl_debug_vdprintf.
Hence it's in a header with the expectation it will be inlined.
diff --git a/elf/do-rel.h b/elf/do-rel.h
index 0569b0a163..10c284661d 100644
--- a/elf/do-rel.h
+++ b/elf/do-rel.h
@@ -1,5 +1,5 @@
/* Do relocations for ELF dynamic linking.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h
index 8d428e20d3..9fb6459236 100644
--- a/elf/dynamic-link.h
+++ b/elf/dynamic-link.h
@@ -1,5 +1,5 @@
/* Inline functions for dynamic linking.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -42,7 +42,8 @@
&& (__builtin_expect ((sym_map)->l_tls_offset != NO_TLS_OFFSET, 1) \
|| _dl_try_allocate_static_tls (sym_map) == 0))
-int internal_function _dl_try_allocate_static_tls (struct link_map *map);
+int internal_function attribute_hidden
+ _dl_try_allocate_static_tls (struct link_map *map);
#include <elf.h>
@@ -135,16 +136,18 @@ elf_machine_lazy_rel (struct link_map *map,
\
if (ranges[0].start + ranges[0].size == (start + size)) \
ranges[0].size -= size; \
- if (! ELF_DURING_STARTUP && ((do_lazy) || ranges[0].size == 0)) \
+ if (ELF_DURING_STARTUP \
+ || (!(do_lazy) \
+ && (ranges[0].start + ranges[0].size) == start)) \
{ \
- ranges[1].start = start; \
- ranges[1].size = size; \
- ranges[1].lazy = (do_lazy); \
+ /* Combine processing the sections. */ \
+ ranges[0].size += size; \
} \
else \
{ \
- /* Combine processing the sections. */ \
- ranges[0].size += size; \
+ ranges[1].start = start; \
+ ranges[1].size = size; \
+ ranges[1].lazy = (do_lazy); \
} \
} \
\
diff --git a/elf/elf.h b/elf/elf.h
index fbadda4377..15f5a75dec 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -1,5 +1,5 @@
/* This file defines standard ELF types, structures, and macros.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/enbl-secure.c b/elf/enbl-secure.c
index 7d04ffb93e..5ac4e5ac91 100644
--- a/elf/enbl-secure.c
+++ b/elf/enbl-secure.c
@@ -1,5 +1,5 @@
/* Define and initialize the `__libc_enable_secure' flag. Generic version.
- Copyright (C) 1996-2015 Free Software Foundation, Inc.
+ Copyright (C) 1996-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/genrtldtbl.awk b/elf/genrtldtbl.awk
index 54cdc8c589..0e2a374901 100644
--- a/elf/genrtldtbl.awk
+++ b/elf/genrtldtbl.awk
@@ -1,4 +1,4 @@
-#! /usr/bin/awk
+#!/usr/bin/awk
BEGIN {
FS=":";
count=0;
diff --git a/elf/get-dynamic-info.h b/elf/get-dynamic-info.h
index dc8359d36a..4cf18a46cc 100644
--- a/elf/get-dynamic-info.h
+++ b/elf/get-dynamic-info.h
@@ -1,5 +1,5 @@
/* Read the dynamic section at DYN and fill in INFO with indices DT_*.
- Copyright (C) 2012-2015 Free Software Foundation, Inc.
+ Copyright (C) 2012-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/interp.c b/elf/interp.c
index 422ea95e9d..9448802a8b 100644
--- a/elf/interp.c
+++ b/elf/interp.c
@@ -1,5 +1,5 @@
/* interp - add information about dynamic loader to shared library objects.
- Copyright (C) 1996-2015 Free Software Foundation, Inc.
+ Copyright (C) 1996-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index f54ec22d24..9c6f2ba791 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2015 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1999.
@@ -324,7 +324,7 @@ print_version (FILE *stream, struct argp_state *state)
Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2015");
+"), "2016");
fprintf (stream, gettext ("Written by %s.\n"),
"Andreas Jaeger");
}
diff --git a/elf/ldd.bash.in b/elf/ldd.bash.in
index 7fb6c157a0..80a7cd59cd 100644
--- a/elf/ldd.bash.in
+++ b/elf/ldd.bash.in
@@ -1,5 +1,5 @@
#! @BASH@
-# Copyright (C) 1996-2015 Free Software Foundation, Inc.
+# Copyright (C) 1996-2016 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -38,7 +38,7 @@ while test $# -gt 0; do
printf $"Copyright (C) %s Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-" "2015"
+" "2016"
printf $"Written by %s and %s.
" "Roland McGrath" "Ulrich Drepper"
exit 0
diff --git a/elf/link.h b/elf/link.h
index eaca8028e4..f448141bab 100644
--- a/elf/link.h
+++ b/elf/link.h
@@ -1,6 +1,6 @@
/* Data structure for communication from the run-time dynamic linker for
loaded ELF shared objects.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/pldd-xx.c b/elf/pldd-xx.c
index 2f1962883c..76f7ab43fd 100644
--- a/elf/pldd-xx.c
+++ b/elf/pldd-xx.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
diff --git a/elf/pldd.c b/elf/pldd.c
index 2b862248a6..1bf74442ba 100644
--- a/elf/pldd.c
+++ b/elf/pldd.c
@@ -1,5 +1,5 @@
/* List dynamic shared objects linked into given process.
- Copyright (C) 2011-2015 Free Software Foundation, Inc.
+ Copyright (C) 2011-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
@@ -269,7 +269,7 @@ print_version (FILE *stream, struct argp_state *state)
Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2015");
+"), "2016");
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
}
diff --git a/elf/readelflib.c b/elf/readelflib.c
index 89e4ce9492..89b5292a2a 100644
--- a/elf/readelflib.c
+++ b/elf/readelflib.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2015 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1999 and
Jakub Jelinek <jakub@redhat.com>, 1999.
diff --git a/elf/readlib.c b/elf/readlib.c
index 7fd5b8afbf..8a66ffe9d4 100644
--- a/elf/readlib.c
+++ b/elf/readlib.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2015 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1999 and
Jakub Jelinek <jakub@redhat.com>, 1999.
diff --git a/elf/rtld-Rules b/elf/rtld-Rules
index 7433fdfcde..94ca39bff2 100644
--- a/elf/rtld-Rules
+++ b/elf/rtld-Rules
@@ -1,6 +1,6 @@
# Subroutine makefile for compiling libc modules linked into dynamic linker.
-# Copyright (C) 2002-2015 Free Software Foundation, Inc.
+# Copyright (C) 2002-2016 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/rtld.c b/elf/rtld.c
index 69873c2368..647661ca45 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1,5 +1,5 @@
/* Run time dynamic linker.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -31,7 +31,7 @@
#include <entry.h>
#include <fpu_control.h>
#include <hp-timing.h>
-#include <bits/libc-lock.h>
+#include <libc-lock.h>
#include "dynamic-link.h"
#include <dl-librecon.h>
#include <unsecvars.h>
@@ -162,7 +162,6 @@ struct rtld_global_ro _rtld_global_ro attribute_relro =
._dl_hwcap_mask = HWCAP_IMPORTANT,
._dl_lazy = 1,
._dl_fpu_control = _FPU_DEFAULT,
- ._dl_pointer_guard = 1,
._dl_pagesize = EXEC_PAGESIZE,
._dl_inhibit_cache = 0,
@@ -709,15 +708,12 @@ security_init (void)
#endif
/* Set up the pointer guard as well, if necessary. */
- if (GLRO(dl_pointer_guard))
- {
- uintptr_t pointer_chk_guard = _dl_setup_pointer_guard (_dl_random,
- stack_chk_guard);
+ uintptr_t pointer_chk_guard
+ = _dl_setup_pointer_guard (_dl_random, stack_chk_guard);
#ifdef THREAD_SET_POINTER_GUARD
- THREAD_SET_POINTER_GUARD (pointer_chk_guard);
+ THREAD_SET_POINTER_GUARD (pointer_chk_guard);
#endif
- __pointer_chk_guard_local = pointer_chk_guard;
- }
+ __pointer_chk_guard_local = pointer_chk_guard;
/* We do not need the _dl_random value anymore. The less
information we leave behind, the better, so clear the
@@ -2471,9 +2467,6 @@ process_envvars (enum mode *modep)
GLRO(dl_use_load_bias) = envline[14] == '1' ? -1 : 0;
break;
}
-
- if (memcmp (envline, "POINTER_GUARD", 13) == 0)
- GLRO(dl_pointer_guard) = envline[14] != '0';
break;
case 14:
diff --git a/elf/setup-vdso.h b/elf/setup-vdso.h
index 8f2c70146c..e6f1dd809b 100644
--- a/elf/setup-vdso.h
+++ b/elf/setup-vdso.h
@@ -1,5 +1,5 @@
/* Set up the data structures for the system-supplied DSO.
- Copyright (C) 2012-2015 Free Software Foundation, Inc.
+ Copyright (C) 2012-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/sln.c b/elf/sln.c
index 1a7d24e6dc..9d57be2df5 100644
--- a/elf/sln.c
+++ b/elf/sln.c
@@ -1,5 +1,5 @@
/* `sln' program to create symbolic links between files.
- Copyright (C) 1998-2015 Free Software Foundation, Inc.
+ Copyright (C) 1998-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -87,8 +87,7 @@ usage (void)
}
static int
-makesymlinks (file)
- const char *file;
+makesymlinks (const char *file)
{
#ifndef PATH_MAX
#define PATH_MAX 4095
@@ -163,9 +162,7 @@ makesymlinks (file)
}
static int
-makesymlink (src, dest)
- const char *src;
- const char *dest;
+makesymlink (const char *src, const char *dest)
{
struct stat stats;
const char *error;
diff --git a/elf/sotruss-lib.c b/elf/sotruss-lib.c
index 3880de32c6..174f53f7c5 100644
--- a/elf/sotruss-lib.c
+++ b/elf/sotruss-lib.c
@@ -1,5 +1,5 @@
/* Trace calls through PLTs and show caller, callee, and parameters.
- Copyright (C) 2011-2015 Free Software Foundation, Inc.
+ Copyright (C) 2011-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
diff --git a/elf/sotruss.sh b/elf/sotruss.sh
index c458585ccb..07f6281e6b 100755
--- a/elf/sotruss.sh
+++ b/elf/sotruss.sh
@@ -1,5 +1,5 @@
#! @BASH@
-# Copyright (C) 2011-2015 Free Software Foundation, Inc.
+# Copyright (C) 2011-2016 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -75,7 +75,7 @@ while test $# -gt 0; do
printf $"Copyright (C) %s Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-" "2015"
+" "2016"
printf $"Written by %s.\n" "Ulrich Drepper"
exit 0
;;
diff --git a/elf/sprof.c b/elf/sprof.c
index ec3fde3848..acf2c205d6 100644
--- a/elf/sprof.c
+++ b/elf/sprof.c
@@ -1,5 +1,5 @@
/* Read and display shared object profiling data.
- Copyright (C) 1997-2015 Free Software Foundation, Inc.
+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -391,7 +391,7 @@ Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
"),
- "2015");
+ "2016");
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
}
diff --git a/elf/static-stubs.c b/elf/static-stubs.c
index 3407fe691b..7af36fc8dd 100644
--- a/elf/static-stubs.c
+++ b/elf/static-stubs.c
@@ -1,6 +1,6 @@
/* Stub implementations of functions to link into statically linked
programs without needing libgcc_eh.
- Copyright (C) 2012-2015 Free Software Foundation, Inc.
+ Copyright (C) 2012-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/tlsdeschtab.h b/elf/tlsdeschtab.h
index fb0eb88e7e..38eba77472 100644
--- a/elf/tlsdeschtab.h
+++ b/elf/tlsdeschtab.h
@@ -1,5 +1,5 @@
/* Hash table for TLS descriptors.
- Copyright (C) 2005-2015 Free Software Foundation, Inc.
+ Copyright (C) 2005-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Alexandre Oliva <aoliva@redhat.com>
diff --git a/elf/tst-align.c b/elf/tst-align.c
index 124bc31e20..10caa41e3e 100644
--- a/elf/tst-align.c
+++ b/elf/tst-align.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
diff --git a/elf/tst-align2.c b/elf/tst-align2.c
index ec16e6e0b0..d5ec4aaa8f 100644
--- a/elf/tst-align2.c
+++ b/elf/tst-align2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2005.
diff --git a/elf/tst-alignmod.c b/elf/tst-alignmod.c
index 30b5cd1d6d..c95b1f7387 100644
--- a/elf/tst-alignmod.c
+++ b/elf/tst-alignmod.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
diff --git a/elf/tst-alignmod2.c b/elf/tst-alignmod2.c
index 888814688b..2b43bd41bb 100644
--- a/elf/tst-alignmod2.c
+++ b/elf/tst-alignmod2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
diff --git a/elf/tst-audit11.c b/elf/tst-audit11.c
new file mode 100644
index 0000000000..0bcfd85a57
--- /dev/null
+++ b/elf/tst-audit11.c
@@ -0,0 +1,36 @@
+/* Test version symbol binding can find a DSO replaced by la_objsearch.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <dlfcn.h>
+#include <stdio.h>
+
+int
+do_test (void)
+{
+ puts ("Start");
+ if (dlopen ("$ORIGIN/tst-audit11mod1.so", RTLD_LAZY) == NULL)
+ {
+ printf ("module not loaded: %s\n", dlerror ());
+ return 1;
+ }
+ puts ("OK");
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/elf/tst-audit11mod1.c b/elf/tst-audit11mod1.c
new file mode 100644
index 0000000000..90be27780e
--- /dev/null
+++ b/elf/tst-audit11mod1.c
@@ -0,0 +1,24 @@
+/* DSO directly opened by tst-audit11.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+extern int f2 (void);
+int
+f1 (void)
+{
+ return f2 ();
+}
diff --git a/elf/tst-audit11mod2.c b/elf/tst-audit11mod2.c
new file mode 100644
index 0000000000..b0e4936586
--- /dev/null
+++ b/elf/tst-audit11mod2.c
@@ -0,0 +1,23 @@
+/* DSO indirectly opened by tst-audit11, with symbol versioning.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+int
+f2 (void)
+{
+ return 42;
+}
diff --git a/elf/tst-audit11mod2.map b/elf/tst-audit11mod2.map
new file mode 100644
index 0000000000..b0b263df08
--- /dev/null
+++ b/elf/tst-audit11mod2.map
@@ -0,0 +1,22 @@
+/* Symbol versioning for the DSO indirectly opened by tst-audit11.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+V1 {
+ global: f2;
+ local: *;
+};
diff --git a/elf/tst-audit12.c b/elf/tst-audit12.c
new file mode 100644
index 0000000000..03dcf49597
--- /dev/null
+++ b/elf/tst-audit12.c
@@ -0,0 +1,49 @@
+/* Test that symbol is bound to a DSO replaced by la_objsearch.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <dlfcn.h>
+#include <stdio.h>
+
+int
+do_test (void)
+{
+ puts ("Start");
+ void *h = dlopen ("$ORIGIN/tst-audit12mod1.so", RTLD_LAZY);
+ if (h == NULL)
+ {
+ printf ("module not loaded: %s\n", dlerror ());
+ return 1;
+ }
+ int (*fp) (void) = (int (*) (void)) dlsym (h, "f1");
+ if (fp == NULL)
+ {
+ printf ("function f1 not found: %s\n", dlerror ());
+ return 1;
+ }
+ int res = fp ();
+ if (res != 43)
+ {
+ puts ("incorrect function f2 called");
+ return 1;
+ }
+ printf ("%d is OK\n", res);
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/elf/tst-audit12mod1.c b/elf/tst-audit12mod1.c
new file mode 100644
index 0000000000..d452596185
--- /dev/null
+++ b/elf/tst-audit12mod1.c
@@ -0,0 +1,24 @@
+/* DSO directly opened by tst-audit12.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+extern int f2 (void);
+int
+f1 (void)
+{
+ return f2 ();
+}
diff --git a/elf/tst-audit12mod2.c b/elf/tst-audit12mod2.c
new file mode 100644
index 0000000000..bc81cebc77
--- /dev/null
+++ b/elf/tst-audit12mod2.c
@@ -0,0 +1,23 @@
+/* Replaced DSO referenced by tst-audit12mod1.so, for tst-audit12.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+int
+f2 (void)
+{
+ return 42;
+}
diff --git a/elf/tst-audit12mod2.map b/elf/tst-audit12mod2.map
new file mode 100644
index 0000000000..43ce1c8ca0
--- /dev/null
+++ b/elf/tst-audit12mod2.map
@@ -0,0 +1,22 @@
+/* Symbol versioning for tst-audit12mod2.so used by tst-audit12.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+V1 {
+ global: f2;
+ local: *;
+};
diff --git a/elf/tst-audit12mod3.c b/elf/tst-audit12mod3.c
new file mode 100644
index 0000000000..21f109c453
--- /dev/null
+++ b/elf/tst-audit12mod3.c
@@ -0,0 +1,23 @@
+/* Replacement DSO loaded by the audit module, for tst-audit12.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+int
+f2 (void)
+{
+ return 43;
+}
diff --git a/elf/tst-auditmod11.c b/elf/tst-auditmod11.c
new file mode 100644
index 0000000000..7e1403e797
--- /dev/null
+++ b/elf/tst-auditmod11.c
@@ -0,0 +1,39 @@
+/* Audit module for tst-audit11.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <link.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+unsigned int
+la_version (unsigned int version)
+{
+ return version;
+}
+
+char *
+la_objsearch (const char *name, uintptr_t *cookie, unsigned int flag)
+{
+ if (strcmp (name, "tst-audit11mod2.so") == 0)
+ {
+ return (char *) "$ORIGIN/tst-audit11mod2.so";
+ }
+ return (char *) name;
+}
diff --git a/elf/tst-auditmod12.c b/elf/tst-auditmod12.c
new file mode 100644
index 0000000000..9f0f1e7c64
--- /dev/null
+++ b/elf/tst-auditmod12.c
@@ -0,0 +1,43 @@
+/* Audit module for tst-audit12.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <link.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+unsigned int
+la_version (unsigned int version)
+{
+ return version;
+}
+
+char *
+la_objsearch (const char *name, uintptr_t *cookie, unsigned int flag)
+{
+ const char target[] = "tst-audit12mod2.so";
+
+ size_t namelen = strlen (name);
+ if (namelen >= sizeof (target) - 1
+ && strcmp (name + namelen - (sizeof (target) - 1), target) == 0)
+ {
+ return (char *) "$ORIGIN/tst-audit12mod3.so";
+ }
+ return (char *) name;
+}
diff --git a/elf/tst-auxv.c b/elf/tst-auxv.c
index 79b12a5f30..f77e3e0f53 100644
--- a/elf/tst-auxv.c
+++ b/elf/tst-auxv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2013-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/tst-dl-iter-static.c b/elf/tst-dl-iter-static.c
index fa83526d6d..c525baaa01 100644
--- a/elf/tst-dl-iter-static.c
+++ b/elf/tst-dl-iter-static.c
@@ -1,5 +1,5 @@
/* BZ #16046 dl_iterate_phdr static executable test.
- Copyright (C) 2014-2015 Free Software Foundation, Inc.
+ Copyright (C) 2014-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/tst-dlmodcount.c b/elf/tst-dlmodcount.c
index 64df2fa18a..71653c3e1a 100644
--- a/elf/tst-dlmodcount.c
+++ b/elf/tst-dlmodcount.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2004-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David Mosberger <davidm@hpl.hp.com>, 2004.
@@ -92,8 +92,8 @@ unload (const char *path, void *handle)
dl_iterate_phdr (callback, (void *)(intptr_t) REMOVE);
}
-int
-main (int argc, char **argv)
+static int
+do_test (void)
{
void *handle1, *handle2;
@@ -104,3 +104,6 @@ main (int argc, char **argv)
unload ("globalmod1.so", handle2);
return 0;
}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/elf/tst-dlmopen1.c b/elf/tst-dlmopen1.c
index 9839267d8f..5a05891846 100644
--- a/elf/tst-dlmopen1.c
+++ b/elf/tst-dlmopen1.c
@@ -2,6 +2,7 @@
#include <stdio.h>
#include <gnu/lib-names.h>
+#define TEST_SO "$ORIGIN/tst-dlmopen1mod.so"
static int
do_test (void)
@@ -34,7 +35,7 @@ do_test (void)
return 1;
}
- h = dlmopen (LM_ID_NEWLM, "$ORIGIN/tst-dlmopen1mod.so", RTLD_LAZY);
+ h = dlmopen (LM_ID_NEWLM, TEST_SO, RTLD_LAZY);
if (h == NULL)
{
printf ("cannot get handle for %s: %s\n",
@@ -52,7 +53,7 @@ do_test (void)
if (ns == LM_ID_BASE)
{
- printf ("namespace for %s is LM_ID_BASE\n", LIBC_SO);
+ printf ("namespace for %s is LM_ID_BASE\n", TEST_SO);
return 1;
}
@@ -69,7 +70,7 @@ do_test (void)
if (dlclose (h) != 0)
{
printf ("dlclose for %s in %s failed: %s\n",
- LIBC_SO, __func__, dlerror ());
+ TEST_SO, __func__, dlerror ());
return 1;
}
diff --git a/elf/tst-dlopen-aout.c b/elf/tst-dlopen-aout.c
index 1281bdff03..11dd3054c1 100644
--- a/elf/tst-dlopen-aout.c
+++ b/elf/tst-dlopen-aout.c
@@ -3,7 +3,7 @@
Verify that incorrectly dlopen()ing an executable without
__RTLD_OPENEXEC does not cause assertion in ld.so.
- Copyright (C) 2014-2015 Free Software Foundation, Inc.
+ Copyright (C) 2014-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/tst-dlopenrpath.c b/elf/tst-dlopenrpath.c
index 04decbe629..12fbf4ceaf 100644
--- a/elf/tst-dlopenrpath.c
+++ b/elf/tst-dlopenrpath.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2004-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
diff --git a/elf/tst-dlopenrpathmod.c b/elf/tst-dlopenrpathmod.c
index bf0f6be4c2..d89cfcb285 100644
--- a/elf/tst-dlopenrpathmod.c
+++ b/elf/tst-dlopenrpathmod.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2004-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
diff --git a/elf/tst-nodelete-opened-lib.c b/elf/tst-nodelete-opened-lib.c
index 994702a9c5..8acb1d8ee1 100644
--- a/elf/tst-nodelete-opened-lib.c
+++ b/elf/tst-nodelete-opened-lib.c
@@ -1,5 +1,5 @@
/* Verify that objects opened with RTLD_NODELETE are not unloaded - the DSO.
- Copyright (C) 2015 Free Software Foundation, Inc.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/tst-nodelete-opened.c b/elf/tst-nodelete-opened.c
index 501d005f81..75d382eba3 100644
--- a/elf/tst-nodelete-opened.c
+++ b/elf/tst-nodelete-opened.c
@@ -1,7 +1,7 @@
/* Verify that an already opened DSO opened agained with RTLD_NODELETE actually
sets the NODELETE flag.
- Copyright (C) 2015 Free Software Foundation, Inc.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/tst-nodelete2.c b/elf/tst-nodelete2.c
new file mode 100644
index 0000000000..388e8afb32
--- /dev/null
+++ b/elf/tst-nodelete2.c
@@ -0,0 +1,37 @@
+#include "../dlfcn/dlfcn.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <gnu/lib-names.h>
+
+static int
+do_test (void)
+{
+ int result = 0;
+
+ printf ("\nOpening pthread library.\n");
+ void *pthread = dlopen (LIBPTHREAD_SO, RTLD_LAZY);
+
+ /* This is a test for correct DF_1_NODELETE clearing when dlopen failure
+ happens. We should clear DF_1_NODELETE for failed library only, because
+ doing this for others (e.g. libpthread) might cause them to be unloaded,
+ that may lead to some global references (e.g. __rtld_lock_unlock) to be
+ broken. The dlopen should fail because of undefined symbols in shared
+ library, that cause DF_1_NODELETE to be cleared. For libpthread, this
+ flag should be set, because if not, SIGSEGV will happen in dlclose. */
+ if (dlopen ("tst-nodelete2mod.so", RTLD_NOW) != NULL)
+ {
+ printf ("Unique symbols test failed\n");
+ result = 1;
+ }
+
+ if (pthread)
+ dlclose (pthread);
+
+ if (result == 0)
+ printf ("SUCCESS\n");
+
+ return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/elf/tst-znodelete-zlib.cc b/elf/tst-nodelete2mod.c
index 1e8f3686d7..e88c756f5e 100644
--- a/elf/tst-znodelete-zlib.cc
+++ b/elf/tst-nodelete2mod.c
@@ -1,6 +1,7 @@
+/* Undefined symbol. */
extern int not_exist (void);
int foo (void)
{
- return not_exist ();
+ return not_exist ();
}
diff --git a/elf/tst-null-argv-lib.c b/elf/tst-null-argv-lib.c
index a1953b69eb..6eba436813 100644
--- a/elf/tst-null-argv-lib.c
+++ b/elf/tst-null-argv-lib.c
@@ -1,6 +1,6 @@
/* Verify that program does not crash when LD_DEBUG is set and the program name
is not available. This is the library.
- Copyright (C) 2013-2015 Free Software Foundation, Inc.
+ Copyright (C) 2013-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/tst-null-argv.c b/elf/tst-null-argv.c
index 2e0e6bc155..e9a621e76e 100644
--- a/elf/tst-null-argv.c
+++ b/elf/tst-null-argv.c
@@ -1,6 +1,6 @@
/* Verify that program does not crash when LD_DEBUG is set and the program name
is not available.
- Copyright (C) 2013-2015 Free Software Foundation, Inc.
+ Copyright (C) 2013-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/tst-order-main.c b/elf/tst-order-main.c
index 80f4f6be18..339778a93a 100644
--- a/elf/tst-order-main.c
+++ b/elf/tst-order-main.c
@@ -2,9 +2,12 @@
#include <unistd.h>
#include <stdlib.h>
-int
-main( int argc, char *argv[] )
+static int
+do_test (void)
{
printf( "main\n" );
exit(EXIT_SUCCESS);
}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/elf/tst-pathopt.sh b/elf/tst-pathopt.sh
index 85d0be262d..309b628bc9 100755
--- a/elf/tst-pathopt.sh
+++ b/elf/tst-pathopt.sh
@@ -1,6 +1,6 @@
-#! /bin/sh
+#!/bin/sh
# Test lookup path optimization.
-# Copyright (C) 2000-2015 Free Software Foundation, Inc.
+# Copyright (C) 2000-2016 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/tst-pie2.c b/elf/tst-pie2.c
index b76b3236e4..4c2daffb47 100644
--- a/elf/tst-pie2.c
+++ b/elf/tst-pie2.c
@@ -1,6 +1,6 @@
/* Test case for BZ #16381
- Copyright (C) 2014-2015 Free Software Foundation, Inc.
+ Copyright (C) 2014-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -31,8 +31,11 @@ init_g (void)
g += 1;
}
-int
-main (int argc, char *argv[])
+static int
+do_test (void)
{
return 0;
}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/elf/tst-prelink.c b/elf/tst-prelink.c
new file mode 100644
index 0000000000..bb6df7ade7
--- /dev/null
+++ b/elf/tst-prelink.c
@@ -0,0 +1,30 @@
+/* Test the output from the environment variable, LD_TRACE_PRELINKING,
+ for prelink.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+
+static int
+do_test (void)
+{
+ fprintf (stdout, "hello\n");
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/elf/tst-prelink.exp b/elf/tst-prelink.exp
new file mode 100644
index 0000000000..b35b4c9705
--- /dev/null
+++ b/elf/tst-prelink.exp
@@ -0,0 +1 @@
+/0 stdout
diff --git a/elf/tst-protected1a.c b/elf/tst-protected1a.c
index f4e76895a9..1c55440624 100644
--- a/elf/tst-protected1a.c
+++ b/elf/tst-protected1a.c
@@ -7,7 +7,7 @@
4. Symbol, protected2, defined in main, is used in main.
5. Symbol, protected3, defined in moda, is also used in main.
- Copyright (C) 2015 Free Software Foundation, Inc.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/tst-protected1b.c b/elf/tst-protected1b.c
index 56352c406f..9dc8b87d95 100644
--- a/elf/tst-protected1b.c
+++ b/elf/tst-protected1b.c
@@ -7,7 +7,7 @@
4. Symbol, protected2, defined in main, is used in main.
5. Symbol, protected3, defined in modb, is also used in main.
- Copyright (C) 2015 Free Software Foundation, Inc.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/tst-protected1mod.h b/elf/tst-protected1mod.h
index 301e019dd8..71683ae86b 100644
--- a/elf/tst-protected1mod.h
+++ b/elf/tst-protected1mod.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/tst-protected1moda.c b/elf/tst-protected1moda.c
index 720f474281..915bb1f3ff 100644
--- a/elf/tst-protected1moda.c
+++ b/elf/tst-protected1moda.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/tst-protected1modb.c b/elf/tst-protected1modb.c
index ddfa646ec3..c20e8606f3 100644
--- a/elf/tst-protected1modb.c
+++ b/elf/tst-protected1modb.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/tst-ptrguard1.c b/elf/tst-ptrguard1.c
index 55fda84f42..c9d80df758 100644
--- a/elf/tst-ptrguard1.c
+++ b/elf/tst-ptrguard1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2013-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/tst-rtld-load-self.sh b/elf/tst-rtld-load-self.sh
index 45789a8f06..aa97ee6ca9 100755
--- a/elf/tst-rtld-load-self.sh
+++ b/elf/tst-rtld-load-self.sh
@@ -1,6 +1,6 @@
-#! /bin/sh
+#!/bin/sh
# Test how rtld loads itself.
-# Copyright (C) 2012-2015 Free Software Foundation, Inc.
+# Copyright (C) 2012-2016 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
#
diff --git a/elf/tst-stackguard1.c b/elf/tst-stackguard1.c
index 69ef09fb89..cc95e227ea 100644
--- a/elf/tst-stackguard1.c
+++ b/elf/tst-stackguard1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2005.
diff --git a/elf/tst-tlsalign-extern.c b/elf/tst-tlsalign-extern.c
index 661b6712e3..5c09f8b99c 100644
--- a/elf/tst-tlsalign-extern.c
+++ b/elf/tst-tlsalign-extern.c
@@ -1,5 +1,5 @@
/* Test for large alignment in TLS blocks (extern case), BZ#18383.
- Copyright (C) 2015 Free Software Foundation, Inc.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/tst-tlsalign.c b/elf/tst-tlsalign.c
index da04f577e2..b8e64d258e 100644
--- a/elf/tst-tlsalign.c
+++ b/elf/tst-tlsalign.c
@@ -1,5 +1,5 @@
/* Test for large alignment in TLS blocks, BZ#18383.
- Copyright (C) 2015 Free Software Foundation, Inc.
+ Copyright (C) 2015-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/tst-unique1.c b/elf/tst-unique1.c
index 46d41d9ff4..17af6f1b18 100644
--- a/elf/tst-unique1.c
+++ b/elf/tst-unique1.c
@@ -6,7 +6,6 @@
static int
do_test (void)
{
-#ifdef HAVE_ASM_UNIQUE_OBJECT
void *h1 = dlopen ("tst-unique1mod1.so", RTLD_LAZY);
if (h1 == NULL)
{
@@ -68,7 +67,6 @@ do_test (void)
puts ("f from tst-unique1mod2 failed");
return 1;
}
-#endif
return 0;
}
diff --git a/elf/tst-unique1mod1.c b/elf/tst-unique1mod1.c
index f59029d055..84b1f908d6 100644
--- a/elf/tst-unique1mod1.c
+++ b/elf/tst-unique1mod1.c
@@ -1,6 +1,5 @@
#include <config.h>
-#ifdef HAVE_ASM_UNIQUE_OBJECT
asm (".data;"
".globl var\n"
".type var, %gnu_unique_object\n"
@@ -15,4 +14,3 @@ f (void)
var = 1;
return &var;
}
-#endif
diff --git a/elf/tst-unique1mod2.c b/elf/tst-unique1mod2.c
index aa28f29ba9..126ca1ac6c 100644
--- a/elf/tst-unique1mod2.c
+++ b/elf/tst-unique1mod2.c
@@ -1,6 +1,5 @@
#include <config.h>
-#ifdef HAVE_ASM_UNIQUE_OBJECT
asm (".data;"
".globl var\n"
".type var, %gnu_unique_object\n"
@@ -14,4 +13,3 @@ f (int *p)
{
return &var != p || *p != 1;
}
-#endif
diff --git a/elf/tst-unique2.c b/elf/tst-unique2.c
index 7bb0687364..442675458b 100644
--- a/elf/tst-unique2.c
+++ b/elf/tst-unique2.c
@@ -7,7 +7,6 @@ extern int var;
static int
do_test (void)
{
-#ifdef HAVE_ASM_UNIQUE_OBJECT
var = 1;
void *h = dlopen ("tst-unique2mod2.so", RTLD_LAZY);
@@ -23,9 +22,6 @@ do_test (void)
return 1;
}
return f (&var);
-#else
- return 0;
-#endif
}
#define TEST_FUNCTION do_test ()
diff --git a/elf/tst-unique2mod1.c b/elf/tst-unique2mod1.c
index b7e491b2e5..7cdb0eb0a0 100644
--- a/elf/tst-unique2mod1.c
+++ b/elf/tst-unique2mod1.c
@@ -1,10 +1,8 @@
#include <config.h>
-#ifdef HAVE_ASM_UNIQUE_OBJECT
asm (".data;"
".globl var\n"
".type var, %gnu_unique_object\n"
".size var, 4\n"
"var:.zero 4\n"
".previous");
-#endif
diff --git a/elf/tst-unique2mod2.c b/elf/tst-unique2mod2.c
index aa28f29ba9..126ca1ac6c 100644
--- a/elf/tst-unique2mod2.c
+++ b/elf/tst-unique2mod2.c
@@ -1,6 +1,5 @@
#include <config.h>
-#ifdef HAVE_ASM_UNIQUE_OBJECT
asm (".data;"
".globl var\n"
".type var, %gnu_unique_object\n"
@@ -14,4 +13,3 @@ f (int *p)
{
return &var != p || *p != 1;
}
-#endif
diff --git a/elf/vismain.c b/elf/vismain.c
index 05b374812c..a2be34e2f3 100644
--- a/elf/vismain.c
+++ b/elf/vismain.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/vismod1.c b/elf/vismod1.c
index 92a07f96fd..cf2d2b521c 100644
--- a/elf/vismod1.c
+++ b/elf/vismod1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/vismod2.c b/elf/vismod2.c
index 8c53b05077..45e662e07f 100644
--- a/elf/vismod2.c
+++ b/elf/vismod2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/elf/vismod3.c b/elf/vismod3.c
index 3e7fda8987..51f3cf877e 100644
--- a/elf/vismod3.c
+++ b/elf/vismod3.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or