Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167538213
D11504.id30625.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D11504.id30625.diff
View Options
Index: head/contrib/mdocml/lib.in
===================================================================
--- head/contrib/mdocml/lib.in
+++ head/contrib/mdocml/lib.in
@@ -46,6 +46,7 @@
LINE("libdevinfo", "Device and Resource Information Utility Library (libdevinfo, \\-ldevinfo)")
LINE("libdevstat", "Device Statistics Library (libdevstat, \\-ldevstat)")
LINE("libdisk", "Interface to Slice and Partition Labels Library (libdisk, \\-ldisk)")
+LINE("libdl", "Dynamic Linker Services Filter (libdl, \\-ldl)")
LINE("libdm", "Device Mapper Library (libdm, \\-ldm)")
LINE("libdwarf", "DWARF Access Library (libdwarf, \\-ldwarf)")
LINE("libedit", "Command Line Editor Library (libedit, \\-ledit)")
Index: head/lib/Makefile
===================================================================
--- head/lib/Makefile
+++ head/lib/Makefile
@@ -40,6 +40,7 @@
libdevctl \
libdevinfo \
libdevstat \
+ ${_libdl} \
libdwarf \
libedit \
libevent \
@@ -181,6 +182,10 @@
.if ${MACHINE_CPUARCH} != "sparc64"
_libproc= libproc
_librtld_db= librtld_db
+.endif
+
+.if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mfilter}
+_libdl= libdl
.endif
SUBDIR.${MK_OPENSSL}+= libmp
Index: head/lib/libc/gen/dlfcn.c
===================================================================
--- head/lib/libc/gen/dlfcn.c
+++ head/lib/libc/gen/dlfcn.c
@@ -27,6 +27,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#if !defined(IN_LIBDL) || defined(PIC)
+
/*
* Linkage to services provided by the dynamic linker.
*/
@@ -157,6 +159,7 @@
_rtld_error(sorry);
}
+#ifndef IN_LIBDL
static pthread_once_t dl_phdr_info_once = PTHREAD_ONCE_INIT;
static struct dl_phdr_info phdr_info;
@@ -192,6 +195,7 @@
}
phdr_info.dlpi_adds = 1;
}
+#endif
#pragma weak dl_iterate_phdr
int
@@ -199,11 +203,15 @@
void *data __unused)
{
+#ifndef IN_LIBDL
__init_elf_aux_vector();
if (__elf_aux_vector == NULL)
return (1);
_once(&dl_phdr_info_once, dl_init_phdr_info);
return (callback(&phdr_info, sizeof(phdr_info), data));
+#else
+ return (0);
+#endif
}
#pragma weak fdlopen
@@ -251,3 +259,5 @@
return (0);
}
+
+#endif /* !defined(IN_LIBDL) || defined(PIC) */
Index: head/lib/libc/gen/dlopen.3
===================================================================
--- head/lib/libc/gen/dlopen.3
+++ head/lib/libc/gen/dlopen.3
@@ -32,7 +32,7 @@
.\" @(#) dlopen.3 1.6 90/01/31 SMI
.\" $FreeBSD$
.\"
-.Dd February 14, 2015
+.Dd July 7, 2017
.Dt DLOPEN 3
.Os
.Sh NAME
@@ -376,6 +376,14 @@
.Xr ld 1
for symbols defined in the executable to become visible to
.Fn dlsym .
+.Pp
+Other ELF platforms require linking with
+.Lb libdl
+to provide
+.Fn dlopen
+and other functions.
+.Fx
+does not require linking with the library, but supports it for compatibility.
.Pp
In previous implementations, it was necessary to prepend an underscore
to all external symbols in order to gain symbol
Index: head/lib/libdl/Makefile
===================================================================
--- head/lib/libdl/Makefile
+++ head/lib/libdl/Makefile
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+LIB=dl
+SHLIB_MAJOR=1
+
+.PATH: ${SRCTOP}/lib/libc/gen
+CFLAGS+=-I${SRCTOP}/lib/libc/include
+CFLAGS+=-DIN_LIBDL
+LDFLAGS+=-Wl,-F,libc.so.7
+VERSION_DEF=${SRCTOP}/lib/libc/Versions.def
+SYMBOL_MAPS=${.CURDIR}/Symbol.map
+
+SRCS = dlfcn.c
+
+.include <bsd.lib.mk>
Index: head/lib/libdl/Symbol.map
===================================================================
--- head/lib/libdl/Symbol.map
+++ head/lib/libdl/Symbol.map
@@ -0,0 +1,20 @@
+/*
+ * $FreeBSD$
+ */
+
+FBSD_1.0 {
+ dladdr;
+ dlclose;
+ dlerror;
+ dlfunc;
+ dlopen;
+ dlsym;
+ dlvsym;
+ dlinfo;
+ dl_iterate_phdr;
+};
+
+
+FBSD_1.3 {
+ fdlopen;
+};
Index: head/share/mk/bsd.libnames.mk
===================================================================
--- head/share/mk/bsd.libnames.mk
+++ head/share/mk/bsd.libnames.mk
@@ -56,6 +56,7 @@
LIBDEVINFO?= ${LIBDESTDIR}${LIBDIR_BASE}/libdevinfo.a
LIBDEVSTAT?= ${LIBDESTDIR}${LIBDIR_BASE}/libdevstat.a
LIBDIALOG?= ${LIBDESTDIR}${LIBDIR_BASE}/libdialog.a
+LIBDL?= ${LIBDESTDIR}${LIBDIR_BASE}/libdl.a
LIBDNS?= ${LIBDESTDIR}${LIBDIR_BASE}/libdns.a
LIBDPV?= ${LIBDESTDIR}${LIBDIR_BASE}/libdpv.a
LIBDTRACE?= ${LIBDESTDIR}${LIBDIR_BASE}/libdtrace.a
Index: head/share/mk/bsd.linker.mk
===================================================================
--- head/share/mk/bsd.linker.mk
+++ head/share/mk/bsd.linker.mk
@@ -70,6 +70,9 @@
.if ${${X_}LINKER_TYPE} != "bfd" || ${${X_}LINKER_VERSION} > 21750
${X_}LINKER_FEATURES+= build-id
.endif
+.if ${${X_}LINKER_TYPE} == "bfd"
+${X_}LINKER_FEATURES+= filter
+.endif
.endif
.else
# Use LD's values
Index: head/share/mk/src.libnames.mk
===================================================================
--- head/share/mk/src.libnames.mk
+++ head/share/mk/src.libnames.mk
@@ -88,6 +88,7 @@
devinfo \
devstat \
dialog \
+ dl \
dpv \
dtrace \
dwarf \
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Aug 23, 1:55 PM (15 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37124743
Default Alt Text
D11504.id30625.diff (4 KB)
Attached To
Mode
D11504: Provide libdl.
Attached
Detach File
Event Timeline
Log In to Comment