From patchwork Wed Dec 25 06:40:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1215340 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-516479-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="aZrnWUoG"; 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 47jNll2VHZz9sPJ for ; Wed, 25 Dec 2019 17:41:20 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=W2FQu4g7Blttt1QcM4uGF+rsPVCB+4ONvAz+KKgrTOXZIYKoVcTVb myQqRq5yI7FbjEZxNM4MnP/7QzdspaM25QDfGpK2q4A6xwC9CY+lqFCi2ybRhWur fWSFUv4Z1dK87pUZo1WJBNKTAN9bo0VUQtGRv6BzvLzY0AirqqoZ2A= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=CiNqL1qSMs1ugVkuYyZZ27DGpO4=; b=aZrnWUoGOfV3nrYgzYPY oo0zsuBflabQLahN/Ae54JD5rMAHa7QrrWiaxTJmSb8xaTyo6p/Ry1uQaGV0ZRG/ PuVgKp7Vrtl7UtmyzFSm8cCEKSGEvLnCYWDfHHwL4dlWMs4i4cI0ZTlH5Z9WHhB8 h3Z7oLtryguNOogbxQmSRhw= Received: (qmail 105746 invoked by alias); 25 Dec 2019 06:41:09 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 105731 invoked by uid 89); 25 Dec 2019 06:41:09 -0000 Authentication-Results: sourceware.org; auth=none 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, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=modes, rebuild, combination, UD:m4 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 25 Dec 2019 06:41:07 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id C9B1A116809; Wed, 25 Dec 2019 01:41:05 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id jBkbn6h76Hyw; Wed, 25 Dec 2019 01:41:05 -0500 (EST) Received: from free.home (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPS id 8A9D91167F2; Wed, 25 Dec 2019 01:41:05 -0500 (EST) Received: from livre.home (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id xBP6eudC462661 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 25 Dec 2019 03:40:57 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: Define HAVE_ for math long double functions declared in vxworks headers Date: Wed, 25 Dec 2019 03:40:56 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 When cross-building for vxworks, test for declarations of long double functions in math.h. We don't normally test for these functions when cross compiling, because link tests don't work, or ever really, but not defining them as available causes replacements to be defined in ways that may cause duplicate definition linker errors if the units defining both the replacement and the actual implementation are brought in because of other symbols. Tested on trunk by checking configure results of libstdc++-v3 for an affected target, and also building natively on x86_64-linux-gnu. Also tested for various cross configurations far more thoroughly on trees not matching trunk so closely. I'm checking this in. libstdc++-v3/ * crossconfig.m4 (GLIBCXX_CROSSCONFIG) [*-vxworks*]: Define long double functions as available if declared by math.h. (GLIBCXX_CHECK_MATH_DECL, GLIBCXX_CHECK_MATH_DECLS): New. * configure: Rebuild. --- libstdc++-v3/configure | 1104 +++++++++++++++++++++++++++++++++++++++++++ libstdc++-v3/crossconfig.m4 | 62 ++ 2 files changed, 1166 insertions(+) diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure [omitted] diff --git a/libstdc++-v3/crossconfig.m4 b/libstdc++-v3/crossconfig.m4 index 5e24889..2a0cb04 100644 --- a/libstdc++-v3/crossconfig.m4 +++ b/libstdc++-v3/crossconfig.m4 @@ -291,9 +291,71 @@ case "${host}" in AC_DEFINE(HAVE_SQRTF) AC_DEFINE(HAVE_TANF) AC_DEFINE(HAVE_TANHF) + +dnl # Different versions and execution modes implement different +dnl # subsets of these functions. Instead of hard-coding, test for C +dnl # declarations in headers. The C primitives could be defined as +dnl # macros, in which case the tests might fail, and we might have to +dnl # switch to more elaborate tests. + GLIBCXX_CHECK_MATH_DECLS([ + acosl asinl atan2l atanl ceill cosl coshl expl fabsl floorl fmodl + frexpl ldexpl log10l logl modfl powl sinl sinhl sqrtl tanl tanhl]) +dnl # sincosl is the only one missing here, compared with the *l +dnl # functions in the list guarded by +dnl # long_double_math_on_this_cpu in configure.ac, right after +dnl # the expansion of the present macro. ;; *) AC_MSG_ERROR([No support for this host/target combination.]) ;; esac ]) + + +dnl +dnl Check to see if the (math function) argument passed is +dnl declared when using the c compiler +dnl +dnl Define HAVE_CARGF etc if "cargf" is declared +dnl +dnl argument 1 is name of function to check +dnl +dnl ASSUMES argument is a math function +dnl +dnl GLIBCXX_CHECK_MATH_DECL +AC_DEFUN([GLIBCXX_CHECK_MATH_DECL], [ + AC_CACHE_CHECK([for $1 declaration], + [glibcxx_cv_func_$1_use], [ + AC_LANG_SAVE + AC_LANG_C + AC_TRY_COMPILE([ +#include +#ifdef HAVE_IEEEFP_H +# include +#endif +], [ + void (*f)(void) = (void (*)(void))$1; +], [glibcxx_cv_func_$1_use=yes +], [glibcxx_cv_func_$1_use=no])]) + if test "x$glibcxx_cv_func_$1_use" = xyes; then + AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$1])) + fi +]) + +dnl +dnl Check to see whether multiple math functions are +dnl declared when using the c compiler +dnl +dnl Define HAVE_CARGF HAVE_POWL etc if "cargf" and "powl" +dnl are declared +dnl +dnl argument 1 is a word list naming function to check +dnl +dnl ASSUMES arguments are math functions +dnl +dnl GLIBCXX_CHECK_MATH_DECLS +AC_DEFUN([GLIBCXX_CHECK_MATH_DECLS], [ + m4_foreach_w([glibcxx_func], [$1], [ + GLIBCXX_CHECK_MATH_DECL(glibcxx_func) + ]) +])