From patchwork Fri May 11 15:43:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 912053 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-92446-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="ChWLpmZM"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40jDrw5bZFz9s1p for ; Sat, 12 May 2018 01:43:28 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; q=dns; s=default; b= O4Qnu22hzjuDv3mtHzNxx4/ZlIZ+XD6uc+oVrV4yi1WOW7r/gYDUHF36ls/bOEmI g3iruF9Qth2ZVJ6E5d8pVHR5nAXxc45udwFg8LZJRbru5y3FHme8eJlLDTRChh9C NK7bmt9AiwsYJNKeqljVaSBvPeB9Rv2/FBDs97uBHAY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; s=default; bh=6pw6Bk vVBCvhF+cTIcx48/zMGOI=; b=ChWLpmZMXEgBW1FRkkcjJiOouL85HBT4Jidmlw 31kqTCoF5l+DK9k/52lBX59orJqzD86PMb2/ELHFcIxRP0XETA9ITC4q6RSk4KjJ ZX/ggIfyZTUn5kHHeGTIV3zGut0BWpthYWaOXpHwVVYei9k7M194QR+4scTxpJ8X pIHdM= Received: (qmail 72569 invoked by alias); 11 May 2018 15:43:22 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 72548 invoked by uid 89); 11 May 2018 15:43:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=daemon, link-time, linktime X-HELO: mx1.redhat.com Date: Fri, 11 May 2018 17:43:14 +0200 To: libc-alpha@sourceware.org Subject: [PATCH] Introduce --enable-math-noprivate User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Message-Id: <20180511154314.83126424B00CE@oldenburg.str.redhat.com> From: fweimer@redhat.com (Florian Weimer) Avoid errno@GLIBC_PRIVATE if enabled. Additional work is needed to eliminate further GLIBC_PRIVATE symbol references. 2018-05-11 Florian Weimer Introduce --enable-math-noprivate. Avoid errno@GLIBC_PRIVATE if enabled. * config.h.in (CONFIG_MATH_NOPRIVATE): Define. * config.make.in (config-math-noprivate): New variable. * configure.ac: Recognize --enable-math-noprivate option. * manual/install.texi (Configuring and compiling): Document --enable-math-noprivate. * configure: Regenerate. * INSTALL: Likewise. * include/errno.h: Do not redefine errno for libm, libmvec if CONFIG_MATH_NOPRIVATE. diff --git a/INSTALL b/INSTALL index 052b1b6f89..0dc6739e42 100644 --- a/INSTALL +++ b/INSTALL @@ -197,6 +197,13 @@ if 'CFLAGS' is specified it must enable optimization. For example: libnss_nisplus are not built at all. Use this option to enable libnsl with all depending NSS modules and header files. +'--enable-math-noprivate' + By default, libm and libmvec (if available) are built in such a way + that they rely on internals in the rest of the library (notably + libc). With this option, the math libraries are built in a way + that avoids such dependencies. As a result, it is possible to use + them with older versions of the library. + '--disable-experimental-malloc' By default, a per-thread cache is enabled in 'malloc'. While this cache can be disabled on a per-application basis using tunables diff --git a/config.h.in b/config.h.in index b0b7cf26cb..794f526da4 100644 --- a/config.h.in +++ b/config.h.in @@ -156,6 +156,10 @@ code to link against. */ #undef LINK_OBSOLETE_NSL +/* Define as 1 if GLIBC_PRIVATE symbols should be avoided in the math + libraries. */ +#define CONFIG_MATH_NOPRIVATE 0 + /* Define if Systemtap probes should be defined. */ #undef USE_STAP_PROBE diff --git a/config.make.in b/config.make.in index 9e5e24b2c6..d7ac4d5a7a 100644 --- a/config.make.in +++ b/config.make.in @@ -101,6 +101,7 @@ use-nscd = @use_nscd@ build-hardcoded-path-in-tests= @hardcoded_path_in_tests@ build-pt-chown = @build_pt_chown@ have-tunables = @have_tunables@ +config-math-noprivate = @config_math_noprivate@ # Build tools. CC = @CC@ diff --git a/configure b/configure index 7a8bd3f817..73599affbf 100755 --- a/configure +++ b/configure @@ -672,6 +672,7 @@ base_machine have_tunables build_pt_chown build_nscd +config_math_noprivate build_obsolete_nsl link_obsolete_rpc libc_cv_static_nss_crypt @@ -782,6 +783,7 @@ enable_experimental_malloc enable_nss_crypt enable_obsolete_rpc enable_obsolete_nsl +enable_math_noprivate enable_systemtap enable_build_nscd enable_nscd @@ -1453,6 +1455,7 @@ Optional Features: link-time usage --enable-obsolete-nsl build and install the obsolete libnsl library and depending NSS modules + --enable-math-noprivate avoid GLIBC_PRIVATE symbols in math libraries --enable-systemtap enable systemtap static probe points [default=no] --disable-build-nscd disable building and installing the nscd daemon --disable-nscd library functions will not contact the nscd daemon @@ -3632,6 +3635,19 @@ if test "$build_obsolete_nsl" = yes; then fi +# Check whether --enable-math-noprivate was given. +if test "${enable_math_noprivate+set}" = set; then : + enableval=$enable_math_noprivate; config_math_noprivate=$enableval +else + config_math_noprivate=no +fi + + +if test "$config_math_noprivate" = yes; then + $as_echo "#define CONFIG_MATH_NOPRIVATE 1" >>confdefs.h + +fi + # Check whether --enable-systemtap was given. if test "${enable_systemtap+set}" = set; then : enableval=$enable_systemtap; systemtap=$enableval diff --git a/configure.ac b/configure.ac index ca1282a6b3..f18242e276 100644 --- a/configure.ac +++ b/configure.ac @@ -378,6 +378,16 @@ if test "$build_obsolete_nsl" = yes; then AC_DEFINE(LINK_OBSOLETE_NSL) fi +AC_ARG_ENABLE([math-noprivate], + AC_HELP_STRING([--enable-math-noprivate], + [avoid GLIBC_PRIVATE symbols in math libraries]), + [config_math_noprivate=$enableval], + [config_math_noprivate=no]) +AC_SUBST(config_math_noprivate) +if test "$config_math_noprivate" = yes; then + AC_DEFINE(CONFIG_MATH_NOPRIVATE) +fi + AC_ARG_ENABLE([systemtap], [AS_HELP_STRING([--enable-systemtap], [enable systemtap static probe points @<:@default=no@:>@])], diff --git a/include/errno.h b/include/errno.h index 457114b27a..6c0e0b94ef 100644 --- a/include/errno.h +++ b/include/errno.h @@ -20,7 +20,8 @@ # define errno rtld_errno extern int rtld_errno attribute_hidden; -# elif IS_IN_LIB && !IS_IN (rtld) +# elif IS_IN_LIB && !IS_IN (rtld) \ + && (!CONFIG_MATH_NOPRIVATE || !(IS_IN (libm) || IS_IN (libmvec))) # include diff --git a/manual/install.texi b/manual/install.texi index 4bbbfcffa5..1a131a009a 100644 --- a/manual/install.texi +++ b/manual/install.texi @@ -230,6 +230,13 @@ libnss_nisplus are not built at all. Use this option to enable libnsl with all depending NSS modules and header files. +@item --enable-math-noprivate +By default, libm and libmvec (if available) are built in such a way that +they rely on internals in the rest of the library (notably libc). With +this option, the math libraries are built in a way that avoids such +dependencies. As a result, it is possible to use them with older +versions of the library. + @item --disable-experimental-malloc By default, a per-thread cache is enabled in @code{malloc}. While this cache can be disabled on a per-application basis using tunables