aboutsummaryrefslogtreecommitdiff
path: root/dlfcn
diff options
context:
space:
mode:
Diffstat (limited to 'dlfcn')
-rw-r--r--dlfcn/Makefile8
-rw-r--r--dlfcn/dlclose.c3
-rw-r--r--dlfcn/dlfcn.c33
-rw-r--r--dlfcn/dlmopen.c7
-rw-r--r--dlfcn/dlopen.c8
-rw-r--r--dlfcn/dlopenold.c8
6 files changed, 55 insertions, 12 deletions
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 <dlfcn.h>
+#include <ldsodefs.h>
#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 <dlfcn.h>
+
+
+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 <errno.h>
#include <libintl.h>
#include <stddef.h>
+#include <unistd.h>
#include <ldsodefs.h>
#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 <dlfcn.h>
#include <stddef.h>
+#include <unistd.h>
+#include <ldsodefs.h>
#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 <dlfcn.h>
#include <stddef.h>
+#include <unistd.h>
+#include <ldsodefs.h>
/* 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);