From owner-svn-src-stable@freebsd.org Thu Mar 29 19:32:27 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DDB69F6FF82; Thu, 29 Mar 2018 19:32:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8EC187FA52; Thu, 29 Mar 2018 19:32:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F6EA1E5AD; Thu, 29 Mar 2018 19:32:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2TJWQLH082297; Thu, 29 Mar 2018 19:32:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2TJWPEm082290; Thu, 29 Mar 2018 19:32:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201803291932.w2TJWPEm082290@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 29 Mar 2018 19:32:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331742 - in stable/11: contrib/mdocml lib lib/libc/gen lib/libdl share/mk X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11: contrib/mdocml lib lib/libc/gen lib/libdl share/mk X-SVN-Commit-Revision: 331742 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Mar 2018 19:32:27 -0000 Author: kib Date: Thu Mar 29 19:32:25 2018 New Revision: 331742 URL: https://svnweb.freebsd.org/changeset/base/331742 Log: MFC r320872: Create libdl.so.1 as a filter for libc.so.7 which exports public dl* functions. Added: stable/11/lib/libdl/ - copied from r320872, head/lib/libdl/ Modified: stable/11/contrib/mdocml/lib.in stable/11/lib/Makefile stable/11/lib/libc/gen/dlfcn.c stable/11/lib/libc/gen/dlopen.3 stable/11/share/mk/bsd.libnames.mk stable/11/share/mk/bsd.linker.mk stable/11/share/mk/src.libnames.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/mdocml/lib.in ============================================================================== --- stable/11/contrib/mdocml/lib.in Thu Mar 29 19:29:12 2018 (r331741) +++ stable/11/contrib/mdocml/lib.in Thu Mar 29 19:32:25 2018 (r331742) @@ -46,6 +46,7 @@ LINE("libdevctl", "Device Control Library (libdevctl, 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)") Modified: stable/11/lib/Makefile ============================================================================== --- stable/11/lib/Makefile Thu Mar 29 19:29:12 2018 (r331741) +++ stable/11/lib/Makefile Thu Mar 29 19:32:25 2018 (r331742) @@ -47,6 +47,7 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \ libdevdctl \ libdevinfo \ libdevstat \ + ${_libdl} \ libdwarf \ libedit \ ${_libefivar} \ @@ -273,6 +274,10 @@ _librtld_db= librtld_db .if ${MACHINE_CPUARCH} == "powerpc" _libproc= libproc _librtld_db= librtld_db +.endif + +.if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mfilter} +_libdl= libdl .endif .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" || \ Modified: stable/11/lib/libc/gen/dlfcn.c ============================================================================== --- stable/11/lib/libc/gen/dlfcn.c Thu Mar 29 19:29:12 2018 (r331741) +++ stable/11/lib/libc/gen/dlfcn.c Thu Mar 29 19:32:25 2018 (r331742) @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD$"); +#if !defined(IN_LIBDL) || defined(PIC) + /* * Linkage to services provided by the dynamic linker. */ @@ -157,6 +159,7 @@ _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; @@ -192,6 +195,7 @@ dl_init_phdr_info(void) } phdr_info.dlpi_adds = 1; } +#endif #pragma weak dl_iterate_phdr int @@ -199,11 +203,15 @@ dl_iterate_phdr(int (*callback)(struct dl_phdr_info *, 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 @@ _rtld_is_dlopened(void *arg __unused) return (0); } + +#endif /* !defined(IN_LIBDL) || defined(PIC) */ Modified: stable/11/lib/libc/gen/dlopen.3 ============================================================================== --- stable/11/lib/libc/gen/dlopen.3 Thu Mar 29 19:29:12 2018 (r331741) +++ stable/11/lib/libc/gen/dlopen.3 Thu Mar 29 19:32:25 2018 (r331742) @@ -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 @@ option to .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 Modified: stable/11/share/mk/bsd.libnames.mk ============================================================================== --- stable/11/share/mk/bsd.libnames.mk Thu Mar 29 19:29:12 2018 (r331741) +++ stable/11/share/mk/bsd.libnames.mk Thu Mar 29 19:32:25 2018 (r331742) @@ -54,6 +54,7 @@ LIBDEVDCTL?= ${DESTDIR}${LIBDIR_BASE}/libdevdctl.a LIBDEVINFO?= ${DESTDIR}${LIBDIR_BASE}/libdevinfo.a LIBDEVSTAT?= ${DESTDIR}${LIBDIR_BASE}/libdevstat.a LIBDIALOG?= ${DESTDIR}${LIBDIR_BASE}/libdialog.a +LIBDL?= ${DESTDIR}${LIBDIR_BASE}/libdl.a LIBDNS?= ${DESTDIR}${LIBDIR_BASE}/libdns.a LIBDPV?= ${DESTDIR}${LIBDIR_BASE}/libdpv.a LIBDTRACE?= ${DESTDIR}${LIBDIR_BASE}/libdtrace.a Modified: stable/11/share/mk/bsd.linker.mk ============================================================================== --- stable/11/share/mk/bsd.linker.mk Thu Mar 29 19:29:12 2018 (r331741) +++ stable/11/share/mk/bsd.linker.mk Thu Mar 29 19:32:25 2018 (r331742) @@ -70,6 +70,9 @@ ${X_}LINKER_FEATURES= .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 Modified: stable/11/share/mk/src.libnames.mk ============================================================================== --- stable/11/share/mk/src.libnames.mk Thu Mar 29 19:29:12 2018 (r331741) +++ stable/11/share/mk/src.libnames.mk Thu Mar 29 19:32:25 2018 (r331742) @@ -87,6 +87,7 @@ _LIBRARIES= \ devinfo \ devstat \ dialog \ + dl \ dpv \ dtrace \ dwarf \