FreeBSD Bugzilla – Attachment 184140 Details for
Bug 220525
Support -ldl.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
src/ patch
1.patch (text/plain), 7.74 KB, created by
Konstantin Belousov
on 2017-07-06 19:05:00 UTC
(
hide
)
Description:
src/ patch
Filename:
MIME Type:
Creator:
Konstantin Belousov
Created:
2017-07-06 19:05:00 UTC
Size:
7.74 KB
patch
obsolete
>diff --git a/contrib/mdocml/lib.in b/contrib/mdocml/lib.in >index e3e1af2aecd..716756d3d04 100644 >--- a/contrib/mdocml/lib.in >+++ b/contrib/mdocml/lib.in >@@ -46,6 +46,7 @@ LINE("libdevctl", "Device Control Library (libdevctl, \\-ldevctl)") > 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)") >diff --git a/lib/Makefile b/lib/Makefile >index f93778b91ca..bdb2c2a661b 100644 >--- a/lib/Makefile >+++ b/lib/Makefile >@@ -40,6 +40,7 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \ > libdevctl \ > libdevinfo \ > libdevstat \ >+ libdl \ > libdwarf \ > libedit \ > libevent \ >diff --git a/lib/libc/gen/dlfcn.c b/lib/libc/gen/dlfcn.c >index 53c9d67ab9e..55e7fc760fd 100644 >--- a/lib/libc/gen/dlfcn.c >+++ b/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. > */ >@@ -57,95 +59,107 @@ void _rtld_atfork_post(int *); > > #pragma weak _rtld_error > void >-_rtld_error(const char *fmt, ...) >+_rtld_error(const char *fmt __unused, ...) > { > } > > #pragma weak dladdr > int >-dladdr(const void *addr, Dl_info *dlip) >+dladdr(const void *addr __unused, Dl_info *dlip __unused) > { >+ > _rtld_error(sorry); >- return 0; >+ return (0); > } > > #pragma weak dlclose > int >-dlclose(void *handle) >+dlclose(void *handle __unused) > { >+ > _rtld_error(sorry); >- return -1; >+ return (-1); > } > > #pragma weak dlerror > char * > dlerror(void) > { >- return sorry; >+ >+ return (sorry); > } > > #pragma weak dllockinit > void > dllockinit(void *context, >- void *(*lock_create)(void *context), >- void (*rlock_acquire)(void *lock), >- void (*wlock_acquire)(void *lock), >- void (*lock_release)(void *lock), >- void (*lock_destroy)(void *lock), >- void (*context_destroy)(void *context)) >+ void *(*lock_create)(void *context) __unused, >+ void (*rlock_acquire)(void *lock) __unused, >+ void (*wlock_acquire)(void *lock) __unused, >+ void (*lock_release)(void *lock) __unused, >+ void (*lock_destroy)(void *lock) __unused, >+ void (*context_destroy)(void *context) __unused) > { >+ > if (context_destroy != NULL) > context_destroy(context); > } > > #pragma weak dlopen > void * >-dlopen(const char *name, int mode) >+dlopen(const char *name __unused, int mode __unused) > { >+ > _rtld_error(sorry); >- return NULL; >+ return (NULL); > } > > #pragma weak dlsym > void * >-dlsym(void * __restrict handle, const char * __restrict name) >+dlsym(void * __restrict handle __unused, const char * __restrict name __unused) > { >+ > _rtld_error(sorry); >- return NULL; >+ return (NULL); > } > > #pragma weak dlfunc > dlfunc_t >-dlfunc(void * __restrict handle, const char * __restrict name) >+dlfunc(void * __restrict handle __unused, const char * __restrict name __unused) > { >+ > _rtld_error(sorry); >- return NULL; >+ return (NULL); > } > > #pragma weak dlvsym > void * >-dlvsym(void * __restrict handle, const char * __restrict name, >- const char * __restrict version) >+dlvsym(void * __restrict handle __unused, const char * __restrict name __unused, >+ const char * __restrict version __unused) > { >+ > _rtld_error(sorry); >- return NULL; >+ return (NULL); > } > > #pragma weak dlinfo > int >-dlinfo(void * __restrict handle, int request, void * __restrict p) >+dlinfo(void * __restrict handle __unused, int request __unused, >+ void * __restrict p __unused) > { >+ > _rtld_error(sorry); >- return 0; >+ return (0); > } > > #pragma weak _rtld_thread_init > void >-_rtld_thread_init(void * li) >+_rtld_thread_init(void *li __unused) > { >+ > _rtld_error(sorry); > } > >+#ifndef IN_LIBDL > static pthread_once_t dl_phdr_info_once = PTHREAD_ONCE_INIT; > static struct dl_phdr_info phdr_info; > >@@ -181,44 +195,50 @@ dl_init_phdr_info(void) > } > phdr_info.dlpi_adds = 1; > } >+#endif > > #pragma weak dl_iterate_phdr > int >-dl_iterate_phdr(int (*callback)(struct dl_phdr_info *, size_t, void *), >- void *data) >+dl_iterate_phdr(int (*callback)(struct dl_phdr_info *, size_t, void *) __unused, >+ 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 > void * >-fdlopen(int fd, int mode) >+fdlopen(int fd __unused, int mode __unused) > { > > _rtld_error(sorry); >- return NULL; >+ return (NULL); > } > > #pragma weak _rtld_atfork_pre > void >-_rtld_atfork_pre(int *locks) >+_rtld_atfork_pre(int *locks __unused) > { > } > > #pragma weak _rtld_atfork_post > void >-_rtld_atfork_post(int *locks) >+_rtld_atfork_post(int *locks __unused) > { > } > > #pragma weak _rtld_addr_phdr > int >-_rtld_addr_phdr(const void *addr, struct dl_phdr_info *phdr_info) >+_rtld_addr_phdr(const void *addr __unused, >+ struct dl_phdr_info *phdr_info_a __unused) > { > > return (0); >@@ -234,8 +254,10 @@ _rtld_get_stack_prot(void) > > #pragma weak _rtld_is_dlopened > int >-_rtld_is_dlopened(void *arg) >+_rtld_is_dlopened(void *arg __unused) > { > > return (0); > } >+ >+#endif /* !defined(IN_LIBDL) || defined(PIC) */ >diff --git a/lib/libc/gen/dlopen.3 b/lib/libc/gen/dlopen.3 >index 1963528b54b..202f1af4864 100644 >--- a/lib/libc/gen/dlopen.3 >+++ b/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 >@@ -377,6 +377,14 @@ option to > 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 > compatibility with object code compiled from the C language. >diff --git a/lib/libdl/Makefile b/lib/libdl/Makefile >new file mode 100644 >index 00000000000..07be4e54d6e >--- /dev/null >+++ b/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,--filter=libc.so.7 >+VERSION_DEF=${SRCTOP}/lib/libc/Versions.def >+SYMBOL_MAPS=${.CURDIR}/Symbol.map >+ >+SRCS = dlfcn.c >+ >+.include <bsd.lib.mk> >diff --git a/lib/libdl/Symbol.map b/lib/libdl/Symbol.map >new file mode 100644 >index 00000000000..82ab6012e12 >--- /dev/null >+++ b/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; >+}; >diff --git a/share/mk/bsd.libnames.mk b/share/mk/bsd.libnames.mk >index c216f295181..6a592c84b42 100644 >--- a/share/mk/bsd.libnames.mk >+++ b/share/mk/bsd.libnames.mk >@@ -56,6 +56,7 @@ LIBDEVDCTL?= ${LIBDESTDIR}${LIBDIR_BASE}/libdevdctl.a > 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 >diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk >index 62402a51c5b..fb5f77c989d 100644 >--- a/share/mk/src.libnames.mk >+++ b/share/mk/src.libnames.mk >@@ -88,6 +88,7 @@ _LIBRARIES= \ > devinfo \ > devstat \ > dialog \ >+ dl \ > dpv \ > dtrace \ > dwarf \
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 220525
: 184140