From patchwork Thu Dec 5 12:16:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 102475 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8BDD13858D28 for ; Thu, 5 Dec 2024 12:17:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8BDD13858D28 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=VECqALUz X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-yw1-x112d.google.com (mail-yw1-x112d.google.com [IPv6:2607:f8b0:4864:20::112d]) by sourceware.org (Postfix) with ESMTPS id C043D3858D28 for ; Thu, 5 Dec 2024 12:16:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C043D3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C043D3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::112d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1733401002; cv=none; b=tc3lWtq31c5mL1YE1rn2tTFyN7cxxVhbJpx3BPXsOfsmWb16xH71JdYts2VneUH5VNHlZ/bht4UskfN5s0hdj8OuSOO6CDiCY24D0iQWhSy9dc3zH+JRJGa3qZJ0wh2s/yy3OCPcA9lvG6crEy23yXpH89Vm/Seq4bsht+lmBjw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1733401002; c=relaxed/simple; bh=pZRi/5qEUH0mPnEryLhQIsQhZ+fnJQqLohTEDZUbaCY=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=OiwbKEePPFvco8UGdHDHP6+Lm9eFTnqkIzdb+kifRAY+3ssyUiQpT/v8vA9KUNt2lvGmehg2DKeoNEBJs7uS5wXPGW7UEC2GF77Mws6Iya0CGulcHh/zu9K5tolrtmHIK+gpTqkRAhzzy2LgydX9pHIrSWebhYhHUscoJv6wJdA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C043D3858D28 Received: by mail-yw1-x112d.google.com with SMTP id 00721157ae682-6ef9b8b4f13so6143847b3.2 for ; Thu, 05 Dec 2024 04:16:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733401002; x=1734005802; darn=sourceware.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=OcxnxBpe5ZugwlvsqlOYs9qTemBgqk9lvo8SkWKP+nQ=; b=VECqALUzjdJ7j4BKem8pGD0txUikWvHRi3ee8s2yf9NVXum4BXkNi8YwmYeVKsD87E PN09r3RpAzOdapExZY6vbHLbOKovssH7cA7f5KWio/HOKiN/zfX+byGMmqhJ3iCsC6t8 g8KfM+Ld9p2GeBzJ1wiFTyOUN5dyWWINLVXzJVILGwaN/nAoVQ3eIXuJ06Jkd0kklxv4 WWzqCCy2AUZjlJIVlPjITRba1BAaIpY3+tWDMTMdbMIE/saa2RDckuV5CPH/A9BNTPS/ 27jgx+dVdvJK35UX7KlYjiNfsoP1KC6eY7CiWz1zHYPewke3wBXPoC99iv0ghq4IRGlO jgfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733401002; x=1734005802; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=OcxnxBpe5ZugwlvsqlOYs9qTemBgqk9lvo8SkWKP+nQ=; b=tSBb4Ru9tC3rSi+RjjlNQWbKm8MZ/fmY2IshFMwV8aqr/ZklXdvNDc40DQied/vDgc SZUoNvWaGhtTDiyu237gsv0/xQGrm/Eu5uitAPtAW84KPMxI3NkMLnjKRfUPKYRCVy7U ljlKb19zvpoOC+X77l7msq685fEByHEUFuCIRn6m9gmejqb8a+q/VYj0tdpF/EaLaPkA hWQAYzMpB1P4bAiSSSiVeZ/UiL7BcW693qqCy26qYMJAlYQODg+IzZ3S+CQT4tIPBhGU 4u8k6JWhQOYEcJi5NqRFR1/PHKef1tFREFQbVDA9nZgVkeBy4sYVkqb4DXdpngN1iQCA g4BA== X-Gm-Message-State: AOJu0YxeMD/Gay/rQ7hjmYnlEM1WD0XKyzKI4vqsMy01aLkJLdqEWKua RRFiyOSN0SWlgHOVQPf18X48Hk0HqQIMGDn0jrFOp9UPrRfvStlIfwKC2+YuxIOyLdTvqSSwgmQ BGHHu8W5cSsjWBg5b6n4QOtZY/uKRj1nLegT5cS3hLmQ= X-Gm-Gg: ASbGncsPCMWJxc01cB75EDzJvDXx6f6jKKQgrfWMbLAA0BDhMWAcvBeVKxEvJklEke7 EaUGQSyb3+OHKeB7jfcGQdMtmrQ8DsRg= X-Google-Smtp-Source: AGHT+IGp7MrQxrkfXF+XCCFhNWKyIqLEhjuxhsrq4AcURQhiFF4UnKL06FGBhQg3dpG4noo6MaiSTg2dYkEYvrbgRec= X-Received: by 2002:a05:690c:6187:b0:6ef:822b:defc with SMTP id 00721157ae682-6eface078a0mr136887847b3.1.1733401001902; Thu, 05 Dec 2024 04:16:41 -0800 (PST) MIME-Version: 1.0 From: "H.J. Lu" Date: Thu, 5 Dec 2024 20:16:05 +0800 Message-ID: Subject: [PATCH v2] math: Remove __XXX math functions from installed math.h [BZ #32418] To: GNU C Library X-Spam-Status: No, score=-3017.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org Since libm doesn't export __XXX math functions, don't declare them in the installed math.h by adding to declare __XXX math functions internally for glibc build. This fixes BZ #32418. Tested with build-many-glibcs.py. From 7c36dbb7002b4ce1693eecdffe72a7eb4143bf35 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 5 Dec 2024 08:05:04 +0800 Subject: [PATCH v2] math: Remove __XXX math functions from installed math.h [BZ #32418] Since libm doesn't export __XXX math functions, don't declare them in the installed math.h by adding to declare __XXX math functions internally for glibc build. This fixes BZ #32418. Signed-off-by: H.J. Lu --- include/bits/mathcalls-macros.h | 12 +++++++++ include/math.h | 5 ++++ math/Makefile | 1 + math/bits/mathcalls-macros.h | 48 +++++++++++++++++++++++++++++++++ math/math.h | 37 +------------------------ 5 files changed, 67 insertions(+), 36 deletions(-) create mode 100644 include/bits/mathcalls-macros.h create mode 100644 math/bits/mathcalls-macros.h diff --git a/include/bits/mathcalls-macros.h b/include/bits/mathcalls-macros.h new file mode 100644 index 0000000000..bd997bd5d4 --- /dev/null +++ b/include/bits/mathcalls-macros.h @@ -0,0 +1,12 @@ +#include + +/* The file contains the prototypes for all the + actual math functions. These macros are used for those prototypes, + so we can easily declare each function as both `name' and `__name', + and can declare the float versions `namef' and `__namef' for internal + use. */ + +#undef __MATHDECLX +#define __MATHDECLX(type, function,suffix, args, attrib) \ + __MATHDECL_1(type, function,suffix, args) __attribute__ (attrib); \ + __MATHDECL_1(type, __CONCAT(__,function),suffix, args) __attribute__ (attrib) diff --git a/include/math.h b/include/math.h index 035fd160ff..9ba4708801 100644 --- a/include/math.h +++ b/include/math.h @@ -10,6 +10,11 @@ /* Now define the internal interfaces. */ extern int __signgam; +# undef __MATHDECLX +# define __MATHDECLX(type, function,suffix, args, attrib) \ + __MATHDECL_1(type, function,suffix, args) __attribute__ (attrib); \ + __MATHDECL_1(type, __CONCAT(__,function),suffix, args) __attribute__ (attrib) + # if IS_IN (libc) || IS_IN (libm) hidden_proto (__finite) hidden_proto (__isinf) diff --git a/math/Makefile b/math/Makefile index 4b1706b425..e6d91571fc 100644 --- a/math/Makefile +++ b/math/Makefile @@ -35,6 +35,7 @@ headers := \ bits/long-double.h \ bits/math-vector.h \ bits/mathcalls-helper-functions.h \ + bits/mathcalls-macros.h \ bits/mathcalls-narrow.h \ bits/mathcalls.h \ bits/mathdef.h \ diff --git a/math/bits/mathcalls-macros.h b/math/bits/mathcalls-macros.h new file mode 100644 index 0000000000..56d6d4da60 --- /dev/null +++ b/math/bits/mathcalls-macros.h @@ -0,0 +1,48 @@ +/* Macros for math function declarations. + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define __SIMD_DECL(function) __CONCAT (__DECL_SIMD_, function) + +#define __MATHCALL_VEC(function, suffix, args) \ + __SIMD_DECL (__MATH_PRECNAME (function, suffix)) \ + __MATHCALL (function, suffix, args) + +#define __MATHDECL_VEC(type, function,suffix, args) \ + __SIMD_DECL (__MATH_PRECNAME (function, suffix)) \ + __MATHDECL(type, function,suffix, args) + +#define __MATHCALL(function,suffix, args) \ + __MATHDECL (_Mdouble_,function,suffix, args) +#define __MATHDECL(type, function,suffix, args) \ + __MATHDECL_1(type, function,suffix, args); \ + __MATHDECL_1(type, __CONCAT(__,function),suffix, args) +#define __MATHCALLX(function,suffix, args, attrib) \ + __MATHDECLX (_Mdouble_,function,suffix, args, attrib) +#define __MATHDECLX(type, function,suffix, args, attrib) \ + __MATHDECL_1(type, function,suffix, args) __attribute__ (attrib); +#define __MATHDECL_1_IMPL(type, function, suffix, args) \ + extern type __MATH_PRECNAME(function,suffix) args __THROW +#define __MATHDECL_1(type, function, suffix, args) \ + __MATHDECL_1_IMPL(type, function, suffix, args) +/* Ignore the alias by default. The alias is only useful with + redirections. */ +#define __MATHDECL_ALIAS(type, function, suffix, args, alias) \ + __MATHDECL_1(type, function, suffix, args) + +#define __MATHREDIR(type, function, suffix, args, to) \ + extern type __REDIRECT_NTH (__MATH_PRECNAME (function, suffix), args, to) diff --git a/math/math.h b/math/math.h index 1e300c4223..599ca3ae79 100644 --- a/math/math.h +++ b/math/math.h @@ -268,42 +268,7 @@ enum }; #endif -/* The file contains the prototypes for all the - actual math functions. These macros are used for those prototypes, - so we can easily declare each function as both `name' and `__name', - and can declare the float versions `namef' and `__namef'. */ - -#define __SIMD_DECL(function) __CONCAT (__DECL_SIMD_, function) - -#define __MATHCALL_VEC(function, suffix, args) \ - __SIMD_DECL (__MATH_PRECNAME (function, suffix)) \ - __MATHCALL (function, suffix, args) - -#define __MATHDECL_VEC(type, function,suffix, args) \ - __SIMD_DECL (__MATH_PRECNAME (function, suffix)) \ - __MATHDECL(type, function,suffix, args) - -#define __MATHCALL(function,suffix, args) \ - __MATHDECL (_Mdouble_,function,suffix, args) -#define __MATHDECL(type, function,suffix, args) \ - __MATHDECL_1(type, function,suffix, args); \ - __MATHDECL_1(type, __CONCAT(__,function),suffix, args) -#define __MATHCALLX(function,suffix, args, attrib) \ - __MATHDECLX (_Mdouble_,function,suffix, args, attrib) -#define __MATHDECLX(type, function,suffix, args, attrib) \ - __MATHDECL_1(type, function,suffix, args) __attribute__ (attrib); \ - __MATHDECL_1(type, __CONCAT(__,function),suffix, args) __attribute__ (attrib) -#define __MATHDECL_1_IMPL(type, function, suffix, args) \ - extern type __MATH_PRECNAME(function,suffix) args __THROW -#define __MATHDECL_1(type, function, suffix, args) \ - __MATHDECL_1_IMPL(type, function, suffix, args) -/* Ignore the alias by default. The alias is only useful with - redirections. */ -#define __MATHDECL_ALIAS(type, function, suffix, args, alias) \ - __MATHDECL_1(type, function, suffix, args) - -#define __MATHREDIR(type, function, suffix, args, to) \ - extern type __REDIRECT_NTH (__MATH_PRECNAME (function, suffix), args, to) +#include #define _Mdouble_ double #define __MATH_PRECNAME(name,r) __CONCAT(name,r) -- 2.47.1