From 9dcafc559763e339d4a79580c333127033e39c11 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 6 Jan 2005 22:40:27 +0000 Subject: * csu/elf-init.c (__libc_csu_fini): Don't do anything here. * sysdeps/generic/libc-start.c: Don't register program destructor here. * dlfcn/Makefile: Add rules to build dlfcn.c. (LDFLAGS-dl.so): Removed. * dlfcn/dlclose.c: _dl_close is now in ld.so, use function pointer table. * dlfcn/dlmopen.c: Likewise for _dl_open. * dlfcn/dlopen.c: Likewise. * dlfcn/dlopenold.c: Likewise. * elf/dl-libc.c: Likewise for _dl_open and _dl_close. * elf/Makefile (routines): Remove dl-open and dl-close. (dl-routines): Add dl-open, dl-close, and dl-trampoline. Add rules to build and run tst-audit1. * elf/tst-audit1.c: New file. * elf/tst-auditmod1.c: New file. * elf/Versions [libc]: Remove _dl_open and _dl_close. * elf/dl-close.c: Change for use inside ld.so instead of libc.so. * elf/dl-open.c: Likewise. * elf/dl-debug.c (_dl_debug_initialize): Allow reinitialization, signaled by nonzero parameter. * elf/dl-init.c: Fix use of r_state. * elf/dl-load.c: Likewise. * elf/dl-close.c: Add auditing checkpoints. * elf/dl-open.c: Likewise. * elf/dl-fini.c: Likewise. * elf/dl-load.c: Likewise. * elf/dl-sym.c: Likewise. * sysdeps/generic/libc-start.c: Likewise. * elf/dl-object.c: Allocate memory for auditing information. * elf/dl-reloc.c: Remove RESOLV. We now always need the map. Correctly initialize slotinfo. * elf/dynamic-link.h: Adjust after removal of RESOLV. * sysdeps/hppa/dl-lookupcfg.h: Likewise. * sysdeps/ia64/dl-lookupcfg.h: Likewise. * sysdeps/powerpc/powerpc64/dl-lookupcfg.h: Removed. * elf/dl-runtime.c (_dl_fixup): Little cleanup. (_dl_profile_fixup): New parameters to point to register struct and variable for frame size. Add auditing checkpoints. (_dl_call_pltexit): New function. Don't define trampoline code here. * elf/rtld.c: Recognize LD_AUDIT. Load modules on startup. Remove all the functions from _rtld_global_ro which only _dl_open and _dl_close needed. Add auditing checkpoints. * elf/link.h: Define symbols for auditing interfaces. * include/link.h: Likewise. * include/dlfcn.h: Define __RTLD_AUDIT. Remove prototypes for _dl_open and _dl_close. Adjust access to argc and argv in libdl. * dlfcn/dlfcn.c: New file. * sysdeps/generic/dl-lookupcfg.h: Remove all content now that RESOLVE is gone. * sysdeps/generic/ldsodefs.h: Add definitions for auditing interfaces. * sysdeps/generic/unsecvars.h: Add LD_AUDIT. * sysdeps/i386/dl-machine.h: Remove trampoline code here. Adjust for removal of RESOLVE. * sysdeps/x86_64/dl-machine.h: Likewise. * sysdeps/generic/dl-trampoline.c: New file. * sysdeps/i386/dl-trampoline.c: New file. * sysdeps/x86_64/dl-trampoline.c: New file. * sysdeps/generic/dl-tls.c: Cleanups. Fixup for dtv_t change. Fix updating of DTV. * sysdeps/generic/libc-tls.c: Likewise. * sysdeps/arm/bits/link.h: Renamed to ... * sysdeps/arm/buts/linkmap.h: ...this. * sysdeps/generic/bits/link.h: Renamed to... * sysdeps/generic/bits/linkmap.h: ...this. * sysdeps/hppa/bits/link.h: Renamed to... * sysdeps/hppa/bits/linkmap.h: ...this. * sysdeps/hppa/i386/link.h: Renamed to... * sysdeps/hppa/i386/linkmap.h: ...this. * sysdeps/hppa/ia64/link.h: Renamed to... * sysdeps/hppa/ia64/linkmap.h: ...this. * sysdeps/hppa/s390/link.h: Renamed to... * sysdeps/hppa/s390/linkmap.h: ...this. * sysdeps/hppa/sh/link.h: Renamed to... * sysdeps/hppa/sh/linkmap.h: ...this. * sysdeps/hppa/x86_64/link.h: Renamed to... * sysdeps/hppa/x86_64/linkmap.h: ...this. 2005-01-06 Ulrich Drepper * allocatestack.c (init_one_static_tls): Adjust initialization of DTV entry for static tls deallocation fix. * sysdeps/alpha/tls.h (dtv_t): Change pointer type to be struct which also contains information whether the memory pointed to is static TLS or not. * sysdeps/i386/tls.h: Likewise. * sysdeps/ia64/tls.h: Likewise. * sysdeps/powerpc/tls.h: Likewise. * sysdeps/s390/tls.h: Likewise. * sysdeps/sh/tls.h: Likewise. * sysdeps/sparc/tls.h: Likewise. * sysdeps/x86_64/tls.h: Likewise. --- dlfcn/Makefile | 8 +++----- dlfcn/dlclose.c | 3 ++- dlfcn/dlfcn.c | 33 +++++++++++++++++++++++++++++++++ dlfcn/dlmopen.c | 7 +++++-- dlfcn/dlopen.c | 8 ++++++-- dlfcn/dlopenold.c | 8 ++++++-- 6 files changed, 55 insertions(+), 12 deletions(-) create mode 100644 dlfcn/dlfcn.c (limited to 'dlfcn') diff --git a/dlfcn/Makefile b/dlfcn/Makefile index ed20ae5ccd..7b538fed2b 100644 --- a/dlfcn/Makefile +++ b/dlfcn/Makefile @@ -20,8 +20,8 @@ subdir := dlfcn headers := bits/dlfcn.h dlfcn.h extra-libs := libdl libdl-routines := dlopen dlclose dlsym dlvsym dlerror dladdr dladdr1 dlinfo \ - dlmopen -routines := $(patsubst %,s%,$(libdl-routines)) + dlmopen dlfcn +routines := $(patsubst %,s%,$(filter-out dlfcn,$(libdl-routines))) elide-routines.os := $(routines) distribute := dlopenold.c glreflib1.c glreflib2.c failtestmod.c \ defaultmod1.c defaultmod2.c errmsg1mod.c modatexit.c \ @@ -34,7 +34,7 @@ include ../Makeconfig ifeq ($(versioning),yes) libdl-routines += dlopenold -libdl-shared-only-routines := dlopenold +libdl-shared-only-routines := dlopenold dlfcn endif ifeq (yes,$(build-shared)) @@ -65,8 +65,6 @@ generated := $(modules-names:=.so) include ../Rules -LDFLAGS-dl.so = -Wl,-dynamic-linker,$(slibdir)/$(rtld-installed-name) - test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names))) $(test-modules): $(objpfx)%.so: $(objpfx)%.os $(common-objpfx)shlib.lds $(build-module) diff --git a/dlfcn/dlclose.c b/dlfcn/dlclose.c index 3ddedcffbe..5a344f31ca 100644 --- a/dlfcn/dlclose.c +++ b/dlfcn/dlclose.c @@ -19,6 +19,7 @@ 02111-1307 USA. */ #include +#include #if !defined SHARED && defined IS_IN_libdl @@ -33,7 +34,7 @@ dlclose (void *handle) static void dlclose_doit (void *handle) { - _dl_close (handle); + GLRO(dl_close) (handle); } int diff --git a/dlfcn/dlfcn.c b/dlfcn/dlfcn.c new file mode 100644 index 0000000000..2f177d3e35 --- /dev/null +++ b/dlfcn/dlfcn.c @@ -0,0 +1,33 @@ +/* Load a shared object at run time. + Copyright (C) 1995,96,97,98,99,2000,2003,2004 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +int __dlfcn_argc attribute_hidden; +char **__dlfcn_argv attribute_hidden; + + +void +__attribute ((constuctor)) +init (int argc, char *argv[]) +{ + __dlfcn_argc = argc; + __dlfcn_argv = argv; +} diff --git a/dlfcn/dlmopen.c b/dlfcn/dlmopen.c index 5fd6543655..0a6d47ea2e 100644 --- a/dlfcn/dlmopen.c +++ b/dlfcn/dlmopen.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #if !defined SHARED && defined IS_IN_libdl @@ -61,8 +62,10 @@ dlmopen_doit (void *a) # endif GLRO(dl_signal_error) (EINVAL, NULL, NULL, N_("invalid namespace")); - args->new = _dl_open (args->file ?: "", args->mode | __RTLD_DLOPEN, - args->caller, args->nsid); + args->new = GLRO(dl_open) (args->file ?: "", args->mode | __RTLD_DLOPEN, + args->caller, + args->nsid, __dlfcn_argc, __dlfcn_argv, + __environ); } diff --git a/dlfcn/dlopen.c b/dlfcn/dlopen.c index 6381ffc9b1..1e2111e71f 100644 --- a/dlfcn/dlopen.c +++ b/dlfcn/dlopen.c @@ -19,6 +19,8 @@ #include #include +#include +#include #if !defined SHARED && defined IS_IN_libdl @@ -56,8 +58,10 @@ dlopen_doit (void *a) { struct dlopen_args *args = (struct dlopen_args *) a; - args->new = _dl_open (args->file ?: "", args->mode | __RTLD_DLOPEN, - args->caller, args->file == NULL ? LM_ID_BASE : NS); + args->new = GLRO(dl_open) (args->file ?: "", args->mode | __RTLD_DLOPEN, + args->caller, + args->file == NULL ? LM_ID_BASE : NS, + __dlfcn_argc, __dlfcn_argv, __environ); } diff --git a/dlfcn/dlopenold.c b/dlfcn/dlopenold.c index 148716cdb0..8dae1c40ce 100644 --- a/dlfcn/dlopenold.c +++ b/dlfcn/dlopenold.c @@ -19,6 +19,8 @@ #include #include +#include +#include /* This file is for compatibility with glibc 2.0. Compile it only if versioning is used. */ @@ -50,8 +52,10 @@ dlopen_doit (void *a) { struct dlopen_args *args = (struct dlopen_args *) a; - args->new = _dl_open (args->file ?: "", args->mode | __RTLD_DLOPEN, - args->caller, args->file == NULL ? LM_ID_BASE : NS); + args->new = GLRO(dl_open) (args->file ?: "", args->mode | __RTLD_DLOPEN, + args->caller, + args->file == NULL ? LM_ID_BASE : NS, + __dlfcn_argc, __dlfcn_argv, __environ); } extern void *__dlopen_nocheck (const char *file, int mode); -- cgit v1.2.3