From patchwork Thu Nov 20 18:30:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 124889 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 CFBD0385AC1C for ; Thu, 20 Nov 2025 18:49:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CFBD0385AC1C Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=FJAwruZV X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-dy1-x1341.google.com (mail-dy1-x1341.google.com [IPv6:2607:f8b0:4864:20::1341]) by sourceware.org (Postfix) with ESMTPS id 17526385697E for ; Thu, 20 Nov 2025 18:31:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 17526385697E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 17526385697E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1341 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663477; cv=none; b=OUJYhSw/hDn0SODa+Ph2GZCN1avjp7cHEk1Mz9Ggy7z/jFPUKC3+hK9A4JA1S4lbDzMpH0m0f7CWQO/buZuRaosg9WTT8oLroXd3L+bBJPy2YhupQoGUN9C3cCMHlFsjwF/wf+uEsguq4tv3AWjZHDdeT/qlQ+21FWHbz2uHc2A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663477; c=relaxed/simple; bh=kP0fZDcz489TKhnYxWZDuCWlWOhyrgSs1DBC7a7Xwts=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=MoWahDx15ZXEgCUFG0MaJo+7PHq+xmMip2euH4jPlC5ow5BWoTjcigb749Oklrc5nkEHBmIYjRivxFhJ6bQvqmRqwdk8bFbKkW6ail8O8cCRoQeiysLbrkzbAy81qzn+X9NftLpsPJ24PrRX8eXb9ArkqE9uasJx9bJ2/LoYYhs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 17526385697E Received: by mail-dy1-x1341.google.com with SMTP id 5a478bee46e88-2a484a0b7cfso2095394eec.1 for ; Thu, 20 Nov 2025 10:31:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763663476; x=1764268276; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WkiWSDymN1F+07BKXM6mxr5vFBg1iCcnmuEFUJk7KIs=; b=FJAwruZVeF9YD0aItsb7tcdhMGqzs5CIDb38PenJzFKQOY86damX00Qhe+Ey2IIASp E0tTSbfIkgkO/hq24YaWwDGyKuIaybbmFblRGJp2DXNql4ZHF5Ap3c8j+xqwsjTz/uKe Ec43QxkBsJ4VlKAV6PFZwMQkO9ZQ78sZ+VIu1TZZ9OBLe9DSfer3SLnCFzYfzDCcpBWw wnBXP++AkUHNUZy+/4C0LsLU93n35vfvojpC/6LFd1G5jwoQVyXJWaS8OCmJs65m6+h8 Zq0NWadEcxxdcspcgXcCePraxeIviKAm/L9ysBFOUTwv29iaAAMHtcWxaOjnrHIyEAFA 68Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763663476; x=1764268276; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=WkiWSDymN1F+07BKXM6mxr5vFBg1iCcnmuEFUJk7KIs=; b=EJLvPq9SPbSUTBUhGhc+fLtU0XX8S0qp6vx1GCLsxfBRxaKrlERyS5WnjFMnEARzC9 xnFA4MbHZvlap4z1IeqESOIcJjMSXgR8/F+jQKOaEF1m5+8D2i2BUnlaHB34OICrJ8Wk NB80mAMu2XcOIubDYO8bP074dluTIB9opPsD/SuhfOsJRO0Ye1beU8KFbpJDk0ICaUze 9qtAo7iplPDYGJcJ40hIv6FwQlAGo3UogvWbFjOYQR63zQ90pwu+aPNeffpevbzh4HFZ qAA23qVnqdPxjIwA30eevW9laabMkvM+3iPkMiLXGMvn9H22Q5gP7rlyXug10pNllHz5 Aolw== X-Gm-Message-State: AOJu0YyOyk3/jHnBSkbsDrDSW5oE490w5PzD2NK4dywVJk99LBUvJwHb xtTD1ldYUyUZMRwrYu8D4GBLY7jNqQHQ8xjYAkHUIgFKTD1dws/tUbGKC38zX95ImFZs8nYqxhs 0cn2pdTU43A== X-Gm-Gg: ASbGncu1rdSB8mt2QzIOksbfLjHR6GLLZ8PcSzdBvwAT6XrShVNTVqkbjCZ84rvapQk 6zQvwrrXip9ilx9FeQW2iyAxjpCkp63f+UxAgW+EhuPZLdsDeANqQ/OJt49UiuImi7vpR+ZZcuE ST+MG91ozdpgzuDnRpBS6UcvYqoNkVAyFY84jZ/6h2cTSE2BVtWaJTNshfgoYc4OXiYbGa0ZDhY cuYC/h5xCZHfZ5Itd2IWstfVz7SkuI67Rq2Xkvl4kpOX4sKBTuRByE2zYi6wAFvjLjZITIJT5EW LGIIFHWJWnuqxOsHnOOtgj/6OKKK2XrJMdjWnYek2QUOC9CeJN8Fa0gF4qkNwGRvdothGy56Mpz i53a6DahgEh1I9bF6B3upALxrwsUjflidtTjivtjSVJfHH3qTMVZmKK1UKTjn3PdApKOBT6rTih HhB/OxkKe4OmkQiRDx6ebsuw== X-Google-Smtp-Source: AGHT+IEb8jwuEMrsDI+6UCD7xQxGDY8c8G+XLV+tCl7rA5MGWOq9dkdHJt37qxVGx2wkYguCtRbnVA== X-Received: by 2002:a05:7300:f403:b0:2a4:3593:cca7 with SMTP id 5a478bee46e88-2a6ff530791mr1194646eec.4.1763663475336; Thu, 20 Nov 2025 10:31:15 -0800 (PST) Received: from ubuntu-vm.. ([187.11.52.82]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2a6fc5e3750sm9664359eec.6.2025.11.20.10.31.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 10:31:14 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Sam James , Collin Funk , "H . J . Lu" Subject: [PATCH v5 01/12] Add gmp-arch and udiv_qrnnd Date: Thu, 20 Nov 2025 15:30:05 -0300 Message-ID: <20251120183107.2334580-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> References: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, KAM_STOCKGEN, RCVD_IN_BARRACUDACENTRAL, SCC_10_SHORT_WORD_LINES, SCC_20_SHORT_WORD_LINES, SCC_35_SHORT_WORD_LINES, SCC_5_SHORT_WORD_LINES, 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 To enable “longlong.h” removal, the udiv_qrnnd is moved to a gmp-arch.h file. It allows each architecture to implement its own arch-specific optimizations. The generic implementation now uses a static inline, which provides better type checking than the GNU extension to cast the asm constraint (and it works better with clang). Most of the architecture uses the generic implementation, which is expanded from a macro, except for alpha, x86, m68k, sh, and sparc. I kept that alpha, which uses out-of-the-line implementations and x86, where there is no easy way to use the div{q} instruction from C code. For the rest, the compiler generates good enough code. The hppa also provides arch-specific implementations, but they are not routed in “longlong.h” and thus never used. --- soft-fp/soft-fp.h | 19 +- stdio-common/_itoa.c | 7 +- stdio-common/_itowa.c | 7 +- stdlib/Makefile | 1 - stdlib/addmul_1.c | 1 + stdlib/divmod_1.c | 1 + stdlib/mod_1.c | 1 + stdlib/mul_1.c | 1 + stdlib/strtod_l.c | 1 + stdlib/submul_1.c | 1 + stdlib/udiv_qrnnd.c | 10 - sysdeps/alpha/Makefile | 4 + sysdeps/alpha/gmp-arch.h | 39 ++++ sysdeps/generic/gmp-arch.h | 100 ++++++++++ sysdeps/hppa/hppa1.1/udiv_qrnnd.S | 77 -------- sysdeps/hppa/udiv_qrnnd.S | 285 ---------------------------- sysdeps/ieee754/dbl-64/dbl2mpn.c | 1 + sysdeps/ieee754/ldbl-128/ldbl2mpn.c | 1 + sysdeps/ieee754/ldbl-96/ldbl2mpn.c | 1 + sysdeps/wordsize-32/divdi3.c | 10 +- sysdeps/x86/gmp-arch.h | 52 +++++ sysdeps/x86/ldbl2mpn.c | 1 + 22 files changed, 219 insertions(+), 402 deletions(-) delete mode 100644 stdlib/udiv_qrnnd.c create mode 100644 sysdeps/alpha/gmp-arch.h create mode 100644 sysdeps/generic/gmp-arch.h delete mode 100644 sysdeps/hppa/hppa1.1/udiv_qrnnd.S delete mode 100644 sysdeps/hppa/udiv_qrnnd.S create mode 100644 sysdeps/x86/gmp-arch.h diff --git a/soft-fp/soft-fp.h b/soft-fp/soft-fp.h index 1f08714831..4c0859fa06 100644 --- a/soft-fp/soft-fp.h +++ b/soft-fp/soft-fp.h @@ -316,22 +316,6 @@ #include "op-8.h" #include "op-common.h" -/* Sigh. Silly things longlong.h needs. */ -#define UWtype _FP_W_TYPE -#define W_TYPE_SIZE _FP_W_TYPE_SIZE - -typedef int QItype __attribute__ ((mode (QI))); -typedef int SItype __attribute__ ((mode (SI))); -typedef int DItype __attribute__ ((mode (DI))); -typedef unsigned int UQItype __attribute__ ((mode (QI))); -typedef unsigned int USItype __attribute__ ((mode (SI))); -typedef unsigned int UDItype __attribute__ ((mode (DI))); -#if _FP_W_TYPE_SIZE == 32 -typedef unsigned int UHWtype __attribute__ ((mode (HI))); -#elif _FP_W_TYPE_SIZE == 64 -typedef USItype UHWtype; -#endif - #ifndef CMPtype # define CMPtype int #endif @@ -341,7 +325,10 @@ typedef USItype UHWtype; #ifndef umul_ppmm # ifdef _LIBC +# include +# include # include +# include # else # include "longlong.h" # endif diff --git a/stdio-common/_itoa.c b/stdio-common/_itoa.c index 08859f0dd0..e9cbcfab3b 100644 --- a/stdio-common/_itoa.c +++ b/stdio-common/_itoa.c @@ -26,6 +26,7 @@ #include #include #include +#include #include <_itoa.h> @@ -308,8 +309,8 @@ _itoa (unsigned long long int value, char *buflim, unsigned int base, if (big_normalization_steps == 0) xh = 0; else - xh = (mp_limb_t) (value >> 64 - big_normalization_steps); - xl = (mp_limb_t) (value >> 32 - big_normalization_steps); + xh = (mp_limb_t) (value >> (64 - big_normalization_steps)); + xl = (mp_limb_t) (value >> (32 - big_normalization_steps)); udiv_qrnnd (x1hi, r, xh, xl, big_base_norm); xl = ((mp_limb_t) value) << big_normalization_steps; @@ -320,7 +321,7 @@ _itoa (unsigned long long int value, char *buflim, unsigned int base, xh = x1hi; else xh = ((x1hi << big_normalization_steps) - | (x1lo >> 32 - big_normalization_steps)); + | (x1lo >> (32 - big_normalization_steps))); xl = x1lo << big_normalization_steps; udiv_qrnnd (t[0], x, xh, xl, big_base_norm); t[1] = x >> big_normalization_steps; diff --git a/stdio-common/_itowa.c b/stdio-common/_itowa.c index 6443b293a4..2da7489502 100644 --- a/stdio-common/_itowa.c +++ b/stdio-common/_itowa.c @@ -21,6 +21,7 @@ #include #include #include +#include #include <_itowa.h> @@ -228,8 +229,8 @@ _itowa (unsigned long long int value, wchar_t *buflim, unsigned int base, if (big_normalization_steps == 0) xh = 0; else - xh = (mp_limb_t) (value >> 64 - big_normalization_steps); - xl = (mp_limb_t) (value >> 32 - big_normalization_steps); + xh = (mp_limb_t) (value >> (64 - big_normalization_steps)); + xl = (mp_limb_t) (value >> (32 - big_normalization_steps)); udiv_qrnnd (x1hi, r, xh, xl, big_base_norm); xl = ((mp_limb_t) value) << big_normalization_steps; @@ -240,7 +241,7 @@ _itowa (unsigned long long int value, wchar_t *buflim, unsigned int base, xh = x1hi; else xh = ((x1hi << big_normalization_steps) - | (x1lo >> 32 - big_normalization_steps)); + | (x1lo >> (32 - big_normalization_steps))); xl = x1lo << big_normalization_steps; udiv_qrnnd (t[0], x, xh, xl, big_base_norm); t[1] = x >> big_normalization_steps; diff --git a/stdlib/Makefile b/stdlib/Makefile index 176a79572b..a9a68c190c 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -493,7 +493,6 @@ mpn-routines := \ rshift \ sub_n \ submul_1 \ - udiv_qrnnd \ # mpn-routines mpn-headers = \ asm-syntax.h \ diff --git a/stdlib/addmul_1.c b/stdlib/addmul_1.c index 52411c3d10..a5bf7fd37e 100644 --- a/stdlib/addmul_1.c +++ b/stdlib/addmul_1.c @@ -24,6 +24,7 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, see #include #include "gmp-impl.h" #include "longlong.h" +#include mp_limb_t mpn_addmul_1 (register mp_ptr res_ptr, register mp_srcptr s1_ptr, diff --git a/stdlib/divmod_1.c b/stdlib/divmod_1.c index b91ab9e593..676145d727 100644 --- a/stdlib/divmod_1.c +++ b/stdlib/divmod_1.c @@ -28,6 +28,7 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, see #include #include "gmp-impl.h" #include "longlong.h" +#include #ifndef UMUL_TIME #define UMUL_TIME 1 diff --git a/stdlib/mod_1.c b/stdlib/mod_1.c index 74c1f6a521..be3ae3d648 100644 --- a/stdlib/mod_1.c +++ b/stdlib/mod_1.c @@ -25,6 +25,7 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, see #include #include "gmp-impl.h" #include "longlong.h" +#include #ifndef UMUL_TIME #define UMUL_TIME 1 diff --git a/stdlib/mul_1.c b/stdlib/mul_1.c index 225b4917d9..0a04a8eb1e 100644 --- a/stdlib/mul_1.c +++ b/stdlib/mul_1.c @@ -22,6 +22,7 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, see #include #include "gmp-impl.h" #include "longlong.h" +#include mp_limb_t mpn_mul_1 (register mp_ptr res_ptr, register mp_srcptr s1_ptr, diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c index 5814475e40..7618adb285 100644 --- a/stdlib/strtod_l.c +++ b/stdlib/strtod_l.c @@ -83,6 +83,7 @@ extern double ____strtod_l_internal (const char *, char **, int, locale_t); #include #include "gmp-impl.h" #include "longlong.h" +#include "gmp-arch.h" #include "fpioconst.h" #include diff --git a/stdlib/submul_1.c b/stdlib/submul_1.c index 3eb4d015f5..0005c2e04e 100644 --- a/stdlib/submul_1.c +++ b/stdlib/submul_1.c @@ -24,6 +24,7 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, see #include #include "gmp-impl.h" #include "longlong.h" +#include mp_limb_t mpn_submul_1 (register mp_ptr res_ptr, register mp_srcptr s1_ptr, diff --git a/stdlib/udiv_qrnnd.c b/stdlib/udiv_qrnnd.c deleted file mode 100644 index d32796c04d..0000000000 --- a/stdlib/udiv_qrnnd.c +++ /dev/null @@ -1,10 +0,0 @@ -/* For some machines GNU MP needs to define an auxiliary function: - - udiv_qrnnd (quotient, remainder, high_numerator, low_numerator, denominator) - - Divides a two-word unsigned integer, composed by the integers - HIGH_NUMERATOR and LOW_NUMERATOR, by DENOMINATOR and places the quotient - in QUOTIENT and the remainder in REMAINDER. HIGH_NUMERATOR must be less - than DENOMINATOR for correct operation. If, in addition, the most - significant bit of DENOMINATOR must be 1, then the pre-processor symbol - UDIV_NEEDS_NORMALIZATION is defined to 1. */ diff --git a/sysdeps/alpha/Makefile b/sysdeps/alpha/Makefile index 39dea0d72c..cae60186c8 100644 --- a/sysdeps/alpha/Makefile +++ b/sysdeps/alpha/Makefile @@ -32,6 +32,10 @@ ifeq ($(subdir),string) sysdep_routines += stxcpy stxncpy endif +ifeq ($(subdir),stdlib) +sysdep_routines += udiv_qrnnd +endif + ifeq ($(subdir),elf) # The ld.so startup code cannot use literals until it self-relocates. CFLAGS-rtld.c = -mbuild-constants diff --git a/sysdeps/alpha/gmp-arch.h b/sysdeps/alpha/gmp-arch.h new file mode 100644 index 0000000000..5897af7ce7 --- /dev/null +++ b/sysdeps/alpha/gmp-arch.h @@ -0,0 +1,39 @@ +/* Multiprecision generic functions. Alpha version. + Copyright (C) 2025 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 + . */ + +#ifndef __GMP_ALPHA_ARCH_H +#define __GMP_ALPHA_ARCH_H + +extern mp_limb_t __udiv_qrnnd (mp_limb_t *, mp_limb_t, mp_limb_t, mp_limb_t) + attribute_hidden; + +static __always_inline void +udiv_qrnnd_alpha (mp_limb_t *q, mp_limb_t *r, mp_limb_t n1, mp_limb_t n0, + mp_limb_t d) +{ + *q = __udiv_qrnnd (r, n1, n0, d); +} +#undef UDIV_NEEDS_NORMALIZATION +#define UDIV_NEEDS_NORMALIZATION 0 +# undef udiv_qrnnd +# define udiv_qrnnd(__q, __r, __n1, __n0, __d) \ + udiv_qrnnd_alpha (&__q, &__r, __n1, __n0, __d) + +#include + +#endif diff --git a/sysdeps/generic/gmp-arch.h b/sysdeps/generic/gmp-arch.h new file mode 100644 index 0000000000..b093f59e20 --- /dev/null +++ b/sysdeps/generic/gmp-arch.h @@ -0,0 +1,100 @@ +/* Multiprecision generic functions. + Copyright (C) 2025 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 + . */ + +#ifndef __GMP_ARCH_H +#define __GMP_ARCH_H + +#include +#include + +#define LL_B ((mp_limb_t) 1 << (BITS_PER_MP_LIMB / 2)) + +static __always_inline mp_limb_t +ll_lowpart (mp_limb_t t) +{ + return t & (LL_B - 1); +} + +static __always_inline mp_limb_t +ll_highpart (mp_limb_t t) +{ + return t >> (BITS_PER_MP_LIMB / 2); +} + +/* udiv_qrnnd(quotient, remainder, high_numerator, low_numerator, + denominator) divides a UDWtype, composed by the UWtype integers + HIGH_NUMERATOR and LOW_NUMERATOR, by DENOMINATOR and places the quotient + in QUOTIENT and the remainder in REMAINDER. HIGH_NUMERATOR must be less + than DENOMINATOR for correct operation. If, in addition, the most + significant bit of DENOMINATOR must be 1, then the pre-processor symbol + UDIV_NEEDS_NORMALIZATION is defined to 1. */ +#ifndef udiv_qrnnd +static __always_inline void +udiv_qrnnd_generic (mp_limb_t *q, mp_limb_t *r, mp_limb_t n1, mp_limb_t n0, + mp_limb_t d) +{ + mp_limb_t d1 = ll_highpart (d), + d0 = ll_lowpart (d), + q1, q0; + mp_limb_t r1, r0, m; + + r1 = n1 % d1; + q1 = n1 / d1; + m = q1 * d0; + r1 = r1 * LL_B | ll_highpart (n0); + if (r1 < m) + { + q1--; + r1 += d; + if (r1 >= d) + if (r1 < m) + { + q1--; + r1 += d; + } + } + r1 -= m; + + r0 = r1 % d1; + q0 = r1 / d1; + m = q0 * d0; + r0 = r0 * LL_B | ll_lowpart (n0); + if (r0 < m) + { + q0--; + r0 += d; + if (r0 >= d) + if (r0 < m) + { + q0--; + r0 += d; + } + } + r0 -= m; + + *q = q1 * LL_B | q0; + *r = r0; +} +# undef UDIV_NEEDS_NORMALIZATION +# define UDIV_NEEDS_NORMALIZATION 1 +# undef udiv_qrnnd +# define udiv_qrnnd(__q, __r, __n1, __n0, __d) \ + udiv_qrnnd_generic (&__q, &__r, __n1, __n0, __d) +#endif + +#endif /* __GMP_ARCH_H */ diff --git a/sysdeps/hppa/hppa1.1/udiv_qrnnd.S b/sysdeps/hppa/hppa1.1/udiv_qrnnd.S deleted file mode 100644 index 2f8101bbd2..0000000000 --- a/sysdeps/hppa/hppa1.1/udiv_qrnnd.S +++ /dev/null @@ -1,77 +0,0 @@ -;! HP-PA __udiv_qrnnd division support, used from longlong.h. -;! This version runs fast on PA 7000 and later. - -;! Copyright (C) 1993-2025 Free Software Foundation, Inc. - -;! This file is part of the GNU MP Library. - -;! The GNU MP 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 MP 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 MP Library. If not, see -;! . - - -;! INPUT PARAMETERS -;! rem_ptr gr26 -;! n1 gr25 -;! n0 gr24 -;! d gr23 - - .text -L$0000: - .word 0x43f00000 - .word 0x0 - .export __udiv_qrnnd -__udiv_qrnnd: - .proc - .callinfo frame=64,no_calls - .entry - ldo 64(%r30),%r30 - - stws %r25,-16(%r30) ;! n_hi - stws %r24,-12(%r30) ;! n_lo - b,l L$0,%r1 - ldo L$0000-L$0(%r1),%r1 -L$0: - fldds -16(%r30),%fr5 - stws %r23,-12(%r30) - comib,<= 0,%r25,L$1 - fcnvxf,dbl,dbl %fr5,%fr5 - fldds 0(%r1),%fr4 - fadd,dbl %fr4,%fr5,%fr5 -L$1: - fcpy,sgl %fr0,%fr6L - fldws -12(%r30),%fr6R - fcnvxf,dbl,dbl %fr6,%fr4 - - fdiv,dbl %fr5,%fr4,%fr5 - - fcnvfx,dbl,dbl %fr5,%fr4 - fstws %fr4R,-16(%r30) - xmpyu %fr4R,%fr6R,%fr6 - ldws -16(%r30),%r28 - fstds %fr6,-16(%r30) - ldws -12(%r30),%r21 - ldws -16(%r30),%r20 - sub %r24,%r21,%r22 - subb %r25,%r20,%r1 - comib,= 0,%r1,L$2 - ldo -64(%r30),%r30 - - add %r22,%r23,%r22 - ldo -1(%r28),%r28 -L$2: - bv 0(%r2) - stws %r22,0(%r26) - - .exit - .procend diff --git a/sysdeps/hppa/udiv_qrnnd.S b/sysdeps/hppa/udiv_qrnnd.S deleted file mode 100644 index 317fcda722..0000000000 --- a/sysdeps/hppa/udiv_qrnnd.S +++ /dev/null @@ -1,285 +0,0 @@ -;! HP-PA __udiv_qrnnd division support, used from longlong.h. -;! This version runs fast on pre-PA7000 CPUs. - -;! Copyright (C) 1993-2025 Free Software Foundation, Inc. - -;! This file is part of the GNU MP Library. - -;! The GNU MP 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 MP 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 MP Library. If not, see -;! . - - -;! INPUT PARAMETERS -;! rem_ptr gr26 -;! n1 gr25 -;! n0 gr24 -;! d gr23 - -;! The code size is a bit excessive. We could merge the last two ds;addc -;! sequences by simply moving the "bb,< Odd" instruction down. The only -;! trouble is the FFFFFFFF code that would need some hacking. - - .text - .export __udiv_qrnnd -__udiv_qrnnd: - .proc - .callinfo frame=0,no_calls - .entry - - comb,< %r23,%r0,L$largedivisor - sub %r0,%r23,%r1 ;! clear cy as side-effect - ds %r0,%r1,%r0 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r24 - ds %r25,%r23,%r25 - addc %r24,%r24,%r28 - ds %r25,%r23,%r25 - comclr,>= %r25,%r0,%r0 - addl %r25,%r23,%r25 - stws %r25,0(%r26) - bv 0(%r2) - addc %r28,%r28,%r28 - -L$largedivisor: - extru %r24,31,1,%r20 ;! r20 = n0 & 1 - bb,< %r23,31,L$odd - extru %r23,30,31,%r22 ;! r22 = d >> 1 - shd %r25,%r24,1,%r24 ;! r24 = new n0 - extru %r25,30,31,%r25 ;! r25 = new n1 - sub %r0,%r22,%r21 - ds %r0,%r21,%r0 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - comclr,>= %r25,%r0,%r0 - addl %r25,%r22,%r25 - sh1addl %r25,%r20,%r25 - stws %r25,0(%r26) - bv 0(%r2) - addc %r24,%r24,%r28 - -L$odd: addib,sv,n 1,%r22,L$FF.. ;! r22 = (d / 2 + 1) - shd %r25,%r24,1,%r24 ;! r24 = new n0 - extru %r25,30,31,%r25 ;! r25 = new n1 - sub %r0,%r22,%r21 - ds %r0,%r21,%r0 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r24 - ds %r25,%r22,%r25 - addc %r24,%r24,%r28 - comclr,>= %r25,%r0,%r0 - addl %r25,%r22,%r25 - sh1addl %r25,%r20,%r25 -;! We have computed (n1,,n0) / (d + 1), q' = r28, r' = r25 - add,nuv %r28,%r25,%r25 - addl %r25,%r1,%r25 - addc %r0,%r28,%r28 - sub,<< %r25,%r23,%r0 - addl %r25,%r1,%r25 - stws %r25,0(%r26) - bv 0(%r2) - addc %r0,%r28,%r28 - -;! This is just a special case of the code above. -;! We come here when d == 0xFFFFFFFF -L$FF..: add,uv %r25,%r24,%r24 - sub,<< %r24,%r23,%r0 - ldo 1(%r24),%r24 - stws %r24,0(%r26) - bv 0(%r2) - addc %r0,%r25,%r28 - - .exit - .procend diff --git a/sysdeps/ieee754/dbl-64/dbl2mpn.c b/sysdeps/ieee754/dbl-64/dbl2mpn.c index d69973419b..cacf5da7d8 100644 --- a/sysdeps/ieee754/dbl-64/dbl2mpn.c +++ b/sysdeps/ieee754/dbl-64/dbl2mpn.c @@ -18,6 +18,7 @@ #include "gmp.h" #include "gmp-impl.h" #include "longlong.h" +#include #include #include #include diff --git a/sysdeps/ieee754/ldbl-128/ldbl2mpn.c b/sysdeps/ieee754/ldbl-128/ldbl2mpn.c index d3f3476d56..fd75db1271 100644 --- a/sysdeps/ieee754/ldbl-128/ldbl2mpn.c +++ b/sysdeps/ieee754/ldbl-128/ldbl2mpn.c @@ -18,6 +18,7 @@ #include "gmp.h" #include "gmp-impl.h" #include "longlong.h" +#include #include #include #include diff --git a/sysdeps/ieee754/ldbl-96/ldbl2mpn.c b/sysdeps/ieee754/ldbl-96/ldbl2mpn.c index 982f427380..6c7aadbca2 100644 --- a/sysdeps/ieee754/ldbl-96/ldbl2mpn.c +++ b/sysdeps/ieee754/ldbl-96/ldbl2mpn.c @@ -18,6 +18,7 @@ #include "gmp.h" #include "gmp-impl.h" #include "longlong.h" +#include #include #include #include diff --git a/sysdeps/wordsize-32/divdi3.c b/sysdeps/wordsize-32/divdi3.c index 387022ab14..360094134f 100644 --- a/sysdeps/wordsize-32/divdi3.c +++ b/sysdeps/wordsize-32/divdi3.c @@ -25,20 +25,16 @@ #error This is for 32-bit targets only #endif -typedef unsigned int UQItype __attribute__ ((mode (QI))); -typedef int SItype __attribute__ ((mode (SI))); -typedef unsigned int USItype __attribute__ ((mode (SI))); -typedef int DItype __attribute__ ((mode (DI))); -typedef unsigned int UDItype __attribute__ ((mode (DI))); #define Wtype SItype #define HWtype SItype #define DWtype DItype -#define UWtype USItype #define UHWtype USItype #define UDWtype UDItype -#define W_TYPE_SIZE 32 +#include +#include #include +#include #if __BYTE_ORDER == __BIG_ENDIAN struct DWstruct { Wtype high, low;}; diff --git a/sysdeps/x86/gmp-arch.h b/sysdeps/x86/gmp-arch.h new file mode 100644 index 0000000000..5d65b16216 --- /dev/null +++ b/sysdeps/x86/gmp-arch.h @@ -0,0 +1,52 @@ +/* Multiprecision generic functions. x86 version. + Copyright (C) 2025 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 + . */ + +#ifndef __GMP_X64_ARCH_H +#define __GMP_X64_ARCH_H + +#include + +static __always_inline void +udiv_qrnnd_x86 (mp_limb_t *q, mp_limb_t *r, mp_limb_t n1, mp_limb_t n0, + mp_limb_t d) +{ +#ifdef __x86_64__ + asm ("div{q} %4" + : "=a" (*q), + "=d" (*r) + : "0" (n0), + "1" (n1), + "rm" (d)); +#else + asm ("div{l} %4" + : "=a" (*q), + "=d" (*r) + : "0" (n0), + "1" (n1), + "rm" (d)); +#endif +} +#undef UDIV_NEEDS_NORMALIZATION +#define UDIV_NEEDS_NORMALIZATION 0 +#undef udiv_qrnnd +#define udiv_qrnnd(__q, __r, __n1, __n0, __d) \ + udiv_qrnnd_x86 (&__q, &__r, __n1, __n0, __d) + +#include + +#endif diff --git a/sysdeps/x86/ldbl2mpn.c b/sysdeps/x86/ldbl2mpn.c index c41fb8da14..593c472e8a 100644 --- a/sysdeps/x86/ldbl2mpn.c +++ b/sysdeps/x86/ldbl2mpn.c @@ -18,6 +18,7 @@ #include "gmp.h" #include "gmp-impl.h" #include "longlong.h" +#include #include #include #include From patchwork Thu Nov 20 18:30:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 124890 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 DE504385AC1A for ; Thu, 20 Nov 2025 18:50:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DE504385AC1A Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=JusWgQX3 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by sourceware.org (Postfix) with ESMTPS id C9105385B510 for ; Thu, 20 Nov 2025 18:31:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C9105385B510 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C9105385B510 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::536 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663479; cv=none; b=RihdcfKrzaVozcsT8IdnriWHwmYaVqiNouGtWLld6RqOgq6kjq3X3saqDgZyO1zWWU2xoNG2zapRXSESTrSKyCvJYl6GNhd4B3JmZSxvG6mQ1M3GBot/uML5ymOQF4Zk+DIFV3y0l5dR4MnHDaHrHD2y+jwp2Y5dbqBkg/7G6AU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663479; c=relaxed/simple; bh=2f3IovLSHhIGbKe6sIyKJ6La+SjFucCEjTqBNGQXAx4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=paJktnjUlkZmuZ+p+2LLuP2EzUUQwjn1NRTNmzeovGMRllf5pdFd5MoYCV/OVPOBbfBEkNfwvZotZkn9vCWIi9feVA2dG1HUZcCfTTfDMNZtcn6/p+EJYxQeyAJkImnxXsDYr/iqFcsSE3mOaEVJorR8WOoaUk5UbiaSanWzoUY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C9105385B510 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-bc274b8b15bso1001646a12.1 for ; Thu, 20 Nov 2025 10:31:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763663477; x=1764268277; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XYhcxaQIZ6rm67++mXIR3WRUNjP4QqdbXiegp8dyti8=; b=JusWgQX3kDtu4GdvbI2YblmnRD9KBS64ajKfk6EMG5KY/l1YyIhmC8O6vXEQlKwmHD JsPyACvg1M910ylLG6LKrqx8nyCHqk5wRWMC8X4N9yxCiS2n+j0//r4CliJRyOQGrVC7 4j/g8KUZG+hUq6CIQIshFzPZ+aip2Th4HQDkkWsEhwQ8znYW96ATkGKvaJkD5Ueg5znH XJGzpMxRiuuurJ7pMiPY72IBg4t9Kp/ByX/knjEZRO/QjcYGYpzQCIBBuuRp9xm6E+pE qQSj610vA7J5LUZ32Q/ikmHogiqKhM609V0RR7gLgBQGDKgUAQObrBtEmuIq8tWrYylQ 2v1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763663477; x=1764268277; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=XYhcxaQIZ6rm67++mXIR3WRUNjP4QqdbXiegp8dyti8=; b=J/9RqiAT/cDK3yDAkAVTb+lXAHPfQuJh/mCCgD73Ml+1bBM2jryvErPqvHXk8wgOSU 39wJLb5NI2A7MsY1g6EhZhca9wVPpFFHcv16WLbvmXnFjYN91PVKpsxxahWjQsl8moia TQyOmYLMG5klGuLph6p00dV7LlsFElKjTIRhYhcZ5mYSzhGosfOev8bLQZOCslPS8V22 +LljdJTOzwny/cfNaTX16yT5O6lK55bja7wScC9hbiNBzPqeJyXSdfoStuO2r+XAZVdU mHNBUDqVHD4Q94MfCa6kQJ+jbaWR9aYkTtjickQxXaAqcziZwWAq8KU9O7TRlh+I3H1Q YTGA== X-Gm-Message-State: AOJu0YzIjZgAZnm8843WtirFVEXRNvP2OIrofRAZj/nRg9agcyWxUVdy q4aWp9hV89XEHJA0smkuZ73ZqZ5bqXm/uOWDxb3arAGUteTnQyMI/JshNOEpLMgAq74PrtpJaVP //zYDnYA= X-Gm-Gg: ASbGncs9FluvdB0BFFXBSZ/WCQKiUvTCMMUgJkuVtguzoEVl0+NRlhYVPc7KlWfJUBD UTEEdmbTXCHmIUfSBpGngJ0Qxtw5JNubIaYZU51/M1HyZaqKCyB19Ds9GLXAPmwQmaCMm28dkZc gmc5QJiI1cVxSFw2TBfhDQwBg7K31lttNfvh2W8odHHpe3QQUyish15RnIlTZ1p91wYxIvqOAwc 7LV+IuE6f8jIQHxWmcjVRj/QRVZKV5ARcnPReU7MYVTOZIVMUT7i40FV0+CgShlKw5LwxlyvoIK GhXKGdm59i+Nd8xhUNz2JCEOI1p/1I7ZYh8I5mlyEmS7ZAzOwVK8kRQqlf4Rn1pvgdwc0xBsNjt QKrlUrC5+6zENY4C6rU4NHi5XXOPNDt5TK0r/+sklrX2ZbL//8tHAo39xny5BV8jrKJpMjAYNzy cQAEiT14H801A9Zi9Unv/0DQ== X-Google-Smtp-Source: AGHT+IFyo6DsOQG0/Ah6gEFTXq0KHYqCw6mEgzGIUCGkefin7Cj2eip82NVI0Zwpo6mFtJQHt7VUDw== X-Received: by 2002:a05:7300:72cf:b0:2a4:3592:cf7a with SMTP id 5a478bee46e88-2a6fd176503mr1628882eec.30.1763663477300; Thu, 20 Nov 2025 10:31:17 -0800 (PST) Received: from ubuntu-vm.. ([187.11.52.82]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2a6fc5e3750sm9664359eec.6.2025.11.20.10.31.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 10:31:16 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Sam James , Collin Funk , "H . J . Lu" Subject: [PATCH v5 02/12] Add add_ssaaaa and sub_ssaaaa to gmp-arch.h Date: Thu, 20 Nov 2025 15:30:06 -0300 Message-ID: <20251120183107.2334580-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> References: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, 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 To enable “longlong.h” removal, add_ssaaaa and sub_ssaaaa are moved to gmp-arch.h. The generic implementation now uses a static inline. This provides better type checking than the GNU extension, which casts the asm constraint; and it also works better with clang. Most architectures use the generic implementation, with except of arc, arm, hppa, x86, m68k, powerpc, and sparc. The 32 bit architectures the compiler generates good enough code using uint64_t types, where for 64 bit architecture the patch leverages the math_u128.h definitions that uses 128-bit integers when available (all 64 bit architectures on gcc 15). The strongly typed implementation required some changes. I adjusted _FP_W_TYPE, _FP_WS_TYPE, and _FP_I_TYPE to use the same type as mp_limb_t on aarch64, powerpc64le, x86_64, and riscv64. This basically means using “long” instead of “long long.” --- sysdeps/aarch64/sfp-machine.h | 4 +- sysdeps/generic/gmp-arch.h | 55 +++++++++++++++++++ sysdeps/generic/math_uint128.h | 27 +++++++-- sysdeps/loongarch/sfp-machine.h | 6 +- .../powerpc/powerpc64/le/fpu/sfp-machine.h | 6 +- sysdeps/riscv/sfp-machine.h | 6 +- sysdeps/x86/fpu/sfp-machine.h | 18 ++++-- 7 files changed, 101 insertions(+), 21 deletions(-) diff --git a/sysdeps/aarch64/sfp-machine.h b/sysdeps/aarch64/sfp-machine.h index b41a9462df..3468e47db3 100644 --- a/sysdeps/aarch64/sfp-machine.h +++ b/sysdeps/aarch64/sfp-machine.h @@ -2,9 +2,9 @@ #include #define _FP_W_TYPE_SIZE 64 -#define _FP_W_TYPE unsigned long long +#define _FP_W_TYPE unsigned long #define _FP_WS_TYPE signed long long -#define _FP_I_TYPE long long +#define _FP_I_TYPE long #define _FP_MUL_MEAT_S(R,X,Y) \ _FP_MUL_MEAT_1_imm(_FP_WFRACBITS_S,R,X,Y) diff --git a/sysdeps/generic/gmp-arch.h b/sysdeps/generic/gmp-arch.h index b093f59e20..3adab10732 100644 --- a/sysdeps/generic/gmp-arch.h +++ b/sysdeps/generic/gmp-arch.h @@ -21,6 +21,7 @@ #include #include +#include #define LL_B ((mp_limb_t) 1 << (BITS_PER_MP_LIMB / 2)) @@ -97,4 +98,58 @@ udiv_qrnnd_generic (mp_limb_t *q, mp_limb_t *r, mp_limb_t n1, mp_limb_t n0, udiv_qrnnd_generic (&__q, &__r, __n1, __n0, __d) #endif + +/* add_ssaaaa(high_sum, low_sum, high_addend_1, low_addend_1, + high_addend_2, low_addend_2) adds two UWtype integers, composed by + HIGH_ADDEND_1 and LOW_ADDEND_1, and HIGH_ADDEND_2 and LOW_ADDEND_2 + respectively. The result is placed in HIGH_SUM and LOW_SUM. Overflow + (i.e. carry out) is not stored anywhere, and is lost. */ +static __always_inline void +add_ssaaaa_generic (mp_limb_t *sh, mp_limb_t *sl, mp_limb_t ah, + mp_limb_t al, mp_limb_t bh, mp_limb_t bl) +{ +#if __WORDSIZE == 32 + uint64_t a = (uint64_t)ah << 32 | al; + uint64_t b = (uint64_t)bh << 32 | bl; + uint64_t r = a + b; + *sh = r >> 32; + *sl = r & 0xFFFFFFFF; +#else + u128 r = u128_add (u128_from_hl (ah, al), + u128_from_hl (bh, bl)); + *sh = u128_high (r); + *sl = u128_low (r); +#endif +} +#undef add_ssaaaa +#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ + add_ssaaaa_generic (&sh, &sl, ah, al, bh, bl) + +/* sub_ddmmss(high_difference, low_difference, high_minuend, low_minuend, + high_subtrahend, low_subtrahend) subtracts two two-word UWtype integers, + composed by HIGH_MINUEND_1 and LOW_MINUEND_1, and HIGH_SUBTRAHEND_2 and + LOW_SUBTRAHEND_2 respectively. The result is placed in HIGH_DIFFERENCE + and LOW_DIFFERENCE. Overflow (i.e. carry out) is not stored anywhere, + and is lost. */ +static __always_inline void +sub_ddmmss_generic (mp_limb_t *sh, mp_limb_t *sl, mp_limb_t ah, + mp_limb_t al, mp_limb_t bh, mp_limb_t bl) +{ +#if __WORDSIZE == 32 + uint64_t a = (uint64_t)ah << 32 | al; + uint64_t b = (uint64_t)bh << 32 | bl; + uint64_t r = a - b; + *sh = r >> 32; + *sl = r & 0xFFFFFFFF; +#else + u128 r = u128_sub (u128_from_hl (ah, al), + u128_from_hl (bh, bl)); + *sh = u128_high (r); + *sl = u128_low (r); +#endif +} +#undef sub_ddmmss +#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + sub_ddmmss_generic (&sh, &sl, ah, al, bh, bl) + #endif /* __GMP_ARCH_H */ diff --git a/sysdeps/generic/math_uint128.h b/sysdeps/generic/math_uint128.h index 56d0fba780..438314cabc 100644 --- a/sysdeps/generic/math_uint128.h +++ b/sysdeps/generic/math_uint128.h @@ -19,6 +19,8 @@ #ifndef _MATH_INT128_H #define _MATH_INT128_H +#include + /* Limited support for internal 128 bit integer, used on some math implementations. It uses compiler builtin type if supported, otherwise it is emulated. Only unsigned and some operations are currently supported: @@ -27,8 +29,11 @@ - u128_high: return the high part of the number. - u128_low: return the low part of the number. - u128_from_u64: create a 128 bit number from a 64 bit one. + - u128_from_hl: create a 128 bit number from two 64 bit numbers. - u128_mul: multiply two 128 bit numbers. - u128_add: add two 128 bit numbers. + - u128_sub: subtract two 128 bit numbers. + - u128_neg: negate a 128 bit number. - u128_lshift: left shift a number. - u128_rshift: right shift a number. */ @@ -47,8 +52,10 @@ typedef unsigned __int128 u128; # define u128_high(__x) (uint64_t)((__x) >> 64) # define u128_low(__x) (uint64_t)(__x) # define u128_from_u64(__x) (u128)(__x) +# define u128_from_hl(__h, __l) (((u128)(__h) << 64) | (__l)) # define u128_mul(__x, __y) (__x) * (__y) # define u128_add(__x, __y) (__x) + (__y) +# define u128_sub(__x, __y) (__x) - (__y) # define u128_lshift(__x, __y) (__x) << (__y) # define u128_rshift(__x, __y) (__x) >> (__y) #else @@ -61,16 +68,28 @@ typedef struct # define u128_high(__x) (__x).high # define u128_low(__x) (__x).low # define u128_from_u64(__x) (u128){.low = (__x), .high = 0} +# define u128_from_hl(__h, __l) (u128){.low = (__l), .high = (__h)} # define MASK32 (UINT64_C(0xffffffff)) -static u128 u128_add (u128 x, u128 y) +static inline u128 u128_add (u128 x, u128 y) { bool carry = x.low + y.low < x.low; return (u128) { .high = x.high + y.high + carry, .low = x.low + y.low }; } -static u128 u128_lshift (u128 x, unsigned int n) +static inline u128 u128_neg (u128 x) +{ + u128 xbitnot = u128_from_hl (~x.high, ~x.low); + return u128_add (xbitnot, u128_from_u64 (1)); +} + +static inline u128 u128_sub (u128 x, u128 y) +{ + return u128_add (x, u128_neg (y)); +} + +static inline u128 u128_lshift (u128 x, unsigned int n) { switch (n) { @@ -82,7 +101,7 @@ static u128 u128_lshift (u128 x, unsigned int n) } } -static u128 u128_rshift (u128 x, unsigned int n) +static inline u128 u128_rshift (u128 x, unsigned int n) { switch (n) { @@ -94,7 +113,7 @@ static u128 u128_rshift (u128 x, unsigned int n) } } -static u128 u128_mul (u128 x, u128 y) +static inline u128 u128_mul (u128 x, u128 y) { if (x.high == 0 && y.high == 0) { diff --git a/sysdeps/loongarch/sfp-machine.h b/sysdeps/loongarch/sfp-machine.h index 497b550f5c..113d96651b 100644 --- a/sysdeps/loongarch/sfp-machine.h +++ b/sysdeps/loongarch/sfp-machine.h @@ -21,9 +21,9 @@ #include #define _FP_W_TYPE_SIZE 64 -#define _FP_W_TYPE unsigned long long -#define _FP_WS_TYPE signed long long -#define _FP_I_TYPE long long +#define _FP_W_TYPE unsigned long +#define _FP_WS_TYPE signed long +#define _FP_I_TYPE long #define _FP_MUL_MEAT_S(R, X, Y) _FP_MUL_MEAT_1_imm (_FP_WFRACBITS_S, R, X, Y) #define _FP_MUL_MEAT_D(R, X, Y) \ diff --git a/sysdeps/powerpc/powerpc64/le/fpu/sfp-machine.h b/sysdeps/powerpc/powerpc64/le/fpu/sfp-machine.h index b4b27f95f4..30b7fcf6ed 100644 --- a/sysdeps/powerpc/powerpc64/le/fpu/sfp-machine.h +++ b/sysdeps/powerpc/powerpc64/le/fpu/sfp-machine.h @@ -1,7 +1,7 @@ #define _FP_W_TYPE_SIZE 64 -#define _FP_W_TYPE unsigned long long -#define _FP_WS_TYPE signed long long -#define _FP_I_TYPE long long +#define _FP_W_TYPE unsigned long +#define _FP_WS_TYPE signed long +#define _FP_I_TYPE long typedef int TItype __attribute__ ((mode (TI))); typedef unsigned int UTItype __attribute__ ((mode (TI))); diff --git a/sysdeps/riscv/sfp-machine.h b/sysdeps/riscv/sfp-machine.h index 43b2ba10ab..a38edd1e3c 100644 --- a/sysdeps/riscv/sfp-machine.h +++ b/sysdeps/riscv/sfp-machine.h @@ -52,9 +52,9 @@ #else # define _FP_W_TYPE_SIZE 64 -# define _FP_W_TYPE unsigned long long -# define _FP_WS_TYPE signed long long -# define _FP_I_TYPE long long +# define _FP_W_TYPE unsigned long +# define _FP_WS_TYPE signed long +# define _FP_I_TYPE long # define _FP_MUL_MEAT_S(R, X, Y) \ _FP_MUL_MEAT_1_imm (_FP_WFRACBITS_S, R, X, Y) diff --git a/sysdeps/x86/fpu/sfp-machine.h b/sysdeps/x86/fpu/sfp-machine.h index e30cbdb20b..aae0653c83 100644 --- a/sysdeps/x86/fpu/sfp-machine.h +++ b/sysdeps/x86/fpu/sfp-machine.h @@ -18,9 +18,15 @@ typedef long int __gcc_CMPtype; #ifdef __x86_64__ # define _FP_W_TYPE_SIZE 64 -# define _FP_W_TYPE unsigned long long -# define _FP_WS_TYPE signed long long -# define _FP_I_TYPE long long +# ifndef __ILP32__ +# define _FP_W_TYPE unsigned long +# define _FP_WS_TYPE signed long +# define _FP_I_TYPE long +# else +# define _FP_W_TYPE unsigned long long +# define _FP_WS_TYPE signed long long +# define _FP_I_TYPE long long +# endif typedef int TItype __attribute__ ((mode (TI))); typedef unsigned int UTItype __attribute__ ((mode (TI))); @@ -55,9 +61,9 @@ typedef unsigned int UTItype __attribute__ ((mode (TI))); } while (0) #else # define _FP_W_TYPE_SIZE 32 -# define _FP_W_TYPE unsigned int -# define _FP_WS_TYPE signed int -# define _FP_I_TYPE int +# define _FP_W_TYPE unsigned long int +# define _FP_WS_TYPE signed long int +# define _FP_I_TYPE long int # define __FP_FRAC_ADD_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \ __asm__ ("add{l} {%11,%3|%3,%11}\n\t" \ From patchwork Thu Nov 20 18:30:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 124892 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 0F9D3385AC1E for ; Thu, 20 Nov 2025 18:53:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0F9D3385AC1E Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=PefS5cJX X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by sourceware.org (Postfix) with ESMTPS id DC8793858C53 for ; Thu, 20 Nov 2025 18:31:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DC8793858C53 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DC8793858C53 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::636 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663486; cv=none; b=OELxc6AvzQSB7E2/50fQVxumVpQEXT3apEAdeW/N7a8FpsBsyjgKJCpBZ20ohk/8TUoWD9mSTsbp9U/P2QSe8MiuPJMby4nPTpaFG2v96liutuPpc0ZBLEH7zLI5V8/l4ZP7JkXZd272R0Xoax96qPN3+gxbv4R54TkZdG2GvqQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663486; c=relaxed/simple; bh=w2LZv3gzNXwKVeb2wutsrYfLuSCF4nww+eSUPPIY9GI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=UH9V/P2nXzpSy+ZjuLpVjKwK5o2RT0b84W/OI0AuoPJWcJw7x68xxMlFek/N41+rjj6DMuNTtkculgg1i3dMdnNjnB9HbtQnINf0JsCMmpy1/2Ip+qCKW1lnYpGt8n4q0FEGqAuOL5ahpDZ3peaqJDCj2PqK5b00kBUgr0W+CNw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DC8793858C53 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-29558061c68so16112655ad.0 for ; Thu, 20 Nov 2025 10:31:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763663484; x=1764268284; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RZB5bC+Vqa6Kcy2QZ4+aGFmyOpDR6w4njHGcIBgIDHM=; b=PefS5cJXvynVypD+egZBoebyE8OipUuZECDztS3S8bJSmuS4MiHTC4oxhIOXQoTbmC zJyXJ0MQrEfk8LjUPR1wJaKwRtfO9LKXajTWz4KOqy6o0AUZq+UwxLQ3qlN+NeIgEkd6 LezG6Ouxq3xHPKxP/oA8JkVKW0YsO380aWPoD4aHBSkdhWg/z01PZJyISeDefJ9XvC6K yRWWktilSzKSO3apWwQr1OQtsaT3i0s1N5k+K/MxltvKmLsb1S7YfYMkkYVKUAJTaA7z GzhJh1fWFPV66IFdekfpfaZzMnm3QbIjFeuHsN5q98FHtBt48Lv2IgucHGGTCqtV2+W7 iL0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763663484; x=1764268284; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=RZB5bC+Vqa6Kcy2QZ4+aGFmyOpDR6w4njHGcIBgIDHM=; b=nNwJMDMKjAViv40zOZnDLM+jUEn2Y9pNb4fkds+zVKeHyQ6xSGZHBaQyP2AHMLGpvA mQc9sn74jthQkPUzgsOlPJ0hA/q66mtjMdXm8TfQQCNfXIbkUQtlo0kD1Eu6iKGdQlPE HQIMyAf7ikkpSavrqXbkiDPsL8y2GAPqdDshhT/tGJ5q4rER16r4g/gpDFAoY0cqvsUx T9BshbZ6AlVupJ87nTDRE3BTWiZBxEuiR0mdqLDc46608BIVv9Q5OjKGbXv6JQvXpXoX DSig2LscuYr3erJZO7K7Nv8GJ1YC1DW62KQPkbnH4jkt8t3utLEvG9D+H7L9VuAzvQC8 poOg== X-Gm-Message-State: AOJu0YxvdhLRLDH5VjQ8Qg2r9d7SEF8XPJySOrZpnuK7soJxosiVezXI LDm3U8S2sIXxgIrFrIpcV/TrNoncvmNXz8zrxSumYS6HAJ/8jSKAd39yabi0rQNPuEbq0re+LJI svZymnls= X-Gm-Gg: ASbGncupUVEX7xomkB/nbam+udDJlYwgBuKxYpaIhQbwILONzhHLBRq2XA6/FYn3zkh LJbahfsN56Ww+vLdofnPOaNBWvmkPIZvQxEOHsD/IBdGYRPOuL1sLZxpFFiXgZJ4aHgta9NZ4b2 bOZ85jV4Xj+/9hKsrshiH8FfB6dwHLLJnPba92prxlUsa9WFNczJNhBxaDCay6A7HhpOskAifjP 3fvXr3CResjnAInea+i5jmtMN352KbEVvRgSZRJC/K3d3zpRai4xfkV/mQOWybTBqzm9r2yG/1p CofTaZ9/L9U+0YAdah8GaorjYMzHEtqL3SuW+w3vet5cmPTF0S5Gwc/tDavvEeE0EwhW3gNnWrY 502BsZ0zv1oB6uyCLCRP+sktOEfXvTlq1qSj0w5vALlZjDcuwNy14p++Rvko5bWk9l9iq2aBdYc 1OnA2HAEfBH4z6UnquyMkH4Q== X-Google-Smtp-Source: AGHT+IExwLc5Lx+cxfN5beeSb2vW9bxe0SXx8zsmRNwiY5mrgCIy3jNQ1raOvVSWRWZhkgSxE66PLA== X-Received: by 2002:a05:7022:249e:b0:11b:8f02:a876 with SMTP id a92af1059eb24-11c957a7d94mr1142574c88.23.1763663479530; Thu, 20 Nov 2025 10:31:19 -0800 (PST) Received: from ubuntu-vm.. ([187.11.52.82]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2a6fc5e3750sm9664359eec.6.2025.11.20.10.31.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 10:31:18 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Sam James , Collin Funk , "H . J . Lu" Subject: [PATCH v5 03/12] Add umul_ppmm to gmp-arch.hdoc Date: Thu, 20 Nov 2025 15:30:07 -0300 Message-ID: <20251120183107.2334580-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> References: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, 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 To enable “longlong.h” removal, the umul_ppmm is moved to a gmp-arch.h. The generic implementation now uses a static inline, which provides better type checking than the GNU extension to cast the asm constraint (and it works better with clang). Most of the architecture uses the generic implementation, which is expanded from a macro, except for alpha, arm, hppa, x86, m68k, mips, powerpc, and sparc. The 32 bit architectures the compiler generates good enough code using uint64_t types, where for 64 bit architecture the patch leverages the math_u128.h definitions that uses 128-bit integers when available (all 64 bit architectures on gcc 15). --- sysdeps/generic/gmp-arch.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/sysdeps/generic/gmp-arch.h b/sysdeps/generic/gmp-arch.h index 3adab10732..f1dba1384b 100644 --- a/sysdeps/generic/gmp-arch.h +++ b/sysdeps/generic/gmp-arch.h @@ -37,6 +37,32 @@ ll_highpart (mp_limb_t t) return t >> (BITS_PER_MP_LIMB / 2); } +/* umul_ppmm(high_prod, low_prod, multiplier, multiplicand) multiplies two + UWtype integers MULTIPLIER and MULTIPLICAND, and generates a two UWtype + word product in HIGH_PROD and LOW_PROD. */ +static __always_inline void +umul_ppmm_generic (mp_limb_t *w1, mp_limb_t *w0, mp_limb_t u, mp_limb_t v) +{ +#if __WORDSIZE == 32 + uint64_t t0 = (uint64_t)u * v; + *w1 = t0 >> 32; + *w0 = t0; +#else + u128 r = u128_mul(u128_from_u64 (u), u128_from_u64 (v)); + *w1 = u128_high (r); + *w0 = u128_low (r); +#endif +} +#undef umul_ppmm +#define umul_ppmm(__w1, __w0, __u, __v) \ + ({ \ + __typeof (__w0) __w0t; \ + __typeof (__w1) __w1t; \ + umul_ppmm_generic (&__w1t, &__w0t, __u, __v); \ + __w1 = __w1t; \ + __w0 = __w0t; \ + }) + /* udiv_qrnnd(quotient, remainder, high_numerator, low_numerator, denominator) divides a UDWtype, composed by the UWtype integers HIGH_NUMERATOR and LOW_NUMERATOR, by DENOMINATOR and places the quotient From patchwork Thu Nov 20 18:30:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 124880 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 5BB31385B506 for ; Thu, 20 Nov 2025 18:34:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5BB31385B506 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=e6JKenN4 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-dl1-x1241.google.com (mail-dl1-x1241.google.com [IPv6:2607:f8b0:4864:20::1241]) by sourceware.org (Postfix) with ESMTPS id 51C083857011 for ; Thu, 20 Nov 2025 18:31:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 51C083857011 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 51C083857011 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1241 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663484; cv=none; b=MA/hEE0zxJN1P93/obAgxugcPu4e+6jchoRU6NAHS0Z9jiIPWEL50TwY/6mTp1ZdG7XNR6JaX7oYg0m8d0qBalROHbKBJeNbjB5i/WJkm2fwGSnr2QoqARINbvN8KDaCGsipZ1rMGpDaLEOmEGbSLjfK41BbtSl/oqIg4gEH8Lc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663484; c=relaxed/simple; bh=Jkhnd6H3odO5fQv718whg8nq703MdY4MdKmgmOvB1Ws=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=exEeEG1ZAGejuEnLGYiAo9goO+0djYDrKcFAA9xMztcenbQ/QA9GKqfR7bLAFniuFwgcW8wjRV0TyoVGH3jBDPg0KsT5GFevA/dIdQOTRwA8s4zCpcxB79+Db7Qx8jCPusEFFEFST8ClfFTBQ/dbxpJgmgwedogMJ+DavI+RxzU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 51C083857011 Received: by mail-dl1-x1241.google.com with SMTP id a92af1059eb24-11beb0a7bd6so1922297c88.1 for ; Thu, 20 Nov 2025 10:31:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763663483; x=1764268283; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=H1anx3IqQ1UD6gFzj9hnnSwCBXj6Drmd0DWpbpFhbfc=; b=e6JKenN4Gw8aF7qN8VKwI34kEpQcyxCf/4Ika+2nU9EjmuotEfmSqvojgiZ/PyVwLZ 9ealulGPXxNIOfFjDu4rjzXCCANDS+0k8dnVnsMauelLrlerS4i9JeU2s9e+tV6MuPcc 62r+UQbwsI5rLTEr5UNnWpTanqo6e5thqqE82aGAG+N40cd+GtTQufJFgjD2S51KOPXr NcG67iF/nJnd0ybMh4+5ABizLkmRNZ7c0wtf5pkXMGgYrJ+f9YBaHatKNOVPYflPPsva tOxAVN/i99epZiC12hAKSXuLRCi4OJnBWp9c4ERUFSAbjAE1VdZ7QXk1UZFt40BvMb4E quMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763663483; x=1764268283; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=H1anx3IqQ1UD6gFzj9hnnSwCBXj6Drmd0DWpbpFhbfc=; b=GkRO8g481/R75H85YuwoIxCY43uIbqKnHepY+W5dfdXM5LkHBh957g/sr3axjcgx+y Fw9QkSWmYxnUHaNM+X5rBoxH4ewjBOkCtn9pja8ZsUp305LIXDWT3CKbB4P/tAo8fEWO lQeS+GrEwRqp0TTcOxnFKesBZstqccZ6IyIaMFgoTKiY4bhK4rYk3pE1LdnAHaUmQoWr LmsLIPf1qoOwXTPgj8Mu4OCabNsUWK9vlw1KmpNC1L40v9zRrPtsM/MzR3AGuzkSXspl oREOwxaOmkPe9JwmyASFTWOMXqaSu1uS5RyyLXUAz6SvNWLxROAPgWdTW0rTqdKAP3lC /XFw== X-Gm-Message-State: AOJu0YzibvzvfpC7y0Os1RHNNcfXURdmq6xKMrkwjc6rVOuk+oOT7zZt 5wg8W/i0THwO2P23Ne4/ZKpJkYbBRP3CV4L9DA8yguivZkBN2QS/6eB4KCiQtamVmMjWtqDTKKn 7B5QCNUl02g== X-Gm-Gg: ASbGncuV1I3lsifDdgpClRLNMjzhJCZwhENuFocva6BTfCC3h5PnY12GAm2TIKYytqI HNz1UTgvUcThW9YfpCokYxXt5znoR8pnreR4vrFCqw2i3ZpEtz3URZBl+5480/GF1Foux1YUPCb gLySyGCjMh2Og4QUNLLX41hSOEqW88fm3xlOkS0qguomwihQ5ijtCTFBafKG81BRukwOIAh7Poe dTvh2x1HQJsAK7+JThT103yK1bjV6Objvu1j5X93p5FOSbN159hw4ZA0q5NIgdhnNNnJu9USatB vuJisCz2MCBVIaiIcqPlymWQcPOacSSbqqRRzeLL1Xky1ohJSc/e8OjeCmCWmq4akAC9GYyWprn tzzJVuBQplDTeXyesmwHCOzdFgIuMdP9pDGK98EmQlAGzpbxfpLVNtsQ+h6VmPMJ4DVAiaTz6d2 +8ld2N3wcwmA0F9yF0CjpODQ== X-Google-Smtp-Source: AGHT+IFL/mhq+UdUM127LBeFVfbpzRyj0ffTPNWT5T09QgqJg4WcTdvvJbQi3TNnEFNKrrVfS4KbcA== X-Received: by 2002:a05:7022:a93:b0:11b:a738:65b2 with SMTP id a92af1059eb24-11c94aefcabmr1252037c88.5.1763663481831; Thu, 20 Nov 2025 10:31:21 -0800 (PST) Received: from ubuntu-vm.. ([187.11.52.82]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2a6fc5e3750sm9664359eec.6.2025.11.20.10.31.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 10:31:21 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Sam James , Collin Funk , "H . J . Lu" Subject: [PATCH v5 04/12] stdlib: Remove longlong.h Date: Thu, 20 Nov 2025 15:30:08 -0300 Message-ID: <20251120183107.2334580-5-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> References: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, KAM_STOCKGEN, RCVD_IN_BARRACUDACENTRAL, 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 The gmp-arch.h now provides all the required definitions. --- soft-fp/soft-fp.h | 2 - stdio-common/_itoa.c | 2 - stdio-common/_itowa.c | 2 - stdlib/Makefile | 1 - stdlib/addmul_1.c | 2 - stdlib/divmod_1.c | 2 - stdlib/divrem.c | 1 - stdlib/gmp-impl.h | 2 + stdlib/longlong.h | 1786 ------------------------ stdlib/mod_1.c | 2 - stdlib/mul_1.c | 2 - stdlib/strtod_l.c | 2 - stdlib/submul_1.c | 2 - sysdeps/generic/gmp-arch.h | 5 - sysdeps/ieee754/dbl-64/dbl2mpn.c | 2 - sysdeps/ieee754/ldbl-128/ldbl2mpn.c | 2 - sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c | 1 - sysdeps/ieee754/ldbl-96/ldbl2mpn.c | 2 - sysdeps/wordsize-32/divdi3.c | 2 - sysdeps/x86/gmp-arch.h | 2 - sysdeps/x86/ldbl2mpn.c | 2 - 21 files changed, 2 insertions(+), 1824 deletions(-) delete mode 100644 stdlib/longlong.h diff --git a/soft-fp/soft-fp.h b/soft-fp/soft-fp.h index 4c0859fa06..a3a44f8a42 100644 --- a/soft-fp/soft-fp.h +++ b/soft-fp/soft-fp.h @@ -327,8 +327,6 @@ # ifdef _LIBC # include # include -# include -# include # else # include "longlong.h" # endif diff --git a/stdio-common/_itoa.c b/stdio-common/_itoa.c index e9cbcfab3b..dd9c5715a7 100644 --- a/stdio-common/_itoa.c +++ b/stdio-common/_itoa.c @@ -25,8 +25,6 @@ #include #include #include -#include -#include #include <_itoa.h> diff --git a/stdio-common/_itowa.c b/stdio-common/_itowa.c index 2da7489502..5aaf1b9a1e 100644 --- a/stdio-common/_itowa.c +++ b/stdio-common/_itowa.c @@ -20,8 +20,6 @@ #include #include #include -#include -#include #include <_itowa.h> diff --git a/stdlib/Makefile b/stdlib/Makefile index a9a68c190c..02ad6d17fb 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -499,7 +499,6 @@ mpn-headers = \ gmp-impl.h \ gmp-mparam.h \ gmp.h \ - longlong.h \ # mpn-headers routines := \ diff --git a/stdlib/addmul_1.c b/stdlib/addmul_1.c index a5bf7fd37e..95b4c60366 100644 --- a/stdlib/addmul_1.c +++ b/stdlib/addmul_1.c @@ -23,8 +23,6 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, see #include #include "gmp-impl.h" -#include "longlong.h" -#include mp_limb_t mpn_addmul_1 (register mp_ptr res_ptr, register mp_srcptr s1_ptr, diff --git a/stdlib/divmod_1.c b/stdlib/divmod_1.c index 676145d727..7d833dfd5d 100644 --- a/stdlib/divmod_1.c +++ b/stdlib/divmod_1.c @@ -27,8 +27,6 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, see #include #include #include "gmp-impl.h" -#include "longlong.h" -#include #ifndef UMUL_TIME #define UMUL_TIME 1 diff --git a/stdlib/divrem.c b/stdlib/divrem.c index 889fe3da12..9f54c33e69 100644 --- a/stdlib/divrem.c +++ b/stdlib/divrem.c @@ -21,7 +21,6 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, see #include #include "gmp-impl.h" -#include "longlong.h" /* Divide num (NP/NSIZE) by den (DP/DSIZE) and write the NSIZE-DSIZE least significant quotient limbs at QP diff --git a/stdlib/gmp-impl.h b/stdlib/gmp-impl.h index dea739c44c..3da6d0555e 100644 --- a/stdlib/gmp-impl.h +++ b/stdlib/gmp-impl.h @@ -298,6 +298,8 @@ typedef unsigned int UHWtype; #define impn_sqr_n_basecase __MPN(impn_sqr_n_basecase) #define impn_sqr_n __MPN(impn_sqr_n) +#include + #ifndef _PROTO #if defined (__STDC__) || defined (__cplusplus) #define _PROTO(x) x diff --git a/stdlib/longlong.h b/stdlib/longlong.h deleted file mode 100644 index 4549f0a55f..0000000000 --- a/stdlib/longlong.h +++ /dev/null @@ -1,1786 +0,0 @@ -/* longlong.h -- definitions for mixed size 32/64 bit arithmetic. - Copyright (C) 1991-2025 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. - - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file into - combinations with other programs, and to distribute those - combinations without any restriction coming from the use of this - file. (The Lesser General Public License restrictions do apply in - other respects; for example, they cover modification of the file, - and distribution when not linked into a combine executable.) - - 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 - . */ - -/* You have to define the following before including this file: - - UWtype -- An unsigned type, default type for operations (typically a "word") - UHWtype -- An unsigned type, at least half the size of UWtype. - UDWtype -- An unsigned type, at least twice as large a UWtype - W_TYPE_SIZE -- size in bits of UWtype - - UQItype -- Unsigned 8 bit type. - SItype, USItype -- Signed and unsigned 32 bit types. - DItype, UDItype -- Signed and unsigned 64 bit types. - - On a 32 bit machine UWtype should typically be USItype; - on a 64 bit machine, UWtype should typically be UDItype. */ - -#define __BITS4 (W_TYPE_SIZE / 4) -#define __ll_B ((UWtype) 1 << (W_TYPE_SIZE / 2)) -#define __ll_lowpart(t) ((UWtype) (t) & (__ll_B - 1)) -#define __ll_highpart(t) ((UWtype) (t) >> (W_TYPE_SIZE / 2)) - -#ifndef W_TYPE_SIZE -#define W_TYPE_SIZE 32 -#define UWtype USItype -#define UHWtype USItype -#define UDWtype UDItype -#endif - -/* Used in glibc only. */ -#ifndef attribute_hidden -#define attribute_hidden -#endif - -extern const UQItype __clz_tab[256] attribute_hidden; - -/* Define auxiliary asm macros. - - 1) umul_ppmm(high_prod, low_prod, multiplier, multiplicand) multiplies two - UWtype integers MULTIPLIER and MULTIPLICAND, and generates a two UWtype - word product in HIGH_PROD and LOW_PROD. - - 2) __umulsidi3(a,b) multiplies two UWtype integers A and B, and returns a - UDWtype product. This is just a variant of umul_ppmm. - - 3) udiv_qrnnd(quotient, remainder, high_numerator, low_numerator, - denominator) divides a UDWtype, composed by the UWtype integers - HIGH_NUMERATOR and LOW_NUMERATOR, by DENOMINATOR and places the quotient - in QUOTIENT and the remainder in REMAINDER. HIGH_NUMERATOR must be less - than DENOMINATOR for correct operation. If, in addition, the most - significant bit of DENOMINATOR must be 1, then the pre-processor symbol - UDIV_NEEDS_NORMALIZATION is defined to 1. - - 4) sdiv_qrnnd(quotient, remainder, high_numerator, low_numerator, - denominator). Like udiv_qrnnd but the numbers are signed. The quotient - is rounded towards 0. - - 5) count_leading_zeros(count, x) counts the number of zero-bits from the - msb to the first nonzero bit in the UWtype X. This is the number of - steps X needs to be shifted left to set the msb. Undefined for X == 0, - unless the symbol COUNT_LEADING_ZEROS_0 is defined to some value. - - 6) count_trailing_zeros(count, x) like count_leading_zeros, but counts - from the least significant end. - - 7) add_ssaaaa(high_sum, low_sum, high_addend_1, low_addend_1, - high_addend_2, low_addend_2) adds two UWtype integers, composed by - HIGH_ADDEND_1 and LOW_ADDEND_1, and HIGH_ADDEND_2 and LOW_ADDEND_2 - respectively. The result is placed in HIGH_SUM and LOW_SUM. Overflow - (i.e. carry out) is not stored anywhere, and is lost. - - 8) sub_ddmmss(high_difference, low_difference, high_minuend, low_minuend, - high_subtrahend, low_subtrahend) subtracts two two-word UWtype integers, - composed by HIGH_MINUEND_1 and LOW_MINUEND_1, and HIGH_SUBTRAHEND_2 and - LOW_SUBTRAHEND_2 respectively. The result is placed in HIGH_DIFFERENCE - and LOW_DIFFERENCE. Overflow (i.e. carry out) is not stored anywhere, - and is lost. - - If any of these macros are left undefined for a particular CPU, - C macros are used. */ - -/* The CPUs come in alphabetical order below. - - Please add support for more CPUs here, or improve the current support - for the CPUs below! - (E.g. WE32100, IBM360.) */ - -#if defined (__GNUC__) && !defined (NO_ASM) - -/* We sometimes need to clobber "cc" with gcc2, but that would not be - understood by gcc1. Use cpp to avoid major code duplication. */ -#if __GNUC__ < 2 -#define __CLOBBER_CC -#define __AND_CLOBBER_CC -#else /* __GNUC__ >= 2 */ -#define __CLOBBER_CC : "cc" -#define __AND_CLOBBER_CC , "cc" -#endif /* __GNUC__ < 2 */ - -#if defined (__aarch64__) - -#if W_TYPE_SIZE == 32 -#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X)) -#define count_trailing_zeros(COUNT, X) ((COUNT) = __builtin_ctz (X)) -#define COUNT_LEADING_ZEROS_0 32 -#endif /* W_TYPE_SIZE == 32 */ - -#if W_TYPE_SIZE == 64 -#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clzll (X)) -#define count_trailing_zeros(COUNT, X) ((COUNT) = __builtin_ctzll (X)) -#define COUNT_LEADING_ZEROS_0 64 -#endif /* W_TYPE_SIZE == 64 */ - -#endif /* __aarch64__ */ - -#if defined (__alpha) && W_TYPE_SIZE == 64 -/* There is a bug in g++ before version 5 that - errors on __builtin_alpha_umulh. */ -#if !defined(__cplusplus) || __GNUC__ >= 5 -#define umul_ppmm(ph, pl, m0, m1) \ - do { \ - UDItype __m0 = (m0), __m1 = (m1); \ - (ph) = __builtin_alpha_umulh (__m0, __m1); \ - (pl) = __m0 * __m1; \ - } while (0) -#define UMUL_TIME 46 -#endif /* !c++ */ -#ifndef LONGLONG_STANDALONE -#define udiv_qrnnd(q, r, n1, n0, d) \ - do { UDItype __r; \ - (q) = __udiv_qrnnd (&__r, (n1), (n0), (d)); \ - (r) = __r; \ - } while (0) -extern UDItype __udiv_qrnnd (UDItype *, UDItype, UDItype, UDItype); -#define UDIV_TIME 220 -#endif /* LONGLONG_STANDALONE */ -#ifdef __alpha_cix__ -#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clzl (X)) -#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctzl (X)) -#define COUNT_LEADING_ZEROS_0 64 -#else -#define count_leading_zeros(COUNT,X) \ - do { \ - UDItype __xr = (X), __t, __a; \ - __t = __builtin_alpha_cmpbge (0, __xr); \ - __a = __clz_tab[__t ^ 0xff] - 1; \ - __t = __builtin_alpha_extbl (__xr, __a); \ - (COUNT) = 64 - (__clz_tab[__t] + __a*8); \ - } while (0) -#define count_trailing_zeros(COUNT,X) \ - do { \ - UDItype __xr = (X), __t, __a; \ - __t = __builtin_alpha_cmpbge (0, __xr); \ - __t = ~__t & -~__t; \ - __a = ((__t & 0xCC) != 0) * 2; \ - __a += ((__t & 0xF0) != 0) * 4; \ - __a += ((__t & 0xAA) != 0); \ - __t = __builtin_alpha_extbl (__xr, __a); \ - __a <<= 3; \ - __t &= -__t; \ - __a += ((__t & 0xCC) != 0) * 2; \ - __a += ((__t & 0xF0) != 0) * 4; \ - __a += ((__t & 0xAA) != 0); \ - (COUNT) = __a; \ - } while (0) -#endif /* __alpha_cix__ */ -#endif /* __alpha */ - -#if defined (__arc__) && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("add.f %1, %4, %5\n\tadc %0, %2, %3" \ - : "=r" ((USItype) (sh)), \ - "=&r" ((USItype) (sl)) \ - : "%r" ((USItype) (ah)), \ - "rICal" ((USItype) (bh)), \ - "%r" ((USItype) (al)), \ - "rICal" ((USItype) (bl)) \ - : "cc") -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("sub.f %1, %4, %5\n\tsbc %0, %2, %3" \ - : "=r" ((USItype) (sh)), \ - "=&r" ((USItype) (sl)) \ - : "r" ((USItype) (ah)), \ - "rICal" ((USItype) (bh)), \ - "r" ((USItype) (al)), \ - "rICal" ((USItype) (bl)) \ - : "cc") - -#define __umulsidi3(u,v) ((UDItype)(USItype)u*(USItype)v) -#ifdef __ARC_NORM__ -#define count_leading_zeros(count, x) \ - do \ - { \ - SItype c_; \ - \ - __asm__ ("norm.f\t%0,%1\n\tmov.mi\t%0,-1" : "=r" (c_) : "r" (x) : "cc");\ - (count) = c_ + 1; \ - } \ - while (0) -#define COUNT_LEADING_ZEROS_0 32 -#endif /* __ARC_NORM__ */ -#endif /* __arc__ */ - -#if defined (__arm__) && (defined (__thumb2__) || !defined (__thumb__)) \ - && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("adds %1, %4, %5\n\tadc %0, %2, %3" \ - : "=r" ((USItype) (sh)), \ - "=&r" ((USItype) (sl)) \ - : "%r" ((USItype) (ah)), \ - "rI" ((USItype) (bh)), \ - "%r" ((USItype) (al)), \ - "rI" ((USItype) (bl)) __CLOBBER_CC) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("subs %1, %4, %5\n\tsbc %0, %2, %3" \ - : "=r" ((USItype) (sh)), \ - "=&r" ((USItype) (sl)) \ - : "r" ((USItype) (ah)), \ - "rI" ((USItype) (bh)), \ - "r" ((USItype) (al)), \ - "rI" ((USItype) (bl)) __CLOBBER_CC) -# if defined(__ARM_ARCH_2__) || defined(__ARM_ARCH_2A__) \ - || defined(__ARM_ARCH_3__) -# define umul_ppmm(xh, xl, a, b) \ - do { \ - register USItype __t0, __t1, __t2; \ - __asm__ ("%@ Inlined umul_ppmm\n" \ - " mov %2, %5, lsr #16\n" \ - " mov %0, %6, lsr #16\n" \ - " bic %3, %5, %2, lsl #16\n" \ - " bic %4, %6, %0, lsl #16\n" \ - " mul %1, %3, %4\n" \ - " mul %4, %2, %4\n" \ - " mul %3, %0, %3\n" \ - " mul %0, %2, %0\n" \ - " adds %3, %4, %3\n" \ - " addcs %0, %0, #65536\n" \ - " adds %1, %1, %3, lsl #16\n" \ - " adc %0, %0, %3, lsr #16" \ - : "=&r" ((USItype) (xh)), \ - "=r" ((USItype) (xl)), \ - "=&r" (__t0), "=&r" (__t1), "=r" (__t2) \ - : "r" ((USItype) (a)), \ - "r" ((USItype) (b)) __CLOBBER_CC ); \ - } while (0) -# define UMUL_TIME 20 -# else -# define umul_ppmm(xh, xl, a, b) \ - do { \ - /* Generate umull, under compiler control. */ \ - register UDItype __t0 = (UDItype)(USItype)(a) * (USItype)(b); \ - (xl) = (USItype)__t0; \ - (xh) = (USItype)(__t0 >> 32); \ - } while (0) -# define UMUL_TIME 3 -# endif -# define UDIV_TIME 100 -#endif /* __arm__ */ - -#if defined(__arm__) -/* Let gcc decide how best to implement count_leading_zeros. */ -#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X)) -#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctz (X)) -#define COUNT_LEADING_ZEROS_0 32 -#endif - -#if defined (__AVR__) - -#if W_TYPE_SIZE == 16 -#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X)) -#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctz (X)) -#define COUNT_LEADING_ZEROS_0 16 -#endif /* W_TYPE_SIZE == 16 */ - -#if W_TYPE_SIZE == 32 -#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clzl (X)) -#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctzl (X)) -#define COUNT_LEADING_ZEROS_0 32 -#endif /* W_TYPE_SIZE == 32 */ - -#if W_TYPE_SIZE == 64 -#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clzll (X)) -#define count_trailing_zeros(COUNT,X) ((COUNT) = __builtin_ctzll (X)) -#define COUNT_LEADING_ZEROS_0 64 -#endif /* W_TYPE_SIZE == 64 */ - -#endif /* defined (__AVR__) */ - -#if defined (__CRIS__) - -#if __CRIS_arch_version >= 3 -#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X)) -#define COUNT_LEADING_ZEROS_0 32 -#endif /* __CRIS_arch_version >= 3 */ - -#if __CRIS_arch_version >= 8 -#define count_trailing_zeros(COUNT, X) ((COUNT) = __builtin_ctz (X)) -#endif /* __CRIS_arch_version >= 8 */ - -#if __CRIS_arch_version >= 10 -#define __umulsidi3(u,v) ((UDItype)(USItype) (u) * (UDItype)(USItype) (v)) -#else -#define __umulsidi3 __umulsidi3 -extern UDItype __umulsidi3 (USItype, USItype); -#endif /* __CRIS_arch_version >= 10 */ - -#define umul_ppmm(w1, w0, u, v) \ - do { \ - UDItype __x = __umulsidi3 (u, v); \ - (w0) = (USItype) (__x); \ - (w1) = (USItype) (__x >> 32); \ - } while (0) - -/* FIXME: defining add_ssaaaa and sub_ddmmss should be advantageous for - DFmode ("double" intrinsics, avoiding two of the three insns handling - carry), but defining them as open-code C composing and doing the - operation in DImode (UDImode) shows that the DImode needs work: - register pressure from requiring neighboring registers and the - traffic to and from them come to dominate, in the 4.7 series. */ - -#endif /* defined (__CRIS__) */ - -#if defined (__hppa) && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("add %4,%5,%1\n\taddc %2,%3,%0" \ - : "=r" ((USItype) (sh)), \ - "=&r" ((USItype) (sl)) \ - : "%rM" ((USItype) (ah)), \ - "rM" ((USItype) (bh)), \ - "%rM" ((USItype) (al)), \ - "rM" ((USItype) (bl))) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("sub %4,%5,%1\n\tsubb %2,%3,%0" \ - : "=r" ((USItype) (sh)), \ - "=&r" ((USItype) (sl)) \ - : "rM" ((USItype) (ah)), \ - "rM" ((USItype) (bh)), \ - "rM" ((USItype) (al)), \ - "rM" ((USItype) (bl))) -#if defined (_PA_RISC1_1) -#define umul_ppmm(w1, w0, u, v) \ - do { \ - union \ - { \ - UDItype __f; \ - struct {USItype __w1, __w0;} __w1w0; \ - } __t; \ - __asm__ ("xmpyu %1,%2,%0" \ - : "=x" (__t.__f) \ - : "x" ((USItype) (u)), \ - "x" ((USItype) (v))); \ - (w1) = __t.__w1w0.__w1; \ - (w0) = __t.__w1w0.__w0; \ - } while (0) -#define UMUL_TIME 8 -#else -#define UMUL_TIME 30 -#endif -#define UDIV_TIME 40 -#define count_leading_zeros(count, x) \ - do { \ - USItype __tmp; \ - __asm__ ( \ - "ldi 1,%0\n" \ -" extru,= %1,15,16,%%r0 ; Bits 31..16 zero?\n" \ -" extru,tr %1,15,16,%1 ; No. Shift down, skip add.\n"\ -" ldo 16(%0),%0 ; Yes. Perform add.\n" \ -" extru,= %1,23,8,%%r0 ; Bits 15..8 zero?\n" \ -" extru,tr %1,23,8,%1 ; No. Shift down, skip add.\n"\ -" ldo 8(%0),%0 ; Yes. Perform add.\n" \ -" extru,= %1,27,4,%%r0 ; Bits 7..4 zero?\n" \ -" extru,tr %1,27,4,%1 ; No. Shift down, skip add.\n"\ -" ldo 4(%0),%0 ; Yes. Perform add.\n" \ -" extru,= %1,29,2,%%r0 ; Bits 3..2 zero?\n" \ -" extru,tr %1,29,2,%1 ; No. Shift down, skip add.\n"\ -" ldo 2(%0),%0 ; Yes. Perform add.\n" \ -" extru %1,30,1,%1 ; Extract bit 1.\n" \ -" sub %0,%1,%0 ; Subtract it.\n" \ - : "=r" (count), "=r" (__tmp) : "1" (x)); \ - } while (0) -#endif - -#if (defined (__i370__) || defined (__s390__) || defined (__mvs__)) && W_TYPE_SIZE == 32 -#if !defined (__zarch__) -#define smul_ppmm(xh, xl, m0, m1) \ - do { \ - union {DItype __ll; \ - struct {USItype __h, __l;} __i; \ - } __x; \ - __asm__ ("lr %N0,%1\n\tmr %0,%2" \ - : "=&r" (__x.__ll) \ - : "r" (m0), "r" (m1)); \ - (xh) = __x.__i.__h; (xl) = __x.__i.__l; \ - } while (0) -#define sdiv_qrnnd(q, r, n1, n0, d) \ - do { \ - union {DItype __ll; \ - struct {USItype __h, __l;} __i; \ - } __x; \ - __x.__i.__h = n1; __x.__i.__l = n0; \ - __asm__ ("dr %0,%2" \ - : "=r" (__x.__ll) \ - : "0" (__x.__ll), "r" (d)); \ - (q) = __x.__i.__l; (r) = __x.__i.__h; \ - } while (0) -#else -#define smul_ppmm(xh, xl, m0, m1) \ - do { \ - register SItype __r0 __asm__ ("0"); \ - register SItype __r1 __asm__ ("1") = (m0); \ - \ - __asm__ ("mr\t%%r0,%3" \ - : "=r" (__r0), "=r" (__r1) \ - : "r" (__r1), "r" (m1)); \ - (xh) = __r0; (xl) = __r1; \ - } while (0) - -#define sdiv_qrnnd(q, r, n1, n0, d) \ - do { \ - register SItype __r0 __asm__ ("0") = (n1); \ - register SItype __r1 __asm__ ("1") = (n0); \ - \ - __asm__ ("dr\t%%r0,%4" \ - : "=r" (__r0), "=r" (__r1) \ - : "r" (__r0), "r" (__r1), "r" (d)); \ - (q) = __r1; (r) = __r0; \ - } while (0) -#endif /* __zarch__ */ -#endif - -#if (defined (__i386__) || defined (__i486__)) && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("add{l} {%5,%1|%1,%5}\n\tadc{l} {%3,%0|%0,%3}" \ - : "=r" ((USItype) (sh)), \ - "=&r" ((USItype) (sl)) \ - : "%0" ((USItype) (ah)), \ - "g" ((USItype) (bh)), \ - "%1" ((USItype) (al)), \ - "g" ((USItype) (bl))) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("sub{l} {%5,%1|%1,%5}\n\tsbb{l} {%3,%0|%0,%3}" \ - : "=r" ((USItype) (sh)), \ - "=&r" ((USItype) (sl)) \ - : "0" ((USItype) (ah)), \ - "g" ((USItype) (bh)), \ - "1" ((USItype) (al)), \ - "g" ((USItype) (bl))) -#define umul_ppmm(w1, w0, u, v) \ - __asm__ ("mul{l} %3" \ - : "=a" ((USItype) (w0)), \ - "=d" ((USItype) (w1)) \ - : "%0" ((USItype) (u)), \ - "rm" ((USItype) (v))) -#define udiv_qrnnd(q, r, n1, n0, dv) \ - __asm__ ("div{l} %4" \ - : "=a" ((USItype) (q)), \ - "=d" ((USItype) (r)) \ - : "0" ((USItype) (n0)), \ - "1" ((USItype) (n1)), \ - "rm" ((USItype) (dv))) -#define count_leading_zeros(count, x) ((count) = __builtin_clz (x)) -#define count_trailing_zeros(count, x) ((count) = __builtin_ctz (x)) -#define UMUL_TIME 40 -#define UDIV_TIME 40 -#endif /* 80x86 */ - -#if defined (__x86_64__) && W_TYPE_SIZE == 64 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("add{q} {%5,%1|%1,%5}\n\tadc{q} {%3,%0|%0,%3}" \ - : "=r" ((UDItype) (sh)), \ - "=&r" ((UDItype) (sl)) \ - : "%0" ((UDItype) (ah)), \ - "rme" ((UDItype) (bh)), \ - "%1" ((UDItype) (al)), \ - "rme" ((UDItype) (bl))) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("sub{q} {%5,%1|%1,%5}\n\tsbb{q} {%3,%0|%0,%3}" \ - : "=r" ((UDItype) (sh)), \ - "=&r" ((UDItype) (sl)) \ - : "0" ((UDItype) (ah)), \ - "rme" ((UDItype) (bh)), \ - "1" ((UDItype) (al)), \ - "rme" ((UDItype) (bl))) -#define umul_ppmm(w1, w0, u, v) \ - __asm__ ("mul{q} %3" \ - : "=a" ((UDItype) (w0)), \ - "=d" ((UDItype) (w1)) \ - : "%0" ((UDItype) (u)), \ - "rm" ((UDItype) (v))) -#define udiv_qrnnd(q, r, n1, n0, dv) \ - __asm__ ("div{q} %4" \ - : "=a" ((UDItype) (q)), \ - "=d" ((UDItype) (r)) \ - : "0" ((UDItype) (n0)), \ - "1" ((UDItype) (n1)), \ - "rm" ((UDItype) (dv))) -#define count_leading_zeros(count, x) ((count) = __builtin_clzll (x)) -#define count_trailing_zeros(count, x) ((count) = __builtin_ctzll (x)) -#define UMUL_TIME 40 -#define UDIV_TIME 40 -#endif /* x86_64 */ - -#if defined (__i960__) && W_TYPE_SIZE == 32 -#define umul_ppmm(w1, w0, u, v) \ - ({union {UDItype __ll; \ - struct {USItype __l, __h;} __i; \ - } __xx; \ - __asm__ ("emul %2,%1,%0" \ - : "=d" (__xx.__ll) \ - : "%dI" ((USItype) (u)), \ - "dI" ((USItype) (v))); \ - (w1) = __xx.__i.__h; (w0) = __xx.__i.__l;}) -#define __umulsidi3(u, v) \ - ({UDItype __w; \ - __asm__ ("emul %2,%1,%0" \ - : "=d" (__w) \ - : "%dI" ((USItype) (u)), \ - "dI" ((USItype) (v))); \ - __w; }) -#endif /* __i960__ */ - -#if defined (__ia64) && W_TYPE_SIZE == 64 -/* This form encourages gcc (pre-release 3.4 at least) to emit predicated - "sub r=r,r" and "sub r=r,r,1", giving a 2 cycle latency. The generic - code using "al>= _c; \ - if (_x >= 1 << 4) \ - _x >>= 4, _c += 4; \ - if (_x >= 1 << 2) \ - _x >>= 2, _c += 2; \ - _c += _x >> 1; \ - (count) = W_TYPE_SIZE - 1 - _c; \ - } while (0) -/* similar to what gcc does for __builtin_ffs, but 0 based rather than 1 - based, and we don't need a special case for x==0 here */ -#define count_trailing_zeros(count, x) \ - do { \ - UWtype __ctz_x = (x); \ - __asm__ ("popcnt %0 = %1" \ - : "=r" (count) \ - : "r" ((__ctz_x-1) & ~__ctz_x)); \ - } while (0) -#define UMUL_TIME 14 -#endif - -#ifdef __loongarch__ -# if W_TYPE_SIZE == 32 -# define count_leading_zeros(count, x) ((count) = __builtin_clz (x)) -# define count_trailing_zeros(count, x) ((count) = __builtin_ctz (x)) -# define COUNT_LEADING_ZEROS_0 32 -# elif W_TYPE_SIZE == 64 -# define count_leading_zeros(count, x) ((count) = __builtin_clzll (x)) -# define count_trailing_zeros(count, x) ((count) = __builtin_ctzll (x)) -# define COUNT_LEADING_ZEROS_0 64 -# endif -#endif - -#if defined (__M32R__) && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - /* The cmp clears the condition bit. */ \ - __asm__ ("cmp %0,%0\n\taddx %1,%5\n\taddx %0,%3" \ - : "=r" ((USItype) (sh)), \ - "=&r" ((USItype) (sl)) \ - : "0" ((USItype) (ah)), \ - "r" ((USItype) (bh)), \ - "1" ((USItype) (al)), \ - "r" ((USItype) (bl)) \ - : "cbit") -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - /* The cmp clears the condition bit. */ \ - __asm__ ("cmp %0,%0\n\tsubx %1,%5\n\tsubx %0,%3" \ - : "=r" ((USItype) (sh)), \ - "=&r" ((USItype) (sl)) \ - : "0" ((USItype) (ah)), \ - "r" ((USItype) (bh)), \ - "1" ((USItype) (al)), \ - "r" ((USItype) (bl)) \ - : "cbit") -#endif /* __M32R__ */ - -#if defined (__mc68000__) && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("add%.l %5,%1\n\taddx%.l %3,%0" \ - : "=d" ((USItype) (sh)), \ - "=&d" ((USItype) (sl)) \ - : "%0" ((USItype) (ah)), \ - "d" ((USItype) (bh)), \ - "%1" ((USItype) (al)), \ - "g" ((USItype) (bl))) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("sub%.l %5,%1\n\tsubx%.l %3,%0" \ - : "=d" ((USItype) (sh)), \ - "=&d" ((USItype) (sl)) \ - : "0" ((USItype) (ah)), \ - "d" ((USItype) (bh)), \ - "1" ((USItype) (al)), \ - "g" ((USItype) (bl))) - -/* The '020, '030, '040, '060 and CPU32 have 32x32->64 and 64/32->32q-32r. */ -#if (defined (__mc68020__) && !defined (__mc68060__)) -#define umul_ppmm(w1, w0, u, v) \ - __asm__ ("mulu%.l %3,%1:%0" \ - : "=d" ((USItype) (w0)), \ - "=d" ((USItype) (w1)) \ - : "%0" ((USItype) (u)), \ - "dmi" ((USItype) (v))) -#define UMUL_TIME 45 -#define udiv_qrnnd(q, r, n1, n0, d) \ - __asm__ ("divu%.l %4,%1:%0" \ - : "=d" ((USItype) (q)), \ - "=d" ((USItype) (r)) \ - : "0" ((USItype) (n0)), \ - "1" ((USItype) (n1)), \ - "dmi" ((USItype) (d))) -#define UDIV_TIME 90 -#define sdiv_qrnnd(q, r, n1, n0, d) \ - __asm__ ("divs%.l %4,%1:%0" \ - : "=d" ((USItype) (q)), \ - "=d" ((USItype) (r)) \ - : "0" ((USItype) (n0)), \ - "1" ((USItype) (n1)), \ - "dmi" ((USItype) (d))) - -#elif defined (__mcoldfire__) /* not mc68020 */ - -#define umul_ppmm(xh, xl, a, b) \ - __asm__ ("| Inlined umul_ppmm\n" \ - " move%.l %2,%/d0\n" \ - " move%.l %3,%/d1\n" \ - " move%.l %/d0,%/d2\n" \ - " swap %/d0\n" \ - " move%.l %/d1,%/d3\n" \ - " swap %/d1\n" \ - " move%.w %/d2,%/d4\n" \ - " mulu %/d3,%/d4\n" \ - " mulu %/d1,%/d2\n" \ - " mulu %/d0,%/d3\n" \ - " mulu %/d0,%/d1\n" \ - " move%.l %/d4,%/d0\n" \ - " clr%.w %/d0\n" \ - " swap %/d0\n" \ - " add%.l %/d0,%/d2\n" \ - " add%.l %/d3,%/d2\n" \ - " jcc 1f\n" \ - " add%.l %#65536,%/d1\n" \ - "1: swap %/d2\n" \ - " moveq %#0,%/d0\n" \ - " move%.w %/d2,%/d0\n" \ - " move%.w %/d4,%/d2\n" \ - " move%.l %/d2,%1\n" \ - " add%.l %/d1,%/d0\n" \ - " move%.l %/d0,%0" \ - : "=g" ((USItype) (xh)), \ - "=g" ((USItype) (xl)) \ - : "g" ((USItype) (a)), \ - "g" ((USItype) (b)) \ - : "d0", "d1", "d2", "d3", "d4") -#define UMUL_TIME 100 -#define UDIV_TIME 400 -#else /* not ColdFire */ -/* %/ inserts REGISTER_PREFIX, %# inserts IMMEDIATE_PREFIX. */ -#define umul_ppmm(xh, xl, a, b) \ - __asm__ ("| Inlined umul_ppmm\n" \ - " move%.l %2,%/d0\n" \ - " move%.l %3,%/d1\n" \ - " move%.l %/d0,%/d2\n" \ - " swap %/d0\n" \ - " move%.l %/d1,%/d3\n" \ - " swap %/d1\n" \ - " move%.w %/d2,%/d4\n" \ - " mulu %/d3,%/d4\n" \ - " mulu %/d1,%/d2\n" \ - " mulu %/d0,%/d3\n" \ - " mulu %/d0,%/d1\n" \ - " move%.l %/d4,%/d0\n" \ - " eor%.w %/d0,%/d0\n" \ - " swap %/d0\n" \ - " add%.l %/d0,%/d2\n" \ - " add%.l %/d3,%/d2\n" \ - " jcc 1f\n" \ - " add%.l %#65536,%/d1\n" \ - "1: swap %/d2\n" \ - " moveq %#0,%/d0\n" \ - " move%.w %/d2,%/d0\n" \ - " move%.w %/d4,%/d2\n" \ - " move%.l %/d2,%1\n" \ - " add%.l %/d1,%/d0\n" \ - " move%.l %/d0,%0" \ - : "=g" ((USItype) (xh)), \ - "=g" ((USItype) (xl)) \ - : "g" ((USItype) (a)), \ - "g" ((USItype) (b)) \ - : "d0", "d1", "d2", "d3", "d4") -#define UMUL_TIME 100 -#define UDIV_TIME 400 - -#endif /* not mc68020 */ - -/* The '020, '030, '040 and '060 have bitfield insns. - cpu32 disguises as a 68020, but lacks them. */ -#if defined (__mc68020__) && !defined (__mcpu32__) -#define count_leading_zeros(count, x) \ - __asm__ ("bfffo %1{%b2:%b2},%0" \ - : "=d" ((USItype) (count)) \ - : "od" ((USItype) (x)), "n" (0)) -/* Some ColdFire architectures have a ff1 instruction supported via - __builtin_clz. */ -#elif defined (__mcfisaaplus__) || defined (__mcfisac__) -#define count_leading_zeros(count,x) ((count) = __builtin_clz (x)) -#define COUNT_LEADING_ZEROS_0 32 -#endif -#endif /* mc68000 */ - -#if defined (__m88000__) && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("addu.co %1,%r4,%r5\n\taddu.ci %0,%r2,%r3" \ - : "=r" ((USItype) (sh)), \ - "=&r" ((USItype) (sl)) \ - : "%rJ" ((USItype) (ah)), \ - "rJ" ((USItype) (bh)), \ - "%rJ" ((USItype) (al)), \ - "rJ" ((USItype) (bl))) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("subu.co %1,%r4,%r5\n\tsubu.ci %0,%r2,%r3" \ - : "=r" ((USItype) (sh)), \ - "=&r" ((USItype) (sl)) \ - : "rJ" ((USItype) (ah)), \ - "rJ" ((USItype) (bh)), \ - "rJ" ((USItype) (al)), \ - "rJ" ((USItype) (bl))) -#define count_leading_zeros(count, x) \ - do { \ - USItype __cbtmp; \ - __asm__ ("ff1 %0,%1" \ - : "=r" (__cbtmp) \ - : "r" ((USItype) (x))); \ - (count) = __cbtmp ^ 31; \ - } while (0) -#define COUNT_LEADING_ZEROS_0 63 /* sic */ -#if defined (__mc88110__) -#define umul_ppmm(wh, wl, u, v) \ - do { \ - union {UDItype __ll; \ - struct {USItype __h, __l;} __i; \ - } __xx; \ - __asm__ ("mulu.d %0,%1,%2" \ - : "=r" (__xx.__ll) \ - : "r" ((USItype) (u)), \ - "r" ((USItype) (v))); \ - (wh) = __xx.__i.__h; \ - (wl) = __xx.__i.__l; \ - } while (0) -#define udiv_qrnnd(q, r, n1, n0, d) \ - ({union {UDItype __ll; \ - struct {USItype __h, __l;} __i; \ - } __xx; \ - USItype __q; \ - __xx.__i.__h = (n1); __xx.__i.__l = (n0); \ - __asm__ ("divu.d %0,%1,%2" \ - : "=r" (__q) \ - : "r" (__xx.__ll), \ - "r" ((USItype) (d))); \ - (r) = (n0) - __q * (d); (q) = __q; }) -#define UMUL_TIME 5 -#define UDIV_TIME 25 -#else -#define UMUL_TIME 17 -#define UDIV_TIME 150 -#endif /* __mc88110__ */ -#endif /* __m88000__ */ - -#if defined (__mn10300__) -# if defined (__AM33__) -# define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X)) -# define umul_ppmm(w1, w0, u, v) \ - asm("mulu %3,%2,%1,%0" : "=r"(w0), "=r"(w1) : "r"(u), "r"(v)) -# define smul_ppmm(w1, w0, u, v) \ - asm("mul %3,%2,%1,%0" : "=r"(w0), "=r"(w1) : "r"(u), "r"(v)) -# else -# define umul_ppmm(w1, w0, u, v) \ - asm("nop; nop; mulu %3,%0" : "=d"(w0), "=z"(w1) : "%0"(u), "d"(v)) -# define smul_ppmm(w1, w0, u, v) \ - asm("nop; nop; mul %3,%0" : "=d"(w0), "=z"(w1) : "%0"(u), "d"(v)) -# endif -# define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - do { \ - DWunion __s, __a, __b; \ - __a.s.low = (al); __a.s.high = (ah); \ - __b.s.low = (bl); __b.s.high = (bh); \ - __s.ll = __a.ll + __b.ll; \ - (sl) = __s.s.low; (sh) = __s.s.high; \ - } while (0) -# define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - do { \ - DWunion __s, __a, __b; \ - __a.s.low = (al); __a.s.high = (ah); \ - __b.s.low = (bl); __b.s.high = (bh); \ - __s.ll = __a.ll - __b.ll; \ - (sl) = __s.s.low; (sh) = __s.s.high; \ - } while (0) -# define udiv_qrnnd(q, r, nh, nl, d) \ - asm("divu %2,%0" : "=D"(q), "=z"(r) : "D"(d), "0"(nl), "1"(nh)) -# define sdiv_qrnnd(q, r, nh, nl, d) \ - asm("div %2,%0" : "=D"(q), "=z"(r) : "D"(d), "0"(nl), "1"(nh)) -# define UMUL_TIME 3 -# define UDIV_TIME 38 -#endif - -#if defined (__mips__) && W_TYPE_SIZE == 32 -#define umul_ppmm(w1, w0, u, v) \ - do { \ - UDItype __x = (UDItype) (USItype) (u) * (USItype) (v); \ - (w1) = (USItype) (__x >> 32); \ - (w0) = (USItype) (__x); \ - } while (0) -#define UMUL_TIME 10 -#define UDIV_TIME 100 - -#if (__mips == 32 || __mips == 64) && ! defined (__mips16) -#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X)) -#define COUNT_LEADING_ZEROS_0 32 -#endif -#endif /* __mips__ */ - -/* FIXME: We should test _IBMR2 here when we add assembly support for the - system vendor compilers. - FIXME: What's needed for gcc PowerPC VxWorks? __vxworks__ is not good - enough, since that hits ARM and m68k too. */ -#if (defined (_ARCH_PPC) /* AIX */ \ - || defined (__powerpc__) /* gcc */ \ - || defined (__POWERPC__) /* BEOS */ \ - || defined (__ppc__) /* Darwin */ \ - || (defined (PPC) && ! defined (CPU_FAMILY)) /* gcc 2.7.x GNU&SysV */ \ - || (defined (PPC) && defined (CPU_FAMILY) /* VxWorks */ \ - && CPU_FAMILY == PPC) \ - ) && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - do { \ - if (__builtin_constant_p (bh) && (bh) == 0) \ - __asm__ ("add%I4c %1,%3,%4\n\taddze %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ - else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \ - __asm__ ("add%I4c %1,%3,%4\n\taddme %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ - else \ - __asm__ ("add%I5c %1,%4,%5\n\tadde %0,%2,%3" \ - : "=r" (sh), "=&r" (sl) \ - : "%r" (ah), "r" (bh), "%r" (al), "rI" (bl)); \ - } while (0) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - do { \ - if (__builtin_constant_p (ah) && (ah) == 0) \ - __asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ - else if (__builtin_constant_p (ah) && (ah) == ~(USItype) 0) \ - __asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ - else if (__builtin_constant_p (bh) && (bh) == 0) \ - __asm__ ("subf%I3c %1,%4,%3\n\taddme %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ - else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \ - __asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ - else \ - __asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2" \ - : "=r" (sh), "=&r" (sl) \ - : "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \ - } while (0) -#define count_leading_zeros(count, x) \ - __asm__ ("cntlzw %0,%1" : "=r" (count) : "r" (x)) -#define COUNT_LEADING_ZEROS_0 32 -#if defined (_ARCH_PPC) || defined (__powerpc__) || defined (__POWERPC__) \ - || defined (__ppc__) \ - || (defined (PPC) && ! defined (CPU_FAMILY)) /* gcc 2.7.x GNU&SysV */ \ - || (defined (PPC) && defined (CPU_FAMILY) /* VxWorks */ \ - && CPU_FAMILY == PPC) -#define umul_ppmm(ph, pl, m0, m1) \ - do { \ - USItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("mulhwu %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \ - (pl) = __m0 * __m1; \ - } while (0) -#define UMUL_TIME 15 -#define smul_ppmm(ph, pl, m0, m1) \ - do { \ - SItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("mulhw %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \ - (pl) = __m0 * __m1; \ - } while (0) -#define SMUL_TIME 14 -#define UDIV_TIME 120 -#endif -#endif /* 32-bit POWER architecture variants. */ - -/* We should test _IBMR2 here when we add assembly support for the system - vendor compilers. */ -#if (defined (_ARCH_PPC64) || defined (__powerpc64__)) && W_TYPE_SIZE == 64 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - do { \ - if (__builtin_constant_p (bh) && (bh) == 0) \ - __asm__ ("add%I4c %1,%3,%4\n\taddze %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ - else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \ - __asm__ ("add%I4c %1,%3,%4\n\taddme %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ - else \ - __asm__ ("add%I5c %1,%4,%5\n\tadde %0,%2,%3" \ - : "=r" (sh), "=&r" (sl) \ - : "%r" (ah), "r" (bh), "%r" (al), "rI" (bl)); \ - } while (0) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - do { \ - if (__builtin_constant_p (ah) && (ah) == 0) \ - __asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ - else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0) \ - __asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ - else if (__builtin_constant_p (bh) && (bh) == 0) \ - __asm__ ("subf%I3c %1,%4,%3\n\taddme %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ - else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \ - __asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2" \ - : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ - else \ - __asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2" \ - : "=r" (sh), "=&r" (sl) \ - : "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \ - } while (0) -#define count_leading_zeros(count, x) \ - __asm__ ("cntlzd %0,%1" : "=r" (count) : "r" (x)) -#define COUNT_LEADING_ZEROS_0 64 -#define umul_ppmm(ph, pl, m0, m1) \ - do { \ - UDItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("mulhdu %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \ - (pl) = __m0 * __m1; \ - } while (0) -#define UMUL_TIME 15 -#define smul_ppmm(ph, pl, m0, m1) \ - do { \ - DItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("mulhd %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \ - (pl) = __m0 * __m1; \ - } while (0) -#define SMUL_TIME 14 /* ??? */ -#define UDIV_TIME 120 /* ??? */ -#endif /* 64-bit PowerPC. */ - -#if defined (__ibm032__) /* RT/ROMP */ && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("a %1,%5\n\tae %0,%3" \ - : "=r" ((USItype) (sh)), \ - "=&r" ((USItype) (sl)) \ - : "%0" ((USItype) (ah)), \ - "r" ((USItype) (bh)), \ - "%1" ((USItype) (al)), \ - "r" ((USItype) (bl))) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("s %1,%5\n\tse %0,%3" \ - : "=r" ((USItype) (sh)), \ - "=&r" ((USItype) (sl)) \ - : "0" ((USItype) (ah)), \ - "r" ((USItype) (bh)), \ - "1" ((USItype) (al)), \ - "r" ((USItype) (bl))) -#define umul_ppmm(ph, pl, m0, m1) \ - do { \ - USItype __m0 = (m0), __m1 = (m1); \ - __asm__ ( \ - "s r2,r2\n" \ -" mts r10,%2\n" \ -" m r2,%3\n" \ -" m r2,%3\n" \ -" m r2,%3\n" \ -" m r2,%3\n" \ -" m r2,%3\n" \ -" m r2,%3\n" \ -" m r2,%3\n" \ -" m r2,%3\n" \ -" m r2,%3\n" \ -" m r2,%3\n" \ -" m r2,%3\n" \ -" m r2,%3\n" \ -" m r2,%3\n" \ -" m r2,%3\n" \ -" m r2,%3\n" \ -" m r2,%3\n" \ -" cas %0,r2,r0\n" \ -" mfs r10,%1" \ - : "=r" ((USItype) (ph)), \ - "=r" ((USItype) (pl)) \ - : "%r" (__m0), \ - "r" (__m1) \ - : "r2"); \ - (ph) += ((((SItype) __m0 >> 31) & __m1) \ - + (((SItype) __m1 >> 31) & __m0)); \ - } while (0) -#define UMUL_TIME 20 -#define UDIV_TIME 200 -#define count_leading_zeros(count, x) \ - do { \ - if ((x) >= 0x10000) \ - __asm__ ("clz %0,%1" \ - : "=r" ((USItype) (count)) \ - : "r" ((USItype) (x) >> 16)); \ - else \ - { \ - __asm__ ("clz %0,%1" \ - : "=r" ((USItype) (count)) \ - : "r" ((USItype) (x))); \ - (count) += 16; \ - } \ - } while (0) -#endif - -#if defined(__riscv) -#ifdef __riscv_mul -#define __umulsidi3(u,v) ((UDWtype)(UWtype)(u) * (UWtype)(v)) -#define __muluw3(a, b) ((UWtype)(a) * (UWtype)(b)) -#else -#if __riscv_xlen == 32 - #define MULUW3 "call __mulsi3" -#elif __riscv_xlen == 64 - #define MULUW3 "call __muldi3" -#else -#error unsupported xlen -#endif /* __riscv_xlen */ -/* We rely on the fact that MULUW3 doesn't clobber the t-registers. - It can get better register allocation result. */ -#define __muluw3(a, b) \ - ({ \ - register UWtype __op0 asm ("a0") = a; \ - register UWtype __op1 asm ("a1") = b; \ - asm volatile (MULUW3 \ - : "+r" (__op0), "+r" (__op1) \ - : \ - : "ra", "a2", "a3"); \ - __op0; \ - }) -#endif /* __riscv_mul */ -#define umul_ppmm(w1, w0, u, v) \ - do { \ - UWtype __x0, __x1, __x2, __x3; \ - UHWtype __ul, __vl, __uh, __vh; \ - \ - __ul = __ll_lowpart (u); \ - __uh = __ll_highpart (u); \ - __vl = __ll_lowpart (v); \ - __vh = __ll_highpart (v); \ - \ - __x0 = __muluw3 (__ul, __vl); \ - __x1 = __muluw3 (__ul, __vh); \ - __x2 = __muluw3 (__uh, __vl); \ - __x3 = __muluw3 (__uh, __vh); \ - \ - __x1 += __ll_highpart (__x0);/* this can't give carry */ \ - __x1 += __x2; /* but this indeed can */ \ - if (__x1 < __x2) /* did we get it? */ \ - __x3 += __ll_B; /* yes, add it in the proper pos. */ \ - \ - (w1) = __x3 + __ll_highpart (__x1); \ - (w0) = __ll_lowpart (__x1) * __ll_B + __ll_lowpart (__x0); \ - } while (0) -#endif /* __riscv */ - -#if defined(__sh__) && W_TYPE_SIZE == 32 -#ifndef __sh1__ -#define umul_ppmm(w1, w0, u, v) \ - __asm__ ( \ - "dmulu.l %2,%3\n\tsts%M1 macl,%1\n\tsts%M0 mach,%0" \ - : "=r<" ((USItype)(w1)), \ - "=r<" ((USItype)(w0)) \ - : "r" ((USItype)(u)), \ - "r" ((USItype)(v)) \ - : "macl", "mach") -#define UMUL_TIME 5 -#endif - -/* This is the same algorithm as __udiv_qrnnd_c. */ -#define UDIV_NEEDS_NORMALIZATION 1 - -#ifdef __FDPIC__ -/* FDPIC needs a special version of the asm fragment to extract the - code address from the function descriptor. __udiv_qrnnd_16 is - assumed to be local and not to use the GOT, so loading r12 is - not needed. */ -#define udiv_qrnnd(q, r, n1, n0, d) \ - do { \ - extern UWtype __udiv_qrnnd_16 (UWtype, UWtype) \ - __attribute__ ((visibility ("hidden"))); \ - /* r0: rn r1: qn */ /* r0: n1 r4: n0 r5: d r6: d1 */ /* r2: __m */ \ - __asm__ ( \ - "mov%M4 %4,r5\n" \ -" swap.w %3,r4\n" \ -" swap.w r5,r6\n" \ -" mov.l @%5,r2\n" \ -" jsr @r2\n" \ -" shll16 r6\n" \ -" swap.w r4,r4\n" \ -" mov.l @%5,r2\n" \ -" jsr @r2\n" \ -" swap.w r1,%0\n" \ -" or r1,%0" \ - : "=r" (q), "=&z" (r) \ - : "1" (n1), "r" (n0), "rm" (d), "r" (&__udiv_qrnnd_16) \ - : "r1", "r2", "r4", "r5", "r6", "pr", "t"); \ - } while (0) -#else -#define udiv_qrnnd(q, r, n1, n0, d) \ - do { \ - extern UWtype __udiv_qrnnd_16 (UWtype, UWtype) \ - __attribute__ ((visibility ("hidden"))); \ - /* r0: rn r1: qn */ /* r0: n1 r4: n0 r5: d r6: d1 */ /* r2: __m */ \ - __asm__ ( \ - "mov%M4 %4,r5\n" \ -" swap.w %3,r4\n" \ -" swap.w r5,r6\n" \ -" jsr @%5\n" \ -" shll16 r6\n" \ -" swap.w r4,r4\n" \ -" jsr @%5\n" \ -" swap.w r1,%0\n" \ -" or r1,%0" \ - : "=r" (q), "=&z" (r) \ - : "1" (n1), "r" (n0), "rm" (d), "r" (&__udiv_qrnnd_16) \ - : "r1", "r2", "r4", "r5", "r6", "pr", "t"); \ - } while (0) -#endif /* __FDPIC__ */ - -#define UDIV_TIME 80 - -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("clrt;subc %5,%1; subc %4,%0" \ - : "=r" (sh), "=r" (sl) \ - : "0" (ah), "1" (al), "r" (bh), "r" (bl) : "t") - -#endif /* __sh__ */ - -#if defined (__sparc__) && !defined (__arch64__) && !defined (__sparcv9) \ - && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("addcc %r4,%5,%1\n\taddx %r2,%3,%0" \ - : "=r" ((USItype) (sh)), \ - "=&r" ((USItype) (sl)) \ - : "%rJ" ((USItype) (ah)), \ - "rI" ((USItype) (bh)), \ - "%rJ" ((USItype) (al)), \ - "rI" ((USItype) (bl)) \ - __CLOBBER_CC) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("subcc %r4,%5,%1\n\tsubx %r2,%3,%0" \ - : "=r" ((USItype) (sh)), \ - "=&r" ((USItype) (sl)) \ - : "rJ" ((USItype) (ah)), \ - "rI" ((USItype) (bh)), \ - "rJ" ((USItype) (al)), \ - "rI" ((USItype) (bl)) \ - __CLOBBER_CC) -#if defined (__sparc_v9__) -#define umul_ppmm(w1, w0, u, v) \ - do { \ - register USItype __g1 asm ("g1"); \ - __asm__ ("umul\t%2,%3,%1\n\t" \ - "srlx\t%1, 32, %0" \ - : "=r" ((USItype) (w1)), \ - "=r" (__g1) \ - : "r" ((USItype) (u)), \ - "r" ((USItype) (v))); \ - (w0) = __g1; \ - } while (0) -#define udiv_qrnnd(__q, __r, __n1, __n0, __d) \ - __asm__ ("mov\t%2,%%y\n\t" \ - "udiv\t%3,%4,%0\n\t" \ - "umul\t%0,%4,%1\n\t" \ - "sub\t%3,%1,%1" \ - : "=&r" ((USItype) (__q)), \ - "=&r" ((USItype) (__r)) \ - : "r" ((USItype) (__n1)), \ - "r" ((USItype) (__n0)), \ - "r" ((USItype) (__d))) -#else -#if defined (__sparc_v8__) -#define umul_ppmm(w1, w0, u, v) \ - __asm__ ("umul %2,%3,%1;rd %%y,%0" \ - : "=r" ((USItype) (w1)), \ - "=r" ((USItype) (w0)) \ - : "r" ((USItype) (u)), \ - "r" ((USItype) (v))) -#define udiv_qrnnd(__q, __r, __n1, __n0, __d) \ - __asm__ ("mov %2,%%y;nop;nop;nop;udiv %3,%4,%0;umul %0,%4,%1;sub %3,%1,%1"\ - : "=&r" ((USItype) (__q)), \ - "=&r" ((USItype) (__r)) \ - : "r" ((USItype) (__n1)), \ - "r" ((USItype) (__n0)), \ - "r" ((USItype) (__d))) -#else -#if defined (__sparclite__) -/* This has hardware multiply but not divide. It also has two additional - instructions scan (ffs from high bit) and divscc. */ -#define umul_ppmm(w1, w0, u, v) \ - __asm__ ("umul %2,%3,%1;rd %%y,%0" \ - : "=r" ((USItype) (w1)), \ - "=r" ((USItype) (w0)) \ - : "r" ((USItype) (u)), \ - "r" ((USItype) (v))) -#define udiv_qrnnd(q, r, n1, n0, d) \ - __asm__ ("! Inlined udiv_qrnnd\n" \ -" wr %%g0,%2,%%y ! Not a delayed write for sparclite\n" \ -" tst %%g0\n" \ -" divscc %3,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%%g1\n" \ -" divscc %%g1,%4,%0\n" \ -" rd %%y,%1\n" \ -" bl,a 1f\n" \ -" add %1,%4,%1\n" \ -"1: ! End of inline udiv_qrnnd" \ - : "=r" ((USItype) (q)), \ - "=r" ((USItype) (r)) \ - : "r" ((USItype) (n1)), \ - "r" ((USItype) (n0)), \ - "rI" ((USItype) (d)) \ - : "g1" __AND_CLOBBER_CC) -#define UDIV_TIME 37 -#define count_leading_zeros(count, x) \ - do { \ - __asm__ ("scan %1,1,%0" \ - : "=r" ((USItype) (count)) \ - : "r" ((USItype) (x))); \ - } while (0) -/* Early sparclites return 63 for an argument of 0, but they warn that future - implementations might change this. Therefore, leave COUNT_LEADING_ZEROS_0 - undefined. */ -#else -/* SPARC without integer multiplication and divide instructions. - (i.e. at least Sun4/20,40,60,65,75,110,260,280,330,360,380,470,490) */ -#define umul_ppmm(w1, w0, u, v) \ - __asm__ ("! Inlined umul_ppmm\n" \ -" wr %%g0,%2,%%y ! SPARC has 0-3 delay insn after a wr\n"\ -" sra %3,31,%%o5 ! Don't move this insn\n" \ -" and %2,%%o5,%%o5 ! Don't move this insn\n" \ -" andcc %%g0,0,%%g1 ! Don't move this insn\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,%3,%%g1\n" \ -" mulscc %%g1,0,%%g1\n" \ -" add %%g1,%%o5,%0\n" \ -" rd %%y,%1" \ - : "=r" ((USItype) (w1)), \ - "=r" ((USItype) (w0)) \ - : "%rI" ((USItype) (u)), \ - "r" ((USItype) (v)) \ - : "g1", "o5" __AND_CLOBBER_CC) -#define UMUL_TIME 39 /* 39 instructions */ -/* It's quite necessary to add this much assembler for the sparc. - The default udiv_qrnnd (in C) is more than 10 times slower! */ -#define udiv_qrnnd(__q, __r, __n1, __n0, __d) \ - __asm__ ("! Inlined udiv_qrnnd\n" \ -" mov 32,%%g1\n" \ -" subcc %1,%2,%%g0\n" \ -"1: bcs 5f\n" \ -" addxcc %0,%0,%0 ! shift n1n0 and a q-bit in lsb\n" \ -" sub %1,%2,%1 ! this kills msb of n\n" \ -" addx %1,%1,%1 ! so this can't give carry\n" \ -" subcc %%g1,1,%%g1\n" \ -"2: bne 1b\n" \ -" subcc %1,%2,%%g0\n" \ -" bcs 3f\n" \ -" addxcc %0,%0,%0 ! shift n1n0 and a q-bit in lsb\n" \ -" b 3f\n" \ -" sub %1,%2,%1 ! this kills msb of n\n" \ -"4: sub %1,%2,%1\n" \ -"5: addxcc %1,%1,%1\n" \ -" bcc 2b\n" \ -" subcc %%g1,1,%%g1\n" \ -"! Got carry from n. Subtract next step to cancel this carry.\n" \ -" bne 4b\n" \ -" addcc %0,%0,%0 ! shift n1n0 and a 0-bit in lsb\n" \ -" sub %1,%2,%1\n" \ -"3: xnor %0,0,%0\n" \ -" ! End of inline udiv_qrnnd" \ - : "=&r" ((USItype) (__q)), \ - "=&r" ((USItype) (__r)) \ - : "r" ((USItype) (__d)), \ - "1" ((USItype) (__n1)), \ - "0" ((USItype) (__n0)) : "g1" __AND_CLOBBER_CC) -#define UDIV_TIME (3+7*32) /* 7 instructions/iteration. 32 iterations. */ -#endif /* __sparclite__ */ -#endif /* __sparc_v8__ */ -#endif /* __sparc_v9__ */ -#endif /* sparc32 */ - -#if ((defined (__sparc__) && defined (__arch64__)) || defined (__sparcv9)) \ - && W_TYPE_SIZE == 64 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - do { \ - UDItype __carry = 0; \ - __asm__ ("addcc\t%r5,%6,%1\n\t" \ - "add\t%r3,%4,%0\n\t" \ - "movcs\t%%xcc, 1, %2\n\t" \ - "add\t%0, %2, %0" \ - : "=r" ((UDItype)(sh)), \ - "=&r" ((UDItype)(sl)), \ - "+r" (__carry) \ - : "%rJ" ((UDItype)(ah)), \ - "rI" ((UDItype)(bh)), \ - "%rJ" ((UDItype)(al)), \ - "rI" ((UDItype)(bl)) \ - __CLOBBER_CC); \ - } while (0) - -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - do { \ - UDItype __carry = 0; \ - __asm__ ("subcc\t%r5,%6,%1\n\t" \ - "sub\t%r3,%4,%0\n\t" \ - "movcs\t%%xcc, 1, %2\n\t" \ - "sub\t%0, %2, %0" \ - : "=r" ((UDItype)(sh)), \ - "=&r" ((UDItype)(sl)), \ - "+r" (__carry) \ - : "%rJ" ((UDItype)(ah)), \ - "rI" ((UDItype)(bh)), \ - "%rJ" ((UDItype)(al)), \ - "rI" ((UDItype)(bl)) \ - __CLOBBER_CC); \ - } while (0) - -#define umul_ppmm(wh, wl, u, v) \ - do { \ - UDItype tmp1, tmp2, tmp3, tmp4; \ - __asm__ __volatile__ ( \ - "srl %7,0,%3\n\t" \ - "mulx %3,%6,%1\n\t" \ - "srlx %6,32,%2\n\t" \ - "mulx %2,%3,%4\n\t" \ - "sllx %4,32,%5\n\t" \ - "srl %6,0,%3\n\t" \ - "sub %1,%5,%5\n\t" \ - "srlx %5,32,%5\n\t" \ - "addcc %4,%5,%4\n\t" \ - "srlx %7,32,%5\n\t" \ - "mulx %3,%5,%3\n\t" \ - "mulx %2,%5,%5\n\t" \ - "sethi %%hi(0x80000000),%2\n\t" \ - "addcc %4,%3,%4\n\t" \ - "srlx %4,32,%4\n\t" \ - "add %2,%2,%2\n\t" \ - "movcc %%xcc,%%g0,%2\n\t" \ - "addcc %5,%4,%5\n\t" \ - "sllx %3,32,%3\n\t" \ - "add %1,%3,%1\n\t" \ - "add %5,%2,%0" \ - : "=r" ((UDItype)(wh)), \ - "=&r" ((UDItype)(wl)), \ - "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3), "=&r" (tmp4) \ - : "r" ((UDItype)(u)), \ - "r" ((UDItype)(v)) \ - __CLOBBER_CC); \ - } while (0) -#define UMUL_TIME 96 -#define UDIV_TIME 230 -#endif /* sparc64 */ - -#if defined (__vax__) && W_TYPE_SIZE == 32 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("addl2 %5,%1\n\tadwc %3,%0" \ - : "=g" ((USItype) (sh)), \ - "=&g" ((USItype) (sl)) \ - : "%0" ((USItype) (ah)), \ - "g" ((USItype) (bh)), \ - "%1" ((USItype) (al)), \ - "g" ((USItype) (bl))) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("subl2 %5,%1\n\tsbwc %3,%0" \ - : "=g" ((USItype) (sh)), \ - "=&g" ((USItype) (sl)) \ - : "0" ((USItype) (ah)), \ - "g" ((USItype) (bh)), \ - "1" ((USItype) (al)), \ - "g" ((USItype) (bl))) -#define umul_ppmm(xh, xl, m0, m1) \ - do { \ - union { \ - UDItype __ll; \ - struct {USItype __l, __h;} __i; \ - } __xx; \ - USItype __m0 = (m0), __m1 = (m1); \ - __asm__ ("emul %1,%2,$0,%0" \ - : "=r" (__xx.__ll) \ - : "g" (__m0), \ - "g" (__m1)); \ - (xh) = __xx.__i.__h; \ - (xl) = __xx.__i.__l; \ - (xh) += ((((SItype) __m0 >> 31) & __m1) \ - + (((SItype) __m1 >> 31) & __m0)); \ - } while (0) -#define sdiv_qrnnd(q, r, n1, n0, d) \ - do { \ - union {DItype __ll; \ - struct {SItype __l, __h;} __i; \ - } __xx; \ - __xx.__i.__h = n1; __xx.__i.__l = n0; \ - __asm__ ("ediv %3,%2,%0,%1" \ - : "=g" (q), "=g" (r) \ - : "g" (__xx.__ll), "g" (d)); \ - } while (0) -#endif /* __vax__ */ - -#ifdef _TMS320C6X -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - do \ - { \ - UDItype __ll; \ - __asm__ ("addu .l1 %1, %2, %0" \ - : "=a" (__ll) : "a" (al), "a" (bl)); \ - (sl) = (USItype)__ll; \ - (sh) = ((USItype)(__ll >> 32)) + (ah) + (bh); \ - } \ - while (0) - -#ifdef _TMS320C6400_PLUS -#define __umulsidi3(u,v) ((UDItype)(USItype)u*(USItype)v) -#define umul_ppmm(w1, w0, u, v) \ - do { \ - UDItype __x = (UDItype) (USItype) (u) * (USItype) (v); \ - (w1) = (USItype) (__x >> 32); \ - (w0) = (USItype) (__x); \ - } while (0) -#endif /* _TMS320C6400_PLUS */ - -#define count_leading_zeros(count, x) ((count) = __builtin_clz (x)) -#ifdef _TMS320C6400 -#define count_trailing_zeros(count, x) ((count) = __builtin_ctz (x)) -#endif -#define UMUL_TIME 4 -#define UDIV_TIME 40 -#endif /* _TMS320C6X */ - -#if defined (__xtensa__) && W_TYPE_SIZE == 32 -/* This code is not Xtensa-configuration-specific, so rely on the compiler - to expand builtin functions depending on what configuration features - are available. This avoids library calls when the operation can be - performed in-line. */ -#define umul_ppmm(w1, w0, u, v) \ - do { \ - DWunion __w; \ - __w.ll = __builtin_umulsidi3 (u, v); \ - w1 = __w.s.high; \ - w0 = __w.s.low; \ - } while (0) -#define __umulsidi3(u, v) __builtin_umulsidi3 (u, v) -#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X)) -#define count_trailing_zeros(COUNT, X) ((COUNT) = __builtin_ctz (X)) -#endif /* __xtensa__ */ - -#if defined xstormy16 -extern UHItype __stormy16_count_leading_zeros (UHItype); -#define count_leading_zeros(count, x) \ - do \ - { \ - UHItype size; \ - \ - /* We assume that W_TYPE_SIZE is a multiple of 16... */ \ - for ((count) = 0, size = W_TYPE_SIZE; size; size -= 16) \ - { \ - UHItype c; \ - \ - c = __clzhi2 ((x) >> (size - 16)); \ - (count) += c; \ - if (c != 16) \ - break; \ - } \ - } \ - while (0) -#define COUNT_LEADING_ZEROS_0 W_TYPE_SIZE -#endif - -#if defined (__z8000__) && W_TYPE_SIZE == 16 -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - __asm__ ("add %H1,%H5\n\tadc %H0,%H3" \ - : "=r" ((unsigned int)(sh)), \ - "=&r" ((unsigned int)(sl)) \ - : "%0" ((unsigned int)(ah)), \ - "r" ((unsigned int)(bh)), \ - "%1" ((unsigned int)(al)), \ - "rQR" ((unsigned int)(bl))) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - __asm__ ("sub %H1,%H5\n\tsbc %H0,%H3" \ - : "=r" ((unsigned int)(sh)), \ - "=&r" ((unsigned int)(sl)) \ - : "0" ((unsigned int)(ah)), \ - "r" ((unsigned int)(bh)), \ - "1" ((unsigned int)(al)), \ - "rQR" ((unsigned int)(bl))) -#define umul_ppmm(xh, xl, m0, m1) \ - do { \ - union {long int __ll; \ - struct {unsigned int __h, __l;} __i; \ - } __xx; \ - unsigned int __m0 = (m0), __m1 = (m1); \ - __asm__ ("mult %S0,%H3" \ - : "=r" (__xx.__i.__h), \ - "=r" (__xx.__i.__l) \ - : "%1" (__m0), \ - "rQR" (__m1)); \ - (xh) = __xx.__i.__h; (xl) = __xx.__i.__l; \ - (xh) += ((((signed int) __m0 >> 15) & __m1) \ - + (((signed int) __m1 >> 15) & __m0)); \ - } while (0) -#endif /* __z8000__ */ - -#endif /* __GNUC__ */ - -/* If this machine has no inline assembler, use C macros. */ - -#if !defined (add_ssaaaa) -#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ - do { \ - UWtype __x; \ - __x = (al) + (bl); \ - (sh) = (ah) + (bh) + (__x < (al)); \ - (sl) = __x; \ - } while (0) -#endif - -#if !defined (sub_ddmmss) -#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ - do { \ - UWtype __x; \ - __x = (al) - (bl); \ - (sh) = (ah) - (bh) - (__x > (al)); \ - (sl) = __x; \ - } while (0) -#endif - -/* If we lack umul_ppmm but have smul_ppmm, define umul_ppmm in terms of - smul_ppmm. */ -#if !defined (umul_ppmm) && defined (smul_ppmm) -#define umul_ppmm(w1, w0, u, v) \ - do { \ - UWtype __w1; \ - UWtype __xm0 = (u), __xm1 = (v); \ - smul_ppmm (__w1, w0, __xm0, __xm1); \ - (w1) = __w1 + (-(__xm0 >> (W_TYPE_SIZE - 1)) & __xm1) \ - + (-(__xm1 >> (W_TYPE_SIZE - 1)) & __xm0); \ - } while (0) -#endif - -/* If we still don't have umul_ppmm, define it using plain C. */ -#if !defined (umul_ppmm) -#define umul_ppmm(w1, w0, u, v) \ - do { \ - UWtype __x0, __x1, __x2, __x3; \ - UHWtype __ul, __vl, __uh, __vh; \ - \ - __ul = __ll_lowpart (u); \ - __uh = __ll_highpart (u); \ - __vl = __ll_lowpart (v); \ - __vh = __ll_highpart (v); \ - \ - __x0 = (UWtype) __ul * __vl; \ - __x1 = (UWtype) __ul * __vh; \ - __x2 = (UWtype) __uh * __vl; \ - __x3 = (UWtype) __uh * __vh; \ - \ - __x1 += __ll_highpart (__x0);/* this can't give carry */ \ - __x1 += __x2; /* but this indeed can */ \ - if (__x1 < __x2) /* did we get it? */ \ - __x3 += __ll_B; /* yes, add it in the proper pos. */ \ - \ - (w1) = __x3 + __ll_highpart (__x1); \ - (w0) = __ll_lowpart (__x1) * __ll_B + __ll_lowpart (__x0); \ - } while (0) -#endif - -#if !defined (__umulsidi3) -#define __umulsidi3(u, v) \ - ({DWunion __w; \ - umul_ppmm (__w.s.high, __w.s.low, u, v); \ - __w.ll; }) -#endif - -/* Define this unconditionally, so it can be used for debugging. */ -#define __udiv_qrnnd_c(q, r, n1, n0, d) \ - do { \ - UWtype __d1, __d0, __q1, __q0; \ - UWtype __r1, __r0, __m; \ - __d1 = __ll_highpart (d); \ - __d0 = __ll_lowpart (d); \ - \ - __r1 = (n1) % __d1; \ - __q1 = (n1) / __d1; \ - __m = (UWtype) __q1 * __d0; \ - __r1 = __r1 * __ll_B | __ll_highpart (n0); \ - if (__r1 < __m) \ - { \ - __q1--, __r1 += (d); \ - if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */\ - if (__r1 < __m) \ - __q1--, __r1 += (d); \ - } \ - __r1 -= __m; \ - \ - __r0 = __r1 % __d1; \ - __q0 = __r1 / __d1; \ - __m = (UWtype) __q0 * __d0; \ - __r0 = __r0 * __ll_B | __ll_lowpart (n0); \ - if (__r0 < __m) \ - { \ - __q0--, __r0 += (d); \ - if (__r0 >= (d)) \ - if (__r0 < __m) \ - __q0--, __r0 += (d); \ - } \ - __r0 -= __m; \ - \ - (q) = (UWtype) __q1 * __ll_B | __q0; \ - (r) = __r0; \ - } while (0) - -/* If the processor has no udiv_qrnnd but sdiv_qrnnd, go through - __udiv_w_sdiv (defined in libgcc or elsewhere). */ -#if !defined (udiv_qrnnd) && defined (sdiv_qrnnd) -#define udiv_qrnnd(q, r, nh, nl, d) \ - do { \ - extern UWtype __udiv_w_sdiv (UWtype *, UWtype, UWtype, UWtype); \ - UWtype __r; \ - (q) = __udiv_w_sdiv (&__r, nh, nl, d); \ - (r) = __r; \ - } while (0) -#endif - -/* If udiv_qrnnd was not defined for this processor, use __udiv_qrnnd_c. */ -#if !defined (udiv_qrnnd) -#define UDIV_NEEDS_NORMALIZATION 1 -#define udiv_qrnnd __udiv_qrnnd_c -#endif - -#if !defined (count_leading_zeros) -#define count_leading_zeros(count, x) \ - do { \ - UWtype __xr = (x); \ - UWtype __a; \ - \ - if (W_TYPE_SIZE <= 32) \ - { \ - __a = __xr < ((UWtype)1<<2*__BITS4) \ - ? (__xr < ((UWtype)1<<__BITS4) ? 0 : __BITS4) \ - : (__xr < ((UWtype)1<<3*__BITS4) ? 2*__BITS4 : 3*__BITS4); \ - } \ - else \ - { \ - for (__a = W_TYPE_SIZE - 8; __a > 0; __a -= 8) \ - if (((__xr >> __a) & 0xff) != 0) \ - break; \ - } \ - \ - (count) = W_TYPE_SIZE - (__clz_tab[__xr >> __a] + __a); \ - } while (0) -#define COUNT_LEADING_ZEROS_0 W_TYPE_SIZE -#endif - -#if !defined (count_trailing_zeros) -/* Define count_trailing_zeros using count_leading_zeros. The latter might be - defined in asm, but if it is not, the C version above is good enough. */ -#define count_trailing_zeros(count, x) \ - do { \ - UWtype __ctz_x = (x); \ - UWtype __ctz_c; \ - count_leading_zeros (__ctz_c, __ctz_x & -__ctz_x); \ - (count) = W_TYPE_SIZE - 1 - __ctz_c; \ - } while (0) -#endif - -#ifndef UDIV_NEEDS_NORMALIZATION -#define UDIV_NEEDS_NORMALIZATION 0 -#endif diff --git a/stdlib/mod_1.c b/stdlib/mod_1.c index be3ae3d648..a95051d4c4 100644 --- a/stdlib/mod_1.c +++ b/stdlib/mod_1.c @@ -24,8 +24,6 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, see #include #include #include "gmp-impl.h" -#include "longlong.h" -#include #ifndef UMUL_TIME #define UMUL_TIME 1 diff --git a/stdlib/mul_1.c b/stdlib/mul_1.c index 0a04a8eb1e..e53fbeaa79 100644 --- a/stdlib/mul_1.c +++ b/stdlib/mul_1.c @@ -21,8 +21,6 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, see #include #include "gmp-impl.h" -#include "longlong.h" -#include mp_limb_t mpn_mul_1 (register mp_ptr res_ptr, register mp_srcptr s1_ptr, diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c index 7618adb285..d00a336589 100644 --- a/stdlib/strtod_l.c +++ b/stdlib/strtod_l.c @@ -82,8 +82,6 @@ extern double ____strtod_l_internal (const char *, char **, int, locale_t); #include #include #include "gmp-impl.h" -#include "longlong.h" -#include "gmp-arch.h" #include "fpioconst.h" #include diff --git a/stdlib/submul_1.c b/stdlib/submul_1.c index 0005c2e04e..31a6d4b2e7 100644 --- a/stdlib/submul_1.c +++ b/stdlib/submul_1.c @@ -23,8 +23,6 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, see #include #include "gmp-impl.h" -#include "longlong.h" -#include mp_limb_t mpn_submul_1 (register mp_ptr res_ptr, register mp_srcptr s1_ptr, diff --git a/sysdeps/generic/gmp-arch.h b/sysdeps/generic/gmp-arch.h index f1dba1384b..b3004c90ed 100644 --- a/sysdeps/generic/gmp-arch.h +++ b/sysdeps/generic/gmp-arch.h @@ -53,7 +53,6 @@ umul_ppmm_generic (mp_limb_t *w1, mp_limb_t *w0, mp_limb_t u, mp_limb_t v) *w0 = u128_low (r); #endif } -#undef umul_ppmm #define umul_ppmm(__w1, __w0, __u, __v) \ ({ \ __typeof (__w0) __w0t; \ @@ -117,9 +116,7 @@ udiv_qrnnd_generic (mp_limb_t *q, mp_limb_t *r, mp_limb_t n1, mp_limb_t n0, *q = q1 * LL_B | q0; *r = r0; } -# undef UDIV_NEEDS_NORMALIZATION # define UDIV_NEEDS_NORMALIZATION 1 -# undef udiv_qrnnd # define udiv_qrnnd(__q, __r, __n1, __n0, __d) \ udiv_qrnnd_generic (&__q, &__r, __n1, __n0, __d) #endif @@ -147,7 +144,6 @@ add_ssaaaa_generic (mp_limb_t *sh, mp_limb_t *sl, mp_limb_t ah, *sl = u128_low (r); #endif } -#undef add_ssaaaa #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ add_ssaaaa_generic (&sh, &sl, ah, al, bh, bl) @@ -174,7 +170,6 @@ sub_ddmmss_generic (mp_limb_t *sh, mp_limb_t *sl, mp_limb_t ah, *sl = u128_low (r); #endif } -#undef sub_ddmmss #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ sub_ddmmss_generic (&sh, &sl, ah, al, bh, bl) diff --git a/sysdeps/ieee754/dbl-64/dbl2mpn.c b/sysdeps/ieee754/dbl-64/dbl2mpn.c index cacf5da7d8..50974cfc62 100644 --- a/sysdeps/ieee754/dbl-64/dbl2mpn.c +++ b/sysdeps/ieee754/dbl-64/dbl2mpn.c @@ -17,8 +17,6 @@ #include "gmp.h" #include "gmp-impl.h" -#include "longlong.h" -#include #include #include #include diff --git a/sysdeps/ieee754/ldbl-128/ldbl2mpn.c b/sysdeps/ieee754/ldbl-128/ldbl2mpn.c index fd75db1271..cd0ee1e073 100644 --- a/sysdeps/ieee754/ldbl-128/ldbl2mpn.c +++ b/sysdeps/ieee754/ldbl-128/ldbl2mpn.c @@ -17,8 +17,6 @@ #include "gmp.h" #include "gmp-impl.h" -#include "longlong.h" -#include #include #include #include diff --git a/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c b/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c index d91699c3d0..72714eee2e 100644 --- a/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c +++ b/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c @@ -17,7 +17,6 @@ #include "gmp.h" #include "gmp-impl.h" -#include "longlong.h" #include #include #include diff --git a/sysdeps/ieee754/ldbl-96/ldbl2mpn.c b/sysdeps/ieee754/ldbl-96/ldbl2mpn.c index 6c7aadbca2..5826798631 100644 --- a/sysdeps/ieee754/ldbl-96/ldbl2mpn.c +++ b/sysdeps/ieee754/ldbl-96/ldbl2mpn.c @@ -17,8 +17,6 @@ #include "gmp.h" #include "gmp-impl.h" -#include "longlong.h" -#include #include #include #include diff --git a/sysdeps/wordsize-32/divdi3.c b/sysdeps/wordsize-32/divdi3.c index 360094134f..0269729b96 100644 --- a/sysdeps/wordsize-32/divdi3.c +++ b/sysdeps/wordsize-32/divdi3.c @@ -33,8 +33,6 @@ #include #include -#include -#include #if __BYTE_ORDER == __BIG_ENDIAN struct DWstruct { Wtype high, low;}; diff --git a/sysdeps/x86/gmp-arch.h b/sysdeps/x86/gmp-arch.h index 5d65b16216..d739350d0b 100644 --- a/sysdeps/x86/gmp-arch.h +++ b/sysdeps/x86/gmp-arch.h @@ -41,9 +41,7 @@ udiv_qrnnd_x86 (mp_limb_t *q, mp_limb_t *r, mp_limb_t n1, mp_limb_t n0, "rm" (d)); #endif } -#undef UDIV_NEEDS_NORMALIZATION #define UDIV_NEEDS_NORMALIZATION 0 -#undef udiv_qrnnd #define udiv_qrnnd(__q, __r, __n1, __n0, __d) \ udiv_qrnnd_x86 (&__q, &__r, __n1, __n0, __d) diff --git a/sysdeps/x86/ldbl2mpn.c b/sysdeps/x86/ldbl2mpn.c index 593c472e8a..43a34bbcf7 100644 --- a/sysdeps/x86/ldbl2mpn.c +++ b/sysdeps/x86/ldbl2mpn.c @@ -17,8 +17,6 @@ #include "gmp.h" #include "gmp-impl.h" -#include "longlong.h" -#include #include #include #include From patchwork Thu Nov 20 18:30:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 124893 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 AD6C8385AC33 for ; Thu, 20 Nov 2025 18:55:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AD6C8385AC33 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=nuDhoXn/ X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by sourceware.org (Postfix) with ESMTPS id 8A50E385AC1A for ; Thu, 20 Nov 2025 18:31:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8A50E385AC1A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8A50E385AC1A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::541 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663486; cv=none; b=pxJ/H67UkuGU7DO1Atezt9o420pWkf2kFpB5+K5H/OaqxErKQedDOUFRuLMncnEvilDRprpXC/uUPSVACkL/HCgcAZb696R0SQFf9dzy+lYmLrPUezVyQLGmH1Z+0mTPSj65JXrQwoMRT3x7/uNIL6vpExgdvej75dhiavT/G1A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663486; c=relaxed/simple; bh=6aMl5R2lhZ6uRD/RFLlk3+ZigkHxX1pEvCD4vZqPVQA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=JGJWYwQc1Kp1QL+8+XxyxXcB+ausjJZKz/U8wcRK8ZZbFZIOjl1Xx6ZjLFSPAaGZ7UrabCXJ9ocevvv/0Ysixe//De8K3i+sl55le03/dBvbiltayFA2aLP+71ANu69ow5L+MSAUQy0cTjg53y38SqviePio8Q7KD7kKQciNWr8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8A50E385AC1A Received: by mail-pg1-x541.google.com with SMTP id 41be03b00d2f7-b98983baeacso640709a12.1 for ; Thu, 20 Nov 2025 10:31:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763663485; x=1764268285; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7QseInkH9kGM9+TzTelF9Ya3tN8+8DP0iz3yWD3Ps8c=; b=nuDhoXn/jQGrWWOmfXoTPGaQTwXx8x3OnQF8UM+rluEGlnK3E6lf445kAcRDGMxCiX jKebwO+2PJg9R2Q9Rg1DV31osQQFJeo3AEDUmhBhQFFFvc+ZakUESWa5JygaRsyzsV5X /bs4YqTniQKaL83gK5tWz+rd+24OvPioNY5bv5B/8KEiFK5aI5VSAkQTcNulMPF+S5LH P+xp9Aukv6okbu6lILrMBGEenaTO1yaz/RtBNlF6J2GqnplFNh78tl0IZ1lP1eVmrpQo FOPp/7IizMit86rnzH+dS+6snxjS83iBTU0SA8/K+BjavAfG+3zp9JtsPk+PtcC9kYbC lcBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763663485; x=1764268285; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=7QseInkH9kGM9+TzTelF9Ya3tN8+8DP0iz3yWD3Ps8c=; b=SB4uDCScxEIc5ZwZ/YN0+wnRkZXDELnj8nXaVpwD3kSKPeNC3rN4WLfFABMa+mUl7H jUJguNUH+ex1Od9wF14OvsOmDSc4dCk/9yYR9juNCIpY03g9rR2JGlehJ9+yAyZDF/sF 114STXFFGRnx20YYG4mBwEQVErtgMfZp1bHKqaXvcW/2T0CaI9bWuP8Vio0edrM+uI45 yLqJS0icqKQp4SHhOfAN/SOoADl0WF6/BmSr+yiWXdbQlw/Q48mI8XnLroUgaoDfbqdU QekQYAal0ZrINgHqe5Kt8BGe3dB20cbNa18BBthHTNnSWdmwz74Q2MBrAUW5mjDY+dGU k4Iw== X-Gm-Message-State: AOJu0YziD2p5OBKNtVAYIzNhaklzC9ZjDwRPt783CCRDdi9w5W2R/opa nwjfFhfXWvGw0TiybjPJQfqB3hsDj1eofvK2QkZQZxf3K220qGrY6BNVptxiM3Ml9o0usNJwIPg 1+2IRq2MpVw== X-Gm-Gg: ASbGncuapIJfOCUqh+6Ob/lCyCKLLGaH7/79Vpv2icnic6vF0U0emOB7efi6caLehTH F/u+NSMpUkNHwPQ5GEKSfRzrkQ1nxMRHMuIn6elB4eNZp/Bg/2OhEWPGTXPgHm8df9CNOasogt4 WVsIUQZtyQv0SyFh6Y/OdFw52N4oZPA5MHSnuuXXfY+Qn5B4+2t6NZ8Rs83KpARO7e2tR69+DsA uAdOW+mw87iGshCmLNpEQjF2WTvH61FNSqNmJamkB7suw5Y9K5KG5DkkW2U8bFUz7hcgfc/qKTY AA8CR6jIH7Rl5P7b4PiVm4ZDP1L2z2xLQTP3lP8Ga/GJo5zGg5KQSot8coYqwasA40UKE5I1ceV gTAt6s6W2DsmfaufPFHlsZHbCeJtSUR4O2HkSZJ0wJu4/d+LLPihaNVVyTgLvHIvFjpfLrvDM+i ALgHQZKuhrtzZDp5ok1tXYuA== X-Google-Smtp-Source: AGHT+IESOoKHimH7E1P0z/9GBNTpvmxQ+wNbsh3Um6AUJSLE+T/Dj3/vuNZ8jFQcOVFvodC6536MDg== X-Received: by 2002:a05:7300:b10b:b0:2a4:3593:dde0 with SMTP id 5a478bee46e88-2a6fd019d9amr1587168eec.13.1763663484175; Thu, 20 Nov 2025 10:31:24 -0800 (PST) Received: from ubuntu-vm.. ([187.11.52.82]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2a6fc5e3750sm9664359eec.6.2025.11.20.10.31.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 10:31:23 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Sam James , Collin Funk , "H . J . Lu" Subject: [PATCH v5 05/12] Handle clang -Wignored-attributes on weak aliases Date: Thu, 20 Nov 2025 15:30:09 -0300 Message-ID: <20251120183107.2334580-6-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> References: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, 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 Clang issues a warning for double alias redirection, indicating that thei original symbol is used even if a weak definition attempts to override it. For instance, in the construction: int __internal_impl (...) {} weak_alias (__internal_impl, external_impl); #if SOMETHING weak_alias (external_impl, another_external_impl) #endif Clang warns that another_external_impl always resolves to __internal_impl, even if external_impl is a weak reference. Using the internal symbol for both aliases resolves this warning. This issue also occurs with certain libc_hidden_def usage: int __internal_impl (...) {} weak_alias (__internal_impl, __internal_alias) libc_hidden_weak (__internal_alias) In this case, using a strong_alias is sufficient to avoid the warning (since the alias is internal, there is no need to use a weak alias). However, for the constructions like: int __internal_impl (...) {} weak_alias (__internal_impl, __internal_alias) libc_hidden_def (__internal_alias) weak_alias (__internal_impl, external_alias) libc_hidden_def (external_alias) Clang warns that the internal external_alias will always resolve to __GI___internal_impl eve if a weak definition to __GI_internal_impl is overriden. For this case, a new macro named static_weak_alias is used to create a strong alias for SHARED, or a weak_alias otherwise. With these changes, there is no need to check and enable the -Wno-ignored-attributes suppression when using clang. --- Makefile.in | 2 - benchtests/bench-memset.c | 1 + configure | 70 ------------------- configure.ac | 24 ------- dirent/Makefile | 1 - include/libc-symbols.h | 10 +++ inet/Makefile | 3 - inet/in6_addr.c | 4 +- io/Makefile | 18 +++-- io/Versions | 1 - io/lockf64.c | 2 +- libio/Makefile | 14 +--- libio/feof_u.c | 2 +- libio/ferror_u.c | 2 +- libio/fileno.c | 2 +- libio/getc_u.c | 2 +- libio/iofflush.c | 2 +- libio/iofflush_u.c | 2 +- libio/iofgets_u.c | 2 +- libio/iofputs.c | 2 +- libio/iofputs_u.c | 2 +- libio/iofwrite.c | 2 +- libio/ioputs.c | 2 +- libio/putc_u.c | 2 +- login/Makefile | 1 - misc/Makefile | 2 - misc/makedev.c | 6 +- posix/Makefile | 6 +- posix/confstr.c | 2 +- posix/fork.c | 2 +- resolv/Makefile | 1 - resolv/inet_pton.c | 2 +- resource/Makefile | 3 - socket/Makefile | 10 +-- stdio-common/Makefile | 2 - stdlib/Makefile | 12 ---- stdlib/secure-getenv.c | 2 +- stdlib/strtod_l.c | 10 +-- stdlib/strtof_l.c | 4 +- stdlib/strtol.c | 2 +- string/Makefile | 9 --- string/argz-next.c | 2 +- string/basename.c | 2 +- string/ffs.c | 2 +- string/ffsll.c | 4 +- string/memmem.c | 2 +- string/mempcpy.c | 2 +- string/test-memchr.c | 4 +- string/test-strchr.c | 4 +- string/test-strlen.c | 4 +- string/test-strnlen.c | 4 +- sysdeps/aarch64/Makefile | 1 - sysdeps/aarch64/fpu/fclrexcpt.c | 2 +- sysdeps/aarch64/fpu/fegetenv.c | 2 +- sysdeps/aarch64/fpu/fegetround.c | 2 +- sysdeps/aarch64/fpu/feholdexcpt.c | 2 +- sysdeps/aarch64/fpu/fesetenv.c | 2 +- sysdeps/aarch64/fpu/fesetround.c | 2 +- sysdeps/aarch64/fpu/feupdateenv.c | 2 +- sysdeps/aarch64/fpu/fraiseexcpt.c | 2 +- sysdeps/aarch64/fpu/ftestexcept.c | 2 +- sysdeps/arm/Makefile | 4 -- sysdeps/generic/math_ldbl_opt.h | 2 +- sysdeps/i386/i686/multiarch/wcschr-c.c | 4 +- sysdeps/ieee754/float128/s_fabsf128.c | 6 ++ sysdeps/ieee754/ldbl-128/strtold_l.c | 8 +-- sysdeps/ieee754/ldbl-96/strtold_l.c | 4 +- .../power4/multiarch/mempcpy-ppc32.c | 4 +- sysdeps/s390/wcschr-c.c | 4 +- sysdeps/unix/sysv/linux/accept.c | 2 +- sysdeps/unix/sysv/linux/connect.c | 4 +- sysdeps/unix/sysv/linux/dirfd.c | 2 +- sysdeps/unix/sysv/linux/fcntl64.c | 2 +- sysdeps/unix/sysv/linux/getlogin_r.c | 2 +- sysdeps/unix/sysv/linux/getrlimit64.c | 4 +- sysdeps/unix/sysv/linux/if_index.c | 8 +-- sysdeps/unix/sysv/linux/ifaddrs.c | 4 +- sysdeps/unix/sysv/linux/lseek64.c | 2 +- sysdeps/unix/sysv/linux/mmap64.c | 4 +- sysdeps/unix/sysv/linux/pread64.c | 2 +- sysdeps/unix/sysv/linux/pwrite64.c | 2 +- sysdeps/unix/sysv/linux/read.c | 4 +- sysdeps/unix/sysv/linux/recv.c | 4 +- sysdeps/unix/sysv/linux/send.c | 4 +- sysdeps/unix/sysv/linux/write.c | 4 +- sysdeps/wordsize-64/Makefile | 4 +- sysdeps/wordsize-64/strtol.c | 10 +-- sysdeps/wordsize-64/strtoul.c | 6 +- sysdeps/wordsize-64/wcstol.c | 6 +- sysdeps/wordsize-64/wcstoul.c | 6 +- sysdeps/x86_64/fpu/fclrexcpt.c | 2 +- sysdeps/x86_64/fpu/fegetenv.c | 2 +- sysdeps/x86_64/fpu/fegetround.c | 2 +- sysdeps/x86_64/fpu/feholdexcpt.c | 2 +- sysdeps/x86_64/fpu/fesetenv.c | 2 +- sysdeps/x86_64/fpu/fesetround.c | 2 +- sysdeps/x86_64/fpu/fraiseexcpt.c | 2 +- sysdeps/x86_64/fpu/ftestexcept.c | 2 +- sysdeps/x86_64/fpu/multiarch/s_exp10m1f.c | 1 + sysdeps/x86_64/fpu/multiarch/s_exp2m1f.c | 1 + sysdeps/x86_64/fpu/multiarch/s_sincos.c | 1 + sysdeps/x86_64/multiarch/mempcpy.c | 2 +- sysdeps/x86_64/multiarch/stpcpy.c | 2 +- sysdeps/x86_64/multiarch/strnlen.c | 2 +- sysdeps/x86_64/multiarch/wcschr.c | 2 +- sysdeps/x86_64/multiarch/wmemchr.c | 2 +- sysdeps/x86_64/multiarch/wmemset.c | 2 +- termios/Makefile | 1 - time/Makefile | 1 - time/mktime.c | 2 +- wcsmbs/Makefile | 24 +++---- wcsmbs/mbrtowc.c | 2 +- wcsmbs/wcrtomb.c | 2 +- wcsmbs/wcschr.c | 2 +- wcsmbs/wmemchr.c | 2 +- wcsmbs/wmemset.c | 2 +- wctype/Makefile | 2 - wctype/wcfuncs.c | 6 +- 118 files changed, 180 insertions(+), 318 deletions(-) diff --git a/Makefile.in b/Makefile.in index 15b44842ae..e40dcbbc78 100644 --- a/Makefile.in +++ b/Makefile.in @@ -5,7 +5,6 @@ TEST_CXX = @TEST_CXX@ test-cc-option-wimplicit-fallthrough = @libc_cv_test_cc_wimplicit_fallthrough@ test-config-cflags-mprefer-vector-width = @libc_cv_test_cc_mprefer_vector_width@ test-config-cflags-signaling-nans = @libc_cv_test_cc_signaling_nans@ -test-config-cflags-wno-ignored-attributes = @libc_cv_test_wno_ignored_attributes@ test-cc-option-wfree-labels = @libc_cv_test_cc_wfree_labels@ test-cc-option-wmissing-parameter-name = @libc_cv_test_cc_wmissing_parameter_name@ test-enable-cet = @test_enable_cet@ @@ -26,7 +25,6 @@ check xcheck test: cc-option-wimplicit-fallthrough="$(test-cc-option-wimplicit-fallthrough)" \ config-cflags-mprefer-vector-width="$(test-config-cflags-mprefer-vector-width)" \ config-cflags-signaling-nans="$(test-config-cflags-signaling-nans)" \ - config-cflags-wno-ignored-attributes="$(test-config-cflags-wno-ignored-attributes)" \ cc-option-wfree-labels="$(test-cc-option-wfree-labels)" \ cc-option-wmissing-parameter-name="$(test-cc-option-wmissing-parameter-name)" \ enable-cet="$(test-enable-cet)" \ diff --git a/benchtests/bench-memset.c b/benchtests/bench-memset.c index f767ed1dbf..9fc424cfa2 100644 --- a/benchtests/bench-memset.c +++ b/benchtests/bench-memset.c @@ -148,6 +148,7 @@ test_main (void) #define libc_hidden_def(X) #define libc_hidden_weak(X) #define weak_alias(X,Y) +#define static_weak_alias(X,Y) #ifndef WIDE # undef MEMSET # define MEMSET generic_memset diff --git a/configure b/configure index d5bd639586..7883e8c99c 100755 --- a/configure +++ b/configure @@ -655,7 +655,6 @@ libc_cv_cc_loop_to_function libc_cv_test_cc_signaling_nans libc_cv_cc_submachine libc_cv_cc_nofma -libc_cv_test_wno_ignored_attributes libc_cv_has_glob_dat libc_cv_fpie libc_cv_test_static_pie @@ -7544,75 +7543,6 @@ rm -f conftest* config_vars="$config_vars have-test-mtls-traditional = $libc_cv_test_mtls_traditional" -conftest_code=" -void __foo (void) -{ -} -extern __typeof (__foo) foo __attribute__ ((weak, alias (\"__foo\"))); -extern __typeof (__foo) bar __attribute__ ((weak, alias (\"foo\"))); -" - -cat > conftest.c <&5 -printf %s "checking if -Wno-ignored-attributes is required for aliases... " >&6; } -if test ${libc_cv_wno_ignored_attributes+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -c -Werror -Wno-ignored-attributes conftest.c -o conftest 1>&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } - then - libc_cv_wno_ignored_attributes="-Wno-ignored-attributes" - else - libc_cv_wno_ignored_attributes= - fi - ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_wno_ignored_attributes" >&5 -printf "%s\n" "$libc_cv_wno_ignored_attributes" >&6; } -if test "$TEST_CC" = "$CC"; then - libc_cv_test_wno_ignored_attributes=$libc_cv_wno_ignored_attributes -else - -saved_CC="$CC" -CC="$TEST_CC" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if -Wno-ignored-attributes is required for aliases in testing" >&5 -printf %s "checking if -Wno-ignored-attributes is required for aliases in testing... " >&6; } -if test ${libc_cv_test_wno_ignored_attributes+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -c -Werror -Wno-ignored-attributes conftest.c -o conftest 1>&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } - then - libc_cv_test_wno_ignored_attributes="-Wno-ignored-attributes" - else - libc_cv_test_wno_ignored_attributes= - fi ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_test_wno_ignored_attributes" >&5 -printf "%s\n" "$libc_cv_test_wno_ignored_attributes" >&6; } - -CC="$saved_CC" - -fi -rm -f conftest* -config_vars="$config_vars -config-cflags-wno-ignored-attributes = $libc_cv_wno_ignored_attributes" - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -Wno-maybe-uninitialized" >&5 printf %s "checking for -Wno-maybe-uninitialized... " >&6; } if test ${libc_cv_wno_maybe_uninitialized+y} diff --git a/configure.ac b/configure.ac index aaf686494a..8771a738fa 100644 --- a/configure.ac +++ b/configure.ac @@ -1420,30 +1420,6 @@ LIBC_TRY_TEST_CC_COMMAND([for traditional tls support], LIBC_CONFIG_VAR([have-test-mtls-traditional], [$libc_cv_test_mtls_traditional]) -dnl clang emits an warning for a double alias redirection, to warn the -dnl original symbol is sed even when weak definition overrides it. -dnl It is a usual pattern for weak_alias, where multiple alias point to -dnl same symbol. -conftest_code=" -void __foo (void) -{ -} -extern __typeof (__foo) foo __attribute__ ((weak, alias (\"__foo\"))); -extern __typeof (__foo) bar __attribute__ ((weak, alias (\"foo\"))); -" -LIBC_TRY_CC_AND_TEST_CC_COMMAND([if -Wno-ignored-attributes is required for aliases], - [$conftest_code], - [-c -Werror -Wno-ignored-attributes], - libc_cv_wno_ignored_attributes, - [libc_cv_wno_ignored_attributes="-Wno-ignored-attributes"], - [libc_cv_wno_ignored_attributes=], - libc_cv_test_wno_ignored_attributes, - [libc_cv_test_wno_ignored_attributes="-Wno-ignored-attributes"], - [libc_cv_test_wno_ignored_attributes=]) -LIBC_CONFIG_VAR([config-cflags-wno-ignored-attributes], - [$libc_cv_wno_ignored_attributes]) -AC_SUBST(libc_cv_test_wno_ignored_attributes) - AC_CACHE_CHECK([for -Wno-maybe-uninitialized], libc_cv_wno_maybe_uninitialized, [dnl LIBC_TRY_CC_OPTION([-Werror -Wno-maybe-uninitialized], diff --git a/dirent/Makefile b/dirent/Makefile index f469b7f25d..242fd4941a 100644 --- a/dirent/Makefile +++ b/dirent/Makefile @@ -85,7 +85,6 @@ CFLAGS-scandir.c += $(uses-callbacks) CFLAGS-scandir64.c += $(uses-callbacks) CFLAGS-scandir-tail.c += $(uses-callbacks) CFLAGS-scandir64-tail.c += $(uses-callbacks) -CFLAGS-dirfd.c += $(config-cflags-wno-ignored-attributes) include ../Rules diff --git a/include/libc-symbols.h b/include/libc-symbols.h index 2f9453e0d7..5bee0c4311 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -156,6 +156,16 @@ extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))) \ __attribute_copy__ (name); +/* Define a strong_alias for SHARED, or weak_alias otherwise. It is + used to avoid potential compiler warnings with weak alias indirection + (when weak alias will always resolved to an symbol even if a weak + definition also exists). */ +# ifdef SHARED +# define static_weak_alias(name, aliasname) strong_alias (name, aliasname) +# else +# define static_weak_alias(name, aliasname) weak_alias (name, aliasname) +# endif + /* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */ # define weak_extern(symbol) _weak_extern (weak symbol) # define _weak_extern(expr) _Pragma (#expr) diff --git a/inet/Makefile b/inet/Makefile index 104b5828bf..a572936086 100644 --- a/inet/Makefile +++ b/inet/Makefile @@ -124,9 +124,6 @@ ifeq ($(have-thread-library),yes) CFLAGS-rcmd.c += -fexceptions CFLAGS-either_ntoh.c += -fexceptions CFLAGS-either_hton.c += -fexceptions -CFLAGS-in6_addr.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-if_index.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-ifaddrs.c += $(config-cflags-wno-ignored-attributes) CFLAGS-tst-checks-posix.c += -std=c99 CFLAGS-tst-sockaddr.c += -fno-strict-aliasing diff --git a/inet/in6_addr.c b/inet/in6_addr.c index df99e4a23d..f7f39fe395 100644 --- a/inet/in6_addr.c +++ b/inet/in6_addr.c @@ -20,10 +20,10 @@ const struct in6_addr __in6addr_any = { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }; libc_hidden_data_def (__in6addr_any) -weak_alias (__in6addr_any, in6addr_any) +static_weak_alias (__in6addr_any, in6addr_any) libc_hidden_data_weak (in6addr_any) const struct in6_addr __in6addr_loopback = { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }; libc_hidden_data_def (__in6addr_loopback) -weak_alias (__in6addr_loopback, in6addr_loopback) +static_weak_alias (__in6addr_loopback, in6addr_loopback) libc_hidden_data_weak (in6addr_loopback) diff --git a/io/Makefile b/io/Makefile index 269a3151a2..fd156fc201 100644 --- a/io/Makefile +++ b/io/Makefile @@ -267,21 +267,20 @@ endif include ../Rules -CFLAGS-open.c += -fexceptions -fasynchronous-unwind-tables $(config-cflags-wno-ignored-attributes) -CFLAGS-openat.c += $(config-cflags-wno-ignored-attributes) +CFLAGS-open.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-open64.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-creat.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-creat64.c += -fexceptions -fasynchronous-unwind-tables -CFLAGS-fcntl.c += -fexceptions -fasynchronous-unwind-tables $(config-cflags-wno-ignored-attributes) -CFLAGS-fcntl64.c += -fexceptions -fasynchronous-unwind-tables $(config-cflags-wno-ignored-attributes) +CFLAGS-fcntl.c += -fexceptions -fasynchronous-unwind-tables +CFLAGS-fcntl64.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-poll.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-ppoll.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-lockf.c += -fexceptions -fasynchronous-unwind-tables -CFLAGS-lockf64.c += -fexceptions -fasynchronous-unwind-tables $(config-cflags-wno-ignored-attributes) +CFLAGS-lockf64.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-statfs.c += -fexceptions CFLAGS-fstatfs.c += -fexceptions -CFLAGS-statvfs.c += -fexceptions $(config-cflags-wno-ignored-attributes) -CFLAGS-fstatvfs.c += -fexceptions $(config-cflags-wno-ignored-attributes) +CFLAGS-statvfs.c += -fexceptions +CFLAGS-fstatvfs.c += -fexceptions CFLAGS-fts.c += -Wno-uninitialized $(uses-callbacks) -fexceptions CFLAGS-fts64.c += -Wno-uninitialized $(uses-callbacks) -fexceptions CFLAGS-fts64-time64.c += -Wno-uninitialized $(uses-callbacks) -fexceptions @@ -292,10 +291,9 @@ CFLAGS-posix_fallocate.c += -fexceptions CFLAGS-posix_fallocate64.c += -fexceptions CFLAGS-fallocate.c += -fexceptions CFLAGS-fallocate64.c += -fexceptions -CFLAGS-read.c += -fexceptions -fasynchronous-unwind-tables $(config-cflags-wno-ignored-attributes) -CFLAGS-write.c += -fexceptions -fasynchronous-unwind-tables $(config-cflags-wno-ignored-attributes) +CFLAGS-read.c += -fexceptions -fasynchronous-unwind-tables +CFLAGS-write.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-close.c += -fexceptions -fasynchronous-unwind-tables -CFLAGS-lseek64.c += $(config-cflags-wno-ignored-attributes) CFLAGS-tst-read-zero.c += $(no-fortify-source) -D_FORTIFY_SOURCE=$(supported-fortify) CFLAGS-test-stat.c += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE diff --git a/io/Versions b/io/Versions index 04d196eee0..e5f297e39e 100644 --- a/io/Versions +++ b/io/Versions @@ -138,7 +138,6 @@ libc { closefrom; } GLIBC_PRIVATE { - __libc_fcntl64; __fcntl_nocancel; __open64_nocancel; __write_nocancel; diff --git a/io/lockf64.c b/io/lockf64.c index c490730d1f..354665cea8 100644 --- a/io/lockf64.c +++ b/io/lockf64.c @@ -58,5 +58,5 @@ __lockf64 (int fd, int cmd, off64_t len64) } weak_alias (__lockf64, lockf64) #ifdef __OFF_T_MATCHES_OFF64_T -weak_alias (lockf64, lockf) +weak_alias (__lockf64, lockf) #endif diff --git a/libio/Makefile b/libio/Makefile index 6ce669e103..2bc9836522 100644 --- a/libio/Makefile +++ b/libio/Makefile @@ -198,18 +198,18 @@ CFLAGS-getchar.c += -fexceptions CFLAGS-getwc.c += -fexceptions CFLAGS-getwchar.c += -fexceptions CFLAGS-iofclose.c += -fexceptions -CFLAGS-iofflush.c += -fexceptions $(config-cflags-wno-ignored-attributes) +CFLAGS-iofflush.c += -fexceptions CFLAGS-iofgetpos64.c += -fexceptions CFLAGS-iofgetpos.c += -fexceptions CFLAGS-iofgets.c += -fexceptions CFLAGS-iofgetws.c += -fexceptions -CFLAGS-iofputs.c += -fexceptions $(config-cflags-wno-ignored-attributes) +CFLAGS-iofputs.c += -fexceptions CFLAGS-iofputws.c += -fexceptions CFLAGS-iofread.c += -fexceptions CFLAGS-iofsetpos64.c += -fexceptions CFLAGS-iofsetpos.c += -fexceptions CFLAGS-ioftell.c += -fexceptions -CFLAGS-iofwrite.c += -fexceptions $(config-cflags-wno-ignored-attributes) +CFLAGS-iofwrite.c += -fexceptions CFLAGS-iogetdelim.c += -fexceptions CFLAGS-iogetline.c += -fexceptions CFLAGS-iogets.c += -fexceptions @@ -239,14 +239,6 @@ CFLAGS-oldiofopen.c += -fexceptions CFLAGS-iofopen.c += -fexceptions CFLAGS-iofopen64.c += -fexceptions CFLAGS-oldtmpfile.c += -fexceptions -CFLAGS-fileno.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-feof_u.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-ferror_u.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-getc_u.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-iofflush_u.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-putc_u.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-iofgets_u.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-iofputs_u.c += $(config-cflags-wno-ignored-attributes) # XXX Do we need filedoalloc and wfiledoalloc? Others? # Prevent fortification as these are built with -O0 diff --git a/libio/feof_u.c b/libio/feof_u.c index 4d2babe362..36a1e5b628 100644 --- a/libio/feof_u.c +++ b/libio/feof_u.c @@ -35,5 +35,5 @@ __feof_unlocked (FILE *fp) CHECK_FILE (fp, EOF); return _IO_feof_unlocked (fp); } -weak_alias (__feof_unlocked, feof_unlocked) +static_weak_alias (__feof_unlocked, feof_unlocked) libc_hidden_weak (feof_unlocked) diff --git a/libio/ferror_u.c b/libio/ferror_u.c index 0e19e0c198..d81facfac4 100644 --- a/libio/ferror_u.c +++ b/libio/ferror_u.c @@ -35,5 +35,5 @@ __ferror_unlocked (FILE *fp) CHECK_FILE (fp, EOF); return _IO_ferror_unlocked (fp); } -weak_alias (__ferror_unlocked, ferror_unlocked) +static_weak_alias (__ferror_unlocked, ferror_unlocked) libc_hidden_weak (ferror_unlocked) diff --git a/libio/fileno.c b/libio/fileno.c index d1e945f549..d580582b4d 100644 --- a/libio/fileno.c +++ b/libio/fileno.c @@ -41,7 +41,7 @@ __fileno (FILE *fp) return _IO_fileno (fp); } libc_hidden_def (__fileno) -weak_alias (__fileno, fileno) +static_weak_alias (__fileno, fileno) libc_hidden_weak (fileno) /* The fileno implementation for libio does not require locking because diff --git a/libio/getc_u.c b/libio/getc_u.c index cfd052d7c2..ea57c7d049 100644 --- a/libio/getc_u.c +++ b/libio/getc_u.c @@ -36,6 +36,6 @@ __getc_unlocked (FILE *fp) return _IO_getc_unlocked (fp); } -weak_alias (__getc_unlocked, getc_unlocked) +static_weak_alias (__getc_unlocked, getc_unlocked) libc_hidden_weak (getc_unlocked) weak_alias (__getc_unlocked, fgetc_unlocked) diff --git a/libio/iofflush.c b/libio/iofflush.c index 3683c93e15..6165493c31 100644 --- a/libio/iofflush.c +++ b/libio/iofflush.c @@ -44,7 +44,7 @@ _IO_fflush (FILE *fp) } libc_hidden_def (_IO_fflush) -weak_alias (_IO_fflush, fflush) +static_weak_alias (_IO_fflush, fflush) libc_hidden_weak (fflush) #ifndef _IO_MTSAFE_IO diff --git a/libio/iofflush_u.c b/libio/iofflush_u.c index cd9e4afd80..5690db5a44 100644 --- a/libio/iofflush_u.c +++ b/libio/iofflush_u.c @@ -39,5 +39,5 @@ __fflush_unlocked (FILE *fp) } } libc_hidden_def (__fflush_unlocked) -weak_alias (__fflush_unlocked, fflush_unlocked) +static_weak_alias (__fflush_unlocked, fflush_unlocked) libc_hidden_weak (fflush_unlocked) diff --git a/libio/iofgets_u.c b/libio/iofgets_u.c index b9ac6b9640..86e6ca55b7 100644 --- a/libio/iofgets_u.c +++ b/libio/iofgets_u.c @@ -63,5 +63,5 @@ __fgets_unlocked (char *buf, int n, FILE *fp) return result; } libc_hidden_def (__fgets_unlocked) -weak_alias (__fgets_unlocked, fgets_unlocked) +static_weak_alias (__fgets_unlocked, fgets_unlocked) libc_hidden_weak (fgets_unlocked) diff --git a/libio/iofputs.c b/libio/iofputs.c index 0a7e0b4b3e..f90830f751 100644 --- a/libio/iofputs.c +++ b/libio/iofputs.c @@ -42,7 +42,7 @@ _IO_fputs (const char *str, FILE *fp) } libc_hidden_def (_IO_fputs) -weak_alias (_IO_fputs, fputs) +static_weak_alias (_IO_fputs, fputs) libc_hidden_weak (fputs) # ifndef _IO_MTSAFE_IO diff --git a/libio/iofputs_u.c b/libio/iofputs_u.c index b283f488e8..dc4bd55514 100644 --- a/libio/iofputs_u.c +++ b/libio/iofputs_u.c @@ -39,5 +39,5 @@ __fputs_unlocked (const char *str, FILE *fp) return result; } libc_hidden_def (__fputs_unlocked) -weak_alias (__fputs_unlocked, fputs_unlocked) +static_weak_alias (__fputs_unlocked, fputs_unlocked) libc_hidden_weak (fputs_unlocked) diff --git a/libio/iofwrite.c b/libio/iofwrite.c index 7897c4afaf..c88c91a4d4 100644 --- a/libio/iofwrite.c +++ b/libio/iofwrite.c @@ -79,7 +79,7 @@ _IO_fwrite (const void *buf, size_t size, size_t count, FILE *fp) libc_hidden_def (_IO_fwrite) # include -weak_alias (_IO_fwrite, fwrite) +static_weak_alias (_IO_fwrite, fwrite) libc_hidden_weak (fwrite) # ifndef _IO_MTSAFE_IO weak_alias (_IO_fwrite, fwrite_unlocked) diff --git a/libio/ioputs.c b/libio/ioputs.c index 8baf502185..3e57e319d0 100644 --- a/libio/ioputs.c +++ b/libio/ioputs.c @@ -45,5 +45,5 @@ _IO_puts (const char *str) return result; } -weak_alias (_IO_puts, puts) +static_weak_alias (_IO_puts, puts) libc_hidden_def (_IO_puts) diff --git a/libio/putc_u.c b/libio/putc_u.c index 609ef42b6a..d8f1562eb4 100644 --- a/libio/putc_u.c +++ b/libio/putc_u.c @@ -26,5 +26,5 @@ __putc_unlocked (int c, FILE *fp) CHECK_FILE (fp, EOF); return _IO_putc_unlocked (c, fp); } -weak_alias (__putc_unlocked, putc_unlocked) +static_weak_alias (__putc_unlocked, putc_unlocked) libc_hidden_weak (putc_unlocked) diff --git a/login/Makefile b/login/Makefile index d6a9a6975e..e6b5a1fff4 100644 --- a/login/Makefile +++ b/login/Makefile @@ -110,7 +110,6 @@ endif # $(have-GLIBC_2.33) include ../Rules CFLAGS-getpt.c += -fexceptions -CFLAGS-getlogin_r.c += $(config-cflags-wno-ignored-attributes) # Exclude fortified routines from being built with _FORTIFY_SOURCE routines_no_fortify += \ diff --git a/misc/Makefile b/misc/Makefile index e792d94ebd..d6514ca5d3 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -341,8 +341,6 @@ CFLAGS-tst-tsearch.c += $(stack-align-test-flags) CFLAGS-msync.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-fdatasync.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-fsync.c += -fexceptions -fasynchronous-unwind-tables -CFLAGS-makedev.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-mmap64.c += $(config-cflags-wno-ignored-attributes) # Called during static library initialization, so turn stack-protection # off for non-shared builds. diff --git a/misc/makedev.c b/misc/makedev.c index e7a0029f1d..3ad6dcb0aa 100644 --- a/misc/makedev.c +++ b/misc/makedev.c @@ -26,11 +26,11 @@ rtype __gnu_dev_##name proto __SYSMACROS_DEFINE_MAJOR(OUT_OF_LINE_IMPL_TEMPL) -weak_alias (__gnu_dev_major, gnu_dev_major) +static_weak_alias (__gnu_dev_major, gnu_dev_major) libc_hidden_weak (gnu_dev_major) __SYSMACROS_DEFINE_MINOR(OUT_OF_LINE_IMPL_TEMPL) -weak_alias (__gnu_dev_minor, gnu_dev_minor) +static_weak_alias (__gnu_dev_minor, gnu_dev_minor) libc_hidden_weak (gnu_dev_minor) __SYSMACROS_DEFINE_MAKEDEV(OUT_OF_LINE_IMPL_TEMPL) -weak_alias (__gnu_dev_makedev, gnu_dev_makedev) +static_weak_alias (__gnu_dev_makedev, gnu_dev_makedev) libc_hidden_weak (gnu_dev_makedev) diff --git a/posix/Makefile b/posix/Makefile index f6421e5379..062e7fdc20 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -568,9 +568,9 @@ $(objpfx)config-name.h: $(..)scripts/config-uname.sh $(common-objpfx)config.make CFLAGS-pause.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-pread.c += -fexceptions -fasynchronous-unwind-tables -CFLAGS-pread64.c += -fexceptions -fasynchronous-unwind-tables $(config-cflags-wno-ignored-attributes) +CFLAGS-pread64.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-pwrite.c += -fexceptions -fasynchronous-unwind-tables -CFLAGS-pwrite64.c += -fexceptions -fasynchronous-unwind-tables $(config-cflags-wno-ignored-attributes) +CFLAGS-pwrite64.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-sleep.c += -fexceptions CFLAGS-wait.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-waitid.c += -fexceptions -fasynchronous-unwind-tables @@ -599,7 +599,7 @@ CFLAGS-execl.os = -fomit-frame-pointer CFLAGS-execvp.os = -fomit-frame-pointer CFLAGS-execlp.os = -fomit-frame-pointer CFLAGS-nanosleep.c += -fexceptions -fasynchronous-unwind-tables -CFLAGS-fork.c = $(libio-mtsafe) $(config-cflags-wno-ignored-attributes) +CFLAGS-fork.c = $(libio-mtsafe) tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \ --none random --col --color --colour diff --git a/posix/confstr.c b/posix/confstr.c index 415905b269..1f41e14193 100644 --- a/posix/confstr.c +++ b/posix/confstr.c @@ -291,4 +291,4 @@ __confstr (int name, char *buf, size_t len) } libc_hidden_def (__confstr) libc_hidden_def (confstr) -weak_alias (__confstr, confstr) +static_weak_alias (__confstr, confstr) diff --git a/posix/fork.c b/posix/fork.c index 011e92fc1d..dfd413051e 100644 --- a/posix/fork.c +++ b/posix/fork.c @@ -137,6 +137,6 @@ __libc_fork (void) return pid; } -weak_alias (__libc_fork, __fork) +strong_alias (__libc_fork, __fork) libc_hidden_def (__fork) weak_alias (__libc_fork, fork) diff --git a/resolv/Makefile b/resolv/Makefile index ebb06cb14a..d294c3f3fc 100644 --- a/resolv/Makefile +++ b/resolv/Makefile @@ -249,7 +249,6 @@ LOCALES := en_US.UTF-8 en_US.ISO-8859-1 include ../gen-locales.mk CFLAGS-res_hconf.c += -fexceptions -CFLAGS-inet_pton.c += $(config-cflags-wno-ignored-attributes) # The DNS NSS modules needs the resolver. $(objpfx)libnss_dns.so: $(objpfx)libresolv.so diff --git a/resolv/inet_pton.c b/resolv/inet_pton.c index 5307a5b243..901bc3fb54 100644 --- a/resolv/inet_pton.c +++ b/resolv/inet_pton.c @@ -43,5 +43,5 @@ __inet_pton (int af, const char *src, void *dst) return __inet_pton_length (af, src, strlen (src), dst); } libc_hidden_def (__inet_pton) -weak_alias (__inet_pton, inet_pton) +static_weak_alias (__inet_pton, inet_pton) libc_hidden_weak (inet_pton) diff --git a/resource/Makefile b/resource/Makefile index 9b4998107f..55982ebeed 100644 --- a/resource/Makefile +++ b/resource/Makefile @@ -32,6 +32,3 @@ tests := \ include ../Rules - -CFLAGS-getrlimit64.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-getrlimit.c += $(config-cflags-wno-ignored-attributes) diff --git a/socket/Makefile b/socket/Makefile index 70fd4138b9..bc39579682 100644 --- a/socket/Makefile +++ b/socket/Makefile @@ -87,11 +87,11 @@ aux := sa_len include ../Rules -CFLAGS-recv.c += -fexceptions -fasynchronous-unwind-tables $(config-cflags-wno-ignored-attributes) +CFLAGS-recv.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-recvfrom.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-sendto.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-recvmsg.c += -fexceptions -fasynchronous-unwind-tables -CFLAGS-sendmsg.c += -fexceptions -fasynchronous-unwind-tables $(config-cflags-wno-ignored-attributes) -CFLAGS-send.c += -fexceptions -fasynchronous-unwind-tables $(config-cflags-wno-ignored-attributes) -CFLAGS-connect.c += -fexceptions -fasynchronous-unwind-tables $(config-cflags-wno-ignored-attributes) -CFLAGS-accept.c += -fexceptions -fasynchronous-unwind-tables $(config-cflags-wno-ignored-attributes) +CFLAGS-sendmsg.c += -fexceptions -fasynchronous-unwind-tables +CFLAGS-send.c += -fexceptions -fasynchronous-unwind-tables +CFLAGS-connect.c += -fexceptions -fasynchronous-unwind-tables +CFLAGS-accept.c += -fexceptions -fasynchronous-unwind-tables diff --git a/stdio-common/Makefile b/stdio-common/Makefile index cb816de335..ddffe653e9 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -717,8 +717,6 @@ CFLAGS-isoc23_vscanf.c += -fexceptions CFLAGS-isoc23_fscanf.c += -fexceptions CFLAGS-isoc23_scanf.c += -fexceptions -CFLAGS-dprintf.c += $(config-cflags-wno-ignored-attributes) - # Called during static library initialization, so turn stack-protection # off for non-shared builds. CFLAGS-_itoa.o = $(no-stack-protector) diff --git a/stdlib/Makefile b/stdlib/Makefile index 02ad6d17fb..eac764f584 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -542,18 +542,6 @@ CFLAGS-strfromd.c += $(libio-mtsafe) CFLAGS-strfromf.c += $(libio-mtsafe) CFLAGS-strfroml.c += $(libio-mtsafe) -CFLAGS-strtol.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-strtoul.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-strtoll.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-strtoull.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-strtof.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-strtof_l.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-strtod.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-strtod_l.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-strtold.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-strtold_l.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-secure-getenv.c += $(config-cflags-wno-ignored-attributes) - CFLAGS-tst-bsearch.c += $(stack-align-test-flags) CFLAGS-tst-qsort.c += $(stack-align-test-flags) CFLAGS-tst-makecontext.c += -funwind-tables diff --git a/stdlib/secure-getenv.c b/stdlib/secure-getenv.c index a2408a304f..b16efcb40e 100644 --- a/stdlib/secure-getenv.c +++ b/stdlib/secure-getenv.c @@ -29,7 +29,7 @@ __libc_secure_getenv (const char *name) return __libc_enable_secure ? NULL : getenv (name); } weak_alias (__libc_secure_getenv, secure_getenv) -libc_hidden_weak (__libc_secure_getenv) +libc_hidden_def (__libc_secure_getenv) #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_17) compat_symbol (libc, __libc_secure_getenv, __secure_getenv, GLIBC_2_0); diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c index d00a336589..3988049f7e 100644 --- a/stdlib/strtod_l.c +++ b/stdlib/strtod_l.c @@ -1785,7 +1785,7 @@ __STRTOF (const STRING_TYPE *nptr, STRING_TYPE **endptr, locale_t loc) libc_hidden_def (__STRTOF) libc_hidden_ver (__STRTOF, STRTOF) #endif -weak_alias (__STRTOF, STRTOF) +static_weak_alias (__STRTOF, STRTOF) #ifdef LONG_DOUBLE_COMPAT # if LONG_DOUBLE_COMPAT(libc, GLIBC_2_1) @@ -1809,18 +1809,18 @@ compat_symbol (libc, strtod_l, strtold_l, GLIBC_2_3); # undef strtof64_l # undef wcstof64_l # ifdef USE_WIDE_CHAR -weak_alias (wcstod_l, wcstof64_l) +weak_alias (__wcstod_l, wcstof64_l) # else -weak_alias (strtod_l, strtof64_l) +weak_alias (__strtod_l, strtof64_l) # endif # endif # if __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X # undef strtof32x_l # undef wcstof32x_l # ifdef USE_WIDE_CHAR -weak_alias (wcstod_l, wcstof32x_l) +weak_alias (__wcstod_l, wcstof32x_l) # else -weak_alias (strtod_l, strtof32x_l) +weak_alias (__strtod_l, strtof32x_l) # endif # endif #endif diff --git a/stdlib/strtof_l.c b/stdlib/strtof_l.c index 2ec5f576cf..966db79725 100644 --- a/stdlib/strtof_l.c +++ b/stdlib/strtof_l.c @@ -47,8 +47,8 @@ extern float ____strtof_l_internal (const char *, char **, int, locale_t); # undef strtof32_l # undef wcstof32_l # ifdef USE_WIDE_CHAR -weak_alias (wcstof_l, wcstof32_l) +weak_alias (__wcstof_l, wcstof32_l) # else -weak_alias (strtof_l, strtof32_l) +weak_alias (__strtof_l, strtof32_l) # endif #endif diff --git a/stdlib/strtol.c b/stdlib/strtol.c index 155bfe166d..5b4e9d1cd9 100644 --- a/stdlib/strtol.c +++ b/stdlib/strtol.c @@ -117,7 +117,7 @@ __strtol (const STRING_TYPE *nptr, STRING_TYPE **endptr, int base) return INTERNAL (__strtol_l) (nptr, endptr, base, 0, false, _NL_CURRENT_LOCALE); } -weak_alias (__strtol, strtol) +static_weak_alias (__strtol, strtol) libc_hidden_weak (strtol) INT diff --git a/string/Makefile b/string/Makefile index d842ae0457..2f30e66df5 100644 --- a/string/Makefile +++ b/string/Makefile @@ -285,15 +285,6 @@ CFLAGS-wordcopy.c += $(no-stack-protector) CFLAGS-strncmp.c += $(no-stack-protector) CFLAGS-memset.c += $(no-stack-protector) -CFLAGS-argz-next.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-basename.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-ffs.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-memmem.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-memchr.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-mempcpy.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-stpcpy.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-strnlen.c += $(config-cflags-wno-ignored-attributes) - ifeq ($(run-built-tests),yes) $(objpfx)tst-svc-cmp.out: tst-svc.expect $(objpfx)tst-svc.out cmp $^ > $@; \ diff --git a/string/argz-next.c b/string/argz-next.c index aac67a9d1c..be567cf573 100644 --- a/string/argz-next.c +++ b/string/argz-next.c @@ -36,5 +36,5 @@ __argz_next (const char *argz, size_t argz_len, const char *entry) return NULL; } libc_hidden_def (__argz_next) -weak_alias (__argz_next, argz_next) +static_weak_alias (__argz_next, argz_next) libc_hidden_weak (argz_next) diff --git a/string/basename.c b/string/basename.c index dd2c8182db..ca45ca8ae9 100644 --- a/string/basename.c +++ b/string/basename.c @@ -25,5 +25,5 @@ __basename (const char *filename) return p ? p + 1 : (char *) filename; } libc_hidden_def (__basename) -weak_alias (__basename, basename) +static_weak_alias (__basename, basename) libc_hidden_weak (basename) diff --git a/string/ffs.c b/string/ffs.c index a2aa5b1242..7010059833 100644 --- a/string/ffs.c +++ b/string/ffs.c @@ -47,7 +47,7 @@ __ffs (int i) return table[x >> a] + a; #endif } -weak_alias (__ffs, ffs) +static_weak_alias (__ffs, ffs) libc_hidden_def (__ffs) libc_hidden_builtin_def (ffs) diff --git a/string/ffsll.c b/string/ffsll.c index 1b01d8fb12..6794de1c2a 100644 --- a/string/ffsll.c +++ b/string/ffsll.c @@ -37,9 +37,9 @@ __ffsll (long long int i) return 32 + ffs (i >> 32); #endif } -weak_alias (__ffsll, ffsll) +static_weak_alias (__ffsll, ffsll) #if ULONG_MAX != UINT_MAX #undef ffsl -weak_alias (ffsll, ffsl) +static_weak_alias (__ffsll, ffsl) #endif diff --git a/string/memmem.c b/string/memmem.c index 8d9b7d196e..febb50b605 100644 --- a/string/memmem.c +++ b/string/memmem.c @@ -125,5 +125,5 @@ __memmem (const void *haystack, size_t hs_len, return NULL; } libc_hidden_def (__memmem) -weak_alias (__memmem, memmem) +static_weak_alias (__memmem, memmem) libc_hidden_weak (memmem) diff --git a/string/mempcpy.c b/string/mempcpy.c index efbc9d42f1..1199f124ed 100644 --- a/string/mempcpy.c +++ b/string/mempcpy.c @@ -35,5 +35,5 @@ MEMPCPY (void *dest, const void *src, size_t len) return memcpy (dest, src, len) + len; } libc_hidden_def (__mempcpy) -weak_alias (__mempcpy, mempcpy) +static_weak_alias (__mempcpy, mempcpy) libc_hidden_builtin_def (mempcpy) diff --git a/string/test-memchr.c b/string/test-memchr.c index aaf9a6db29..fbfcd4d17d 100644 --- a/string/test-memchr.c +++ b/string/test-memchr.c @@ -47,8 +47,8 @@ IMPL (MEMCHR, 1) /* Also check the generic implementation. */ #undef MEMCHR -#undef weak_alias -#define weak_alias(a, b) +#undef static_weak_alias +#define static_weak_alias(a, b) #undef libc_hidden_builtin_def #define libc_hidden_builtin_def(a) #undef libc_hidden_def diff --git a/string/test-strchr.c b/string/test-strchr.c index 765d69ecc2..8ea4335ac0 100644 --- a/string/test-strchr.c +++ b/string/test-strchr.c @@ -74,8 +74,8 @@ IMPL (STRCHR, 1) /* Also check the generic implementation. */ #undef STRCHR -#undef weak_alias -#define weak_alias(a, b) +#undef static_weak_alias +#define static_weak_alias(a, b) #undef libc_hidden_builtin_def #define libc_hidden_builtin_def(a) #undef libc_hidden_def diff --git a/string/test-strlen.c b/string/test-strlen.c index 03a8969e54..2b85fc421a 100644 --- a/string/test-strlen.c +++ b/string/test-strlen.c @@ -41,8 +41,8 @@ IMPL (STRLEN, 1) /* Also check the generic implementation. */ #undef STRLEN -#undef weak_alias -#define weak_alias(a, b) +#undef static_weak_alias +#define static_weak_alias(a, b) #undef libc_hidden_builtin_def #define libc_hidden_builtin_def(a) #ifndef WIDE diff --git a/string/test-strnlen.c b/string/test-strnlen.c index acb1c055fc..29d291e66f 100644 --- a/string/test-strnlen.c +++ b/string/test-strnlen.c @@ -47,7 +47,7 @@ typedef size_t (*proto_t) (const CHAR *, size_t); #undef STRNLEN #ifndef WIDE # define MEMCHR __memchr_default -# define weak_alias(a, b) +# define static_weak_alias(a, b) # define libc_hidden_def(a) # define libc_hidden_builtin_def(a) # include "string/memchr.c" @@ -58,7 +58,7 @@ typedef size_t (*proto_t) (const CHAR *, size_t); IMPL (__strnlen_default, 1) #else # define WMEMCHR __wmemchr_default -# define weak_alias(a, b) +# define static_weak_alias(a, b) # define libc_hidden_def(a) # define libc_hidden_weak(a) # include "wcsmbs/wmemchr.c" diff --git a/sysdeps/aarch64/Makefile b/sysdeps/aarch64/Makefile index 29348912e3..b0944d6b21 100644 --- a/sysdeps/aarch64/Makefile +++ b/sysdeps/aarch64/Makefile @@ -58,7 +58,6 @@ endif ifeq ($(subdir),math) CPPFLAGS += -I../soft-fp -CFLAGS-feupdateenv.c += $(config-cflags-wno-ignored-attributes) endif ifeq ($(subdir),misc) diff --git a/sysdeps/aarch64/fpu/fclrexcpt.c b/sysdeps/aarch64/fpu/fclrexcpt.c index 21eb731e29..9f6fc8dd03 100644 --- a/sysdeps/aarch64/fpu/fclrexcpt.c +++ b/sysdeps/aarch64/fpu/fclrexcpt.c @@ -35,6 +35,6 @@ __feclearexcept (int excepts) return 0; } -weak_alias (__feclearexcept, feclearexcept) +static_weak_alias (__feclearexcept, feclearexcept) libm_hidden_def (__feclearexcept) libm_hidden_def (feclearexcept) diff --git a/sysdeps/aarch64/fpu/fegetenv.c b/sysdeps/aarch64/fpu/fegetenv.c index eb8117c61d..76f68e77ef 100644 --- a/sysdeps/aarch64/fpu/fegetenv.c +++ b/sysdeps/aarch64/fpu/fegetenv.c @@ -31,5 +31,5 @@ __fegetenv (fenv_t *envp) return 0; } libm_hidden_def (__fegetenv) -weak_alias (__fegetenv, fegetenv) +static_weak_alias (__fegetenv, fegetenv) libm_hidden_weak (fegetenv) diff --git a/sysdeps/aarch64/fpu/fegetround.c b/sysdeps/aarch64/fpu/fegetround.c index d6758c9879..f5db20165f 100644 --- a/sysdeps/aarch64/fpu/fegetround.c +++ b/sysdeps/aarch64/fpu/fegetround.c @@ -25,5 +25,5 @@ __fegetround (void) return get_rounding_mode (); } libm_hidden_def (__fegetround) -weak_alias (__fegetround, fegetround) +static_weak_alias (__fegetround, fegetround) libm_hidden_weak (fegetround) diff --git a/sysdeps/aarch64/fpu/feholdexcpt.c b/sysdeps/aarch64/fpu/feholdexcpt.c index 79ae5494c6..f1d6ef54e7 100644 --- a/sysdeps/aarch64/fpu/feholdexcpt.c +++ b/sysdeps/aarch64/fpu/feholdexcpt.c @@ -26,5 +26,5 @@ __feholdexcept (fenv_t *envp) return 0; } libm_hidden_def (__feholdexcept) -weak_alias (__feholdexcept, feholdexcept) +static_weak_alias (__feholdexcept, feholdexcept) libm_hidden_weak (feholdexcept) diff --git a/sysdeps/aarch64/fpu/fesetenv.c b/sysdeps/aarch64/fpu/fesetenv.c index 6a0df368c8..9c1d2114d0 100644 --- a/sysdeps/aarch64/fpu/fesetenv.c +++ b/sysdeps/aarch64/fpu/fesetenv.c @@ -74,5 +74,5 @@ __fesetenv (const fenv_t *envp) return 0; } libm_hidden_def (__fesetenv) -weak_alias (__fesetenv, fesetenv) +static_weak_alias (__fesetenv, fesetenv) libm_hidden_weak (fesetenv) diff --git a/sysdeps/aarch64/fpu/fesetround.c b/sysdeps/aarch64/fpu/fesetround.c index cd0c3bcfed..f00437ab5b 100644 --- a/sysdeps/aarch64/fpu/fesetround.c +++ b/sysdeps/aarch64/fpu/fesetround.c @@ -30,5 +30,5 @@ __fesetround (int round) return 0; } libm_hidden_def (__fesetround) -weak_alias (__fesetround, fesetround) +static_weak_alias (__fesetround, fesetround) libm_hidden_weak (fesetround) diff --git a/sysdeps/aarch64/fpu/feupdateenv.c b/sysdeps/aarch64/fpu/feupdateenv.c index 4690e84f21..6117a46443 100644 --- a/sysdeps/aarch64/fpu/feupdateenv.c +++ b/sysdeps/aarch64/fpu/feupdateenv.c @@ -85,5 +85,5 @@ __feupdateenv (const fenv_t *envp) return 0; } libm_hidden_def (__feupdateenv) -weak_alias (__feupdateenv, feupdateenv) +static_weak_alias (__feupdateenv, feupdateenv) libm_hidden_weak (feupdateenv) diff --git a/sysdeps/aarch64/fpu/fraiseexcpt.c b/sysdeps/aarch64/fpu/fraiseexcpt.c index 518a6eb321..9440339c93 100644 --- a/sysdeps/aarch64/fpu/fraiseexcpt.c +++ b/sysdeps/aarch64/fpu/fraiseexcpt.c @@ -90,5 +90,5 @@ __feraiseexcept (int excepts) return 0; } libm_hidden_def (__feraiseexcept) -weak_alias (__feraiseexcept, feraiseexcept) +static_weak_alias (__feraiseexcept, feraiseexcept) libm_hidden_weak (feraiseexcept) diff --git a/sysdeps/aarch64/fpu/ftestexcept.c b/sysdeps/aarch64/fpu/ftestexcept.c index f057616f7f..46150510da 100644 --- a/sysdeps/aarch64/fpu/ftestexcept.c +++ b/sysdeps/aarch64/fpu/ftestexcept.c @@ -25,5 +25,5 @@ __fetestexcept (int excepts) return libc_fetestexcept_aarch64 (excepts); } libm_hidden_def (__fetestexcept) -weak_alias (__fetestexcept, fetestexcept) +static_weak_alias (__fetestexcept, fetestexcept) libm_hidden_def (fetestexcept) diff --git a/sysdeps/arm/Makefile b/sysdeps/arm/Makefile index 9c4fd6b236..d08dade3c5 100644 --- a/sysdeps/arm/Makefile +++ b/sysdeps/arm/Makefile @@ -54,10 +54,6 @@ ifeq ($(subdir),gmon) sysdep_routines += arm-mcount endif -ifeq ($(subdir),math) -CFLAGS-feupdateenv.c += $(config-cflags-wno-ignored-attributes) -endif - ifeq ($(subdir),rt) librt-sysdep_routines += rt-aeabi_unwind_cpp_pr1 rt-arm-unwind-resume librt-shared-only-routines += rt-aeabi_unwind_cpp_pr1 rt-arm-unwind-resume diff --git a/sysdeps/generic/math_ldbl_opt.h b/sysdeps/generic/math_ldbl_opt.h index fbd2c82e2f..0a14c723ca 100644 --- a/sysdeps/generic/math_ldbl_opt.h +++ b/sysdeps/generic/math_ldbl_opt.h @@ -12,6 +12,6 @@ #define long_double_symbol(lib, local, symbol) #define ldbl_hidden_def(local, name) libc_hidden_def (name) #define ldbl_strong_alias(name, aliasname) strong_alias (name, aliasname) -#define ldbl_weak_alias(name, aliasname) weak_alias (name, aliasname) +#define ldbl_weak_alias(name, aliasname) static_weak_alias (name, aliasname) #define ldbl_compat_symbol(lib, local, symbol, version) \ compat_symbol (lib, local, symbol, version) diff --git a/sysdeps/i386/i686/multiarch/wcschr-c.c b/sysdeps/i386/i686/multiarch/wcschr-c.c index 38d41d04de..f99a348624 100644 --- a/sysdeps/i386/i686/multiarch/wcschr-c.c +++ b/sysdeps/i386/i686/multiarch/wcschr-c.c @@ -4,8 +4,8 @@ # undef libc_hidden_weak # define libc_hidden_weak(name) -# undef weak_alias -# define weak_alias(name,alias) +# undef static_weak_alias +# define static_weak_alias(name,alias) # ifdef SHARED # undef libc_hidden_def diff --git a/sysdeps/ieee754/float128/s_fabsf128.c b/sysdeps/ieee754/float128/s_fabsf128.c index d877b0214f..9d64f15040 100644 --- a/sysdeps/ieee754/float128/s_fabsf128.c +++ b/sysdeps/ieee754/float128/s_fabsf128.c @@ -1,4 +1,10 @@ #include +#ifndef __USE_EXTERN_INLINES +# undef libm_alias_float128_r +# define libm_alias_float128_r(from, to, r) \ + static_weak_alias (from ## f128 ## r, to ## f128 ## r); \ + libm_alias_float128_other_r (from, to, r) +#endif #include "../ldbl-128/s_fabsl.c" #ifndef __USE_EXTERN_INLINES libm_hidden_def (fabsf128) diff --git a/sysdeps/ieee754/ldbl-128/strtold_l.c b/sysdeps/ieee754/ldbl-128/strtold_l.c index 64f14c11c7..3366040c77 100644 --- a/sysdeps/ieee754/ldbl-128/strtold_l.c +++ b/sysdeps/ieee754/ldbl-128/strtold_l.c @@ -50,9 +50,9 @@ # undef strtof128_l # undef wcstof128_l # ifdef USE_WIDE_CHAR -weak_alias (wcstold_l, wcstof128_l) +weak_alias (__wcstold_l, wcstof128_l) # else -weak_alias (strtold_l, strtof128_l) +weak_alias (__strtold_l, strtof128_l) # endif #endif @@ -60,8 +60,8 @@ weak_alias (strtold_l, strtof128_l) # undef strtof64x_l # undef wcstof64x_l # ifdef USE_WIDE_CHAR -weak_alias (wcstold_l, wcstof64x_l) +weak_alias (__wcstold_l, wcstof64x_l) # else -weak_alias (strtold_l, strtof64x_l) +weak_alias (__strtold_l, strtof64x_l) # endif #endif diff --git a/sysdeps/ieee754/ldbl-96/strtold_l.c b/sysdeps/ieee754/ldbl-96/strtold_l.c index c721ddc696..ae6f87b44c 100644 --- a/sysdeps/ieee754/ldbl-96/strtold_l.c +++ b/sysdeps/ieee754/ldbl-96/strtold_l.c @@ -45,8 +45,8 @@ # undef strtof64x_l # undef wcstof64x_l # ifdef USE_WIDE_CHAR -weak_alias (wcstold_l, wcstof64x_l) +static_weak_alias (__wcstold_l, wcstof64x_l) # else -weak_alias (strtold_l, strtof64x_l) +static_weak_alias (__strtold_l, strtof64x_l) # endif #endif diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy-ppc32.c b/sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy-ppc32.c index d0bfe0da43..7ca044c213 100644 --- a/sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy-ppc32.c +++ b/sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy-ppc32.c @@ -20,8 +20,8 @@ #undef libc_hidden_def #define libc_hidden_def(name) -#undef weak_alias -#define weak_alias(a, b) +#undef static_weak_alias +#define static_weak_alias(a, b) #if defined SHARED # undef libc_hidden_builtin_def diff --git a/sysdeps/s390/wcschr-c.c b/sysdeps/s390/wcschr-c.c index 18d6b329c2..404fcbbbb6 100644 --- a/sysdeps/s390/wcschr-c.c +++ b/sysdeps/s390/wcschr-c.c @@ -22,8 +22,8 @@ # if HAVE_WCSCHR_IFUNC || HAVE_WCSCHR_Z13 # define WCSCHR WCSCHR_C -# undef weak_alias -# define weak_alias(name, alias) +# undef static_weak_alias +# define static_weak_alias(name, alias) # if defined SHARED && IS_IN (libc) # undef libc_hidden_weak diff --git a/sysdeps/unix/sysv/linux/accept.c b/sysdeps/unix/sysv/linux/accept.c index 410b1c0bcb..1cf84ff6ec 100644 --- a/sysdeps/unix/sysv/linux/accept.c +++ b/sysdeps/unix/sysv/linux/accept.c @@ -30,5 +30,5 @@ __libc_accept (int fd, __SOCKADDR_ARG addr, socklen_t *len) return SOCKETCALL_CANCEL (accept, fd, addr.__sockaddr__, len); #endif } -weak_alias (__libc_accept, accept) +static_weak_alias (__libc_accept, accept) libc_hidden_def (accept) diff --git a/sysdeps/unix/sysv/linux/connect.c b/sysdeps/unix/sysv/linux/connect.c index d60dc2ef11..dab24198fb 100644 --- a/sysdeps/unix/sysv/linux/connect.c +++ b/sysdeps/unix/sysv/linux/connect.c @@ -28,6 +28,6 @@ __libc_connect (int fd, __CONST_SOCKADDR_ARG addr, socklen_t len) return SOCKETCALL_CANCEL (connect, fd, addr.__sockaddr__, len); #endif } -weak_alias (__libc_connect, connect) -weak_alias (__libc_connect, __connect) +static_weak_alias (__libc_connect, connect) +static_weak_alias (__libc_connect, __connect) libc_hidden_weak (__connect) diff --git a/sysdeps/unix/sysv/linux/dirfd.c b/sysdeps/unix/sysv/linux/dirfd.c index 1c637c666b..0f6b8b6a5f 100644 --- a/sysdeps/unix/sysv/linux/dirfd.c +++ b/sysdeps/unix/sysv/linux/dirfd.c @@ -27,5 +27,5 @@ __dirfd (DIR *dirp) return dirp->fd; } -weak_alias (__dirfd, dirfd) +static_weak_alias (__dirfd, dirfd) libc_hidden_def (dirfd) diff --git a/sysdeps/unix/sysv/linux/fcntl64.c b/sysdeps/unix/sysv/linux/fcntl64.c index 1861b18eee..9682e4a070 100644 --- a/sysdeps/unix/sysv/linux/fcntl64.c +++ b/sysdeps/unix/sysv/linux/fcntl64.c @@ -51,7 +51,7 @@ __libc_fcntl64 (int fd, int cmd, ...) return __fcntl64_nocancel_adjusted (fd, cmd, arg); } libc_hidden_def (__libc_fcntl64) -weak_alias (__libc_fcntl64, __fcntl64) +strong_alias (__libc_fcntl64, __fcntl64) libc_hidden_weak (__fcntl64) weak_alias (__libc_fcntl64, fcntl64) #if __TIMESIZE != 64 diff --git a/sysdeps/unix/sysv/linux/getlogin_r.c b/sysdeps/unix/sysv/linux/getlogin_r.c index f03ecd4da9..d9ec274522 100644 --- a/sysdeps/unix/sysv/linux/getlogin_r.c +++ b/sysdeps/unix/sysv/linux/getlogin_r.c @@ -114,5 +114,5 @@ __getlogin_r (char *name, size_t namesize) return getlogin_r_fd0 (name, namesize); } libc_hidden_def (__getlogin_r) -weak_alias (__getlogin_r, getlogin_r) +static_weak_alias (__getlogin_r, getlogin_r) libc_hidden_weak (getlogin_r) diff --git a/sysdeps/unix/sysv/linux/getrlimit64.c b/sysdeps/unix/sysv/linux/getrlimit64.c index 8500fe366a..092eaea3e7 100644 --- a/sysdeps/unix/sysv/linux/getrlimit64.c +++ b/sysdeps/unix/sysv/linux/getrlimit64.c @@ -48,8 +48,8 @@ strong_alias (__getrlimit64, __GI___getrlimit) strong_alias (__getrlimit64, __getrlimit) /* Alpha defines a versioned getrlimit{64}. */ # ifndef USE_VERSIONED_RLIMIT -weak_alias (__getrlimit64, getrlimit) -weak_alias (__getrlimit64, getrlimit64) +static_weak_alias (__getrlimit64, getrlimit) +static_weak_alias (__getrlimit64, getrlimit64) libc_hidden_weak (getrlimit64) # else weak_alias (__getrlimit64, __GI_getrlimit64) diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c index 5d137598f0..601c5a2c11 100644 --- a/sysdeps/unix/sysv/linux/if_index.c +++ b/sysdeps/unix/sysv/linux/if_index.c @@ -51,7 +51,7 @@ __if_nametoindex (const char *ifname) return status < 0 ? 0 : ifr.ifr_ifindex; } libc_hidden_def (__if_nametoindex) -weak_alias (__if_nametoindex, if_nametoindex) +static_weak_alias (__if_nametoindex, if_nametoindex) libc_hidden_weak (if_nametoindex) @@ -67,7 +67,7 @@ __if_freenameindex (struct if_nameindex *ifn) free (ifn); } libc_hidden_def (__if_freenameindex) -weak_alias (__if_freenameindex, if_freenameindex) +static_weak_alias (__if_freenameindex, if_freenameindex) libc_hidden_weak (if_freenameindex) @@ -184,7 +184,7 @@ __if_nameindex (void) return idx; } -weak_alias (__if_nameindex, if_nameindex) +static_weak_alias (__if_nameindex, if_nameindex) libc_hidden_weak (if_nameindex) @@ -218,5 +218,5 @@ __if_indextoname (unsigned int ifindex, char ifname[IF_NAMESIZE]) else return strncpy (ifname, ifr.ifr_name, IFNAMSIZ); } -weak_alias (__if_indextoname, if_indextoname) +static_weak_alias (__if_indextoname, if_indextoname) libc_hidden_weak (if_indextoname) diff --git a/sysdeps/unix/sysv/linux/ifaddrs.c b/sysdeps/unix/sysv/linux/ifaddrs.c index ddc4be78ee..ca7f2a3918 100644 --- a/sysdeps/unix/sysv/linux/ifaddrs.c +++ b/sysdeps/unix/sysv/linux/ifaddrs.c @@ -833,7 +833,7 @@ __getifaddrs (struct ifaddrs **ifap) return res; } -weak_alias (__getifaddrs, getifaddrs) +static_weak_alias (__getifaddrs, getifaddrs) libc_hidden_def (__getifaddrs) libc_hidden_weak (getifaddrs) @@ -843,6 +843,6 @@ __freeifaddrs (struct ifaddrs *ifa) { free (ifa); } -weak_alias (__freeifaddrs, freeifaddrs) +static_weak_alias (__freeifaddrs, freeifaddrs) libc_hidden_def (__freeifaddrs) libc_hidden_weak (freeifaddrs) diff --git a/sysdeps/unix/sysv/linux/lseek64.c b/sysdeps/unix/sysv/linux/lseek64.c index 49f4136844..f921bba9b0 100644 --- a/sysdeps/unix/sysv/linux/lseek64.c +++ b/sysdeps/unix/sysv/linux/lseek64.c @@ -43,7 +43,7 @@ __lseek64 (int fd, off64_t offset, int whence) #ifdef __OFF_T_MATCHES_OFF64_T weak_alias (__lseek64, lseek) -weak_alias (__lseek64, __lseek) +strong_alias (__lseek64, __lseek) strong_alias (__lseek64, __libc_lseek) libc_hidden_def (__lseek) #endif diff --git a/sysdeps/unix/sysv/linux/mmap64.c b/sysdeps/unix/sysv/linux/mmap64.c index e202356efe..6bf4b0ab7f 100644 --- a/sysdeps/unix/sysv/linux/mmap64.c +++ b/sysdeps/unix/sysv/linux/mmap64.c @@ -62,7 +62,7 @@ weak_alias (__mmap64, mmap64) libc_hidden_def (__mmap64) #ifdef __OFF_T_MATCHES_OFF64_T -weak_alias (__mmap64, mmap) -weak_alias (__mmap64, __mmap) +static_weak_alias (__mmap64, mmap) +strong_alias (__mmap64, __mmap) libc_hidden_def (__mmap) #endif diff --git a/sysdeps/unix/sysv/linux/pread64.c b/sysdeps/unix/sysv/linux/pread64.c index 5fbf14b4be..8db26c21ab 100644 --- a/sysdeps/unix/sysv/linux/pread64.c +++ b/sysdeps/unix/sysv/linux/pread64.c @@ -25,7 +25,7 @@ __libc_pread64 (int fd, void *buf, size_t count, off64_t offset) return SYSCALL_CANCEL (pread64, fd, buf, count, SYSCALL_LL64_PRW (offset)); } -weak_alias (__libc_pread64, __pread64) +strong_alias (__libc_pread64, __pread64) libc_hidden_weak (__pread64) weak_alias (__libc_pread64, pread64) diff --git a/sysdeps/unix/sysv/linux/pwrite64.c b/sysdeps/unix/sysv/linux/pwrite64.c index c1388b03bd..aeccaa5962 100644 --- a/sysdeps/unix/sysv/linux/pwrite64.c +++ b/sysdeps/unix/sysv/linux/pwrite64.c @@ -25,7 +25,7 @@ __libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset) return SYSCALL_CANCEL (pwrite64, fd, buf, count, SYSCALL_LL64_PRW (offset)); } -weak_alias (__libc_pwrite64, __pwrite64) +strong_alias (__libc_pwrite64, __pwrite64) libc_hidden_weak (__pwrite64) weak_alias (__libc_pwrite64, pwrite64) diff --git a/sysdeps/unix/sysv/linux/read.c b/sysdeps/unix/sysv/linux/read.c index cb2f22e319..3ec3acdf13 100644 --- a/sysdeps/unix/sysv/linux/read.c +++ b/sysdeps/unix/sysv/linux/read.c @@ -28,6 +28,6 @@ __libc_read (int fd, void *buf, size_t nbytes) libc_hidden_def (__libc_read) libc_hidden_def (__read) -weak_alias (__libc_read, __read) +strong_alias (__libc_read, __read) libc_hidden_def (read) -weak_alias (__libc_read, read) +static_weak_alias (__libc_read, read) diff --git a/sysdeps/unix/sysv/linux/recv.c b/sysdeps/unix/sysv/linux/recv.c index 24ee8f74e4..64a7245beb 100644 --- a/sysdeps/unix/sysv/linux/recv.c +++ b/sysdeps/unix/sysv/linux/recv.c @@ -30,6 +30,6 @@ __libc_recv (int fd, void *buf, size_t len, int flags) return SOCKETCALL_CANCEL (recv, fd, buf, len, flags); #endif } -weak_alias (__libc_recv, recv) -weak_alias (__libc_recv, __recv) +static_weak_alias (__libc_recv, recv) +static_weak_alias (__libc_recv, __recv) libc_hidden_weak (__recv) diff --git a/sysdeps/unix/sysv/linux/send.c b/sysdeps/unix/sysv/linux/send.c index 68cdd4069d..84404be4d3 100644 --- a/sysdeps/unix/sysv/linux/send.c +++ b/sysdeps/unix/sysv/linux/send.c @@ -30,6 +30,6 @@ __libc_send (int fd, const void *buf, size_t len, int flags) return SOCKETCALL_CANCEL (send, fd, buf, len, flags); #endif } -weak_alias (__libc_send, send) -weak_alias (__libc_send, __send) +static_weak_alias (__libc_send, send) +static_weak_alias (__libc_send, __send) libc_hidden_def (__send) diff --git a/sysdeps/unix/sysv/linux/write.c b/sysdeps/unix/sysv/linux/write.c index dd40926e76..f6c4d31451 100644 --- a/sysdeps/unix/sysv/linux/write.c +++ b/sysdeps/unix/sysv/linux/write.c @@ -27,7 +27,7 @@ __libc_write (int fd, const void *buf, size_t nbytes) } libc_hidden_def (__libc_write) -weak_alias (__libc_write, __write) +strong_alias (__libc_write, __write) libc_hidden_weak (__write) -weak_alias (__libc_write, write) +static_weak_alias (__libc_write, write) libc_hidden_weak (write) diff --git a/sysdeps/wordsize-64/Makefile b/sysdeps/wordsize-64/Makefile index 6a84d0f863..c1efde12d6 100644 --- a/sysdeps/wordsize-64/Makefile +++ b/sysdeps/wordsize-64/Makefile @@ -8,6 +8,6 @@ fmt-xscanf-uint-convs += uint ulong endif # strtol is aliased to stroll -CFLAGS-strtol.c += -fno-builtin-strtoll $(config-cflags-wno-ignored-attributes) +CFLAGS-strtol.c += -fno-builtin-strtoll # strtoul is aliased to strtoull -CFLAGS-strtoul.c += -fno-builtin-strtoull $(config-cflags-wno-ignored-attributes) +CFLAGS-strtoul.c += -fno-builtin-strtoull diff --git a/sysdeps/wordsize-64/strtol.c b/sysdeps/wordsize-64/strtol.c index a21fa8da10..cd99cb22fd 100644 --- a/sysdeps/wordsize-64/strtol.c +++ b/sysdeps/wordsize-64/strtol.c @@ -12,11 +12,11 @@ #undef __isoc23_strtoll strong_alias (__strtol_internal, __strtoll_internal) libc_hidden_ver (__strtol_internal, __strtoll_internal) -weak_alias (strtol, strtoll) -libc_hidden_ver (strtol, strtoll) -weak_alias (strtol, strtoq) -libc_hidden_ver (strtol, strtoq) -weak_alias (strtol, strtoimax) +weak_alias (__strtol, strtoll) +libc_hidden_ver (__strtol, strtoll) +weak_alias (__strtol, strtoq) +libc_hidden_ver (__strtol, strtoq) +weak_alias (__strtol, strtoimax) weak_alias (__isoc23_strtol, __isoc23_strtoll) libc_hidden_ver (__isoc23_strtol, __isoc23_strtoll) weak_alias (__isoc23_strtol, __isoc23_strtoimax) diff --git a/sysdeps/wordsize-64/strtoul.c b/sysdeps/wordsize-64/strtoul.c index 60c82b89d9..00e83d2c38 100644 --- a/sysdeps/wordsize-64/strtoul.c +++ b/sysdeps/wordsize-64/strtoul.c @@ -12,9 +12,9 @@ #undef __isoc23_strtoull strong_alias (__strtoul_internal, __strtoull_internal) libc_hidden_ver (__strtoul_internal, __strtoull_internal) -weak_alias (strtoul, strtoull) -weak_alias (strtoul, strtouq) -weak_alias (strtoul, strtoumax) +weak_alias (__strtoul, strtoull) +weak_alias (__strtoul, strtouq) +weak_alias (__strtoul, strtoumax) weak_alias (__isoc23_strtoul, __isoc23_strtoull) libc_hidden_ver (__isoc23_strtoul, __isoc23_strtoull) weak_alias (__isoc23_strtoul, __isoc23_strtoumax) diff --git a/sysdeps/wordsize-64/wcstol.c b/sysdeps/wordsize-64/wcstol.c index 557c763941..ba8796b9b9 100644 --- a/sysdeps/wordsize-64/wcstol.c +++ b/sysdeps/wordsize-64/wcstol.c @@ -12,9 +12,9 @@ #undef __isoc23_wcstoll strong_alias (__wcstol_internal, __wcstoll_internal) libc_hidden_ver (__wcstol_internal, __wcstoll_internal) -weak_alias (wcstol, wcstoll) -weak_alias (wcstol, wcstoq) -weak_alias (wcstol, wcstoimax) +weak_alias (__wcstol, wcstoll) +weak_alias (__wcstol, wcstoq) +weak_alias (__wcstol, wcstoimax) weak_alias (__isoc23_wcstol, __isoc23_wcstoll) libc_hidden_ver (__isoc23_wcstol, __isoc23_wcstoll) weak_alias (__isoc23_wcstol, __isoc23_wcstoimax) diff --git a/sysdeps/wordsize-64/wcstoul.c b/sysdeps/wordsize-64/wcstoul.c index 9b48ca6ab2..f7a03871b6 100644 --- a/sysdeps/wordsize-64/wcstoul.c +++ b/sysdeps/wordsize-64/wcstoul.c @@ -12,9 +12,9 @@ #undef __isoc23_wcstoull strong_alias (__wcstoul_internal, __wcstoull_internal) libc_hidden_ver (__wcstoul_internal, __wcstoull_internal) -weak_alias (wcstoul, wcstoull) -weak_alias (wcstoul, wcstouq) -weak_alias (wcstoul, wcstoumax) +weak_alias (__wcstoul, wcstoull) +weak_alias (__wcstoul, wcstouq) +weak_alias (__wcstoul, wcstoumax) weak_alias (__isoc23_wcstoul, __isoc23_wcstoull) libc_hidden_ver (__isoc23_wcstoul, __isoc23_wcstoull) weak_alias (__isoc23_wcstoul, __isoc23_wcstoumax) diff --git a/sysdeps/x86_64/fpu/fclrexcpt.c b/sysdeps/x86_64/fpu/fclrexcpt.c index 82029af7f6..80dcbf9147 100644 --- a/sysdeps/x86_64/fpu/fclrexcpt.c +++ b/sysdeps/x86_64/fpu/fclrexcpt.c @@ -51,5 +51,5 @@ __feclearexcept (int excepts) return 0; } libm_hidden_def (__feclearexcept) -weak_alias (__feclearexcept, feclearexcept) +static_weak_alias (__feclearexcept, feclearexcept) libm_hidden_def (feclearexcept) diff --git a/sysdeps/x86_64/fpu/fegetenv.c b/sysdeps/x86_64/fpu/fegetenv.c index a2523e0978..21ed713aca 100644 --- a/sysdeps/x86_64/fpu/fegetenv.c +++ b/sysdeps/x86_64/fpu/fegetenv.c @@ -33,5 +33,5 @@ __fegetenv (fenv_t *envp) return 0; } libm_hidden_def (__fegetenv) -weak_alias (__fegetenv, fegetenv) +static_weak_alias (__fegetenv, fegetenv) libm_hidden_weak (fegetenv) diff --git a/sysdeps/x86_64/fpu/fegetround.c b/sysdeps/x86_64/fpu/fegetround.c index 9537cd3142..a7fc1a8870 100644 --- a/sysdeps/x86_64/fpu/fegetround.c +++ b/sysdeps/x86_64/fpu/fegetround.c @@ -30,5 +30,5 @@ __fegetround (void) return cw & 0xc00; } libm_hidden_def (__fegetround) -weak_alias (__fegetround, fegetround) +static_weak_alias (__fegetround, fegetround) libm_hidden_weak (fegetround) diff --git a/sysdeps/x86_64/fpu/feholdexcpt.c b/sysdeps/x86_64/fpu/feholdexcpt.c index 74314b0fc9..f899e92193 100644 --- a/sysdeps/x86_64/fpu/feholdexcpt.c +++ b/sysdeps/x86_64/fpu/feholdexcpt.c @@ -37,5 +37,5 @@ __feholdexcept (fenv_t *envp) return 0; } libm_hidden_def (__feholdexcept) -weak_alias (__feholdexcept, feholdexcept) +static_weak_alias (__feholdexcept, feholdexcept) libm_hidden_weak (feholdexcept) diff --git a/sysdeps/x86_64/fpu/fesetenv.c b/sysdeps/x86_64/fpu/fesetenv.c index 781de281b8..73cdc98d6c 100644 --- a/sysdeps/x86_64/fpu/fesetenv.c +++ b/sysdeps/x86_64/fpu/fesetenv.c @@ -111,5 +111,5 @@ __fesetenv (const fenv_t *envp) return 0; } libm_hidden_def (__fesetenv) -weak_alias (__fesetenv, fesetenv) +static_weak_alias (__fesetenv, fesetenv) libm_hidden_weak (fesetenv) diff --git a/sysdeps/x86_64/fpu/fesetround.c b/sysdeps/x86_64/fpu/fesetround.c index e06225213a..c7d6421ec6 100644 --- a/sysdeps/x86_64/fpu/fesetround.c +++ b/sysdeps/x86_64/fpu/fesetround.c @@ -45,5 +45,5 @@ __fesetround (int round) return 0; } libm_hidden_def (__fesetround) -weak_alias (__fesetround, fesetround) +static_weak_alias (__fesetround, fesetround) libm_hidden_weak (fesetround) diff --git a/sysdeps/x86_64/fpu/fraiseexcpt.c b/sysdeps/x86_64/fpu/fraiseexcpt.c index 05474bec13..f0a1d8282b 100644 --- a/sysdeps/x86_64/fpu/fraiseexcpt.c +++ b/sysdeps/x86_64/fpu/fraiseexcpt.c @@ -107,5 +107,5 @@ __feraiseexcept (int excepts) return 0; } libm_hidden_def (__feraiseexcept) -weak_alias (__feraiseexcept, feraiseexcept) +static_weak_alias (__feraiseexcept, feraiseexcept) libm_hidden_weak (feraiseexcept) diff --git a/sysdeps/x86_64/fpu/ftestexcept.c b/sysdeps/x86_64/fpu/ftestexcept.c index 5e7054edcb..1d23e7ca80 100644 --- a/sysdeps/x86_64/fpu/ftestexcept.c +++ b/sysdeps/x86_64/fpu/ftestexcept.c @@ -32,5 +32,5 @@ __fetestexcept (int excepts) return (temp | mxscr) & excepts & FE_ALL_EXCEPT; } libm_hidden_def (__fetestexcept) -weak_alias (__fetestexcept, fetestexcept) +static_weak_alias (__fetestexcept, fetestexcept) libm_hidden_def (fetestexcept) diff --git a/sysdeps/x86_64/fpu/multiarch/s_exp10m1f.c b/sysdeps/x86_64/fpu/multiarch/s_exp10m1f.c index 7bb1749a28..4b0c825fc5 100644 --- a/sysdeps/x86_64/fpu/multiarch/s_exp10m1f.c +++ b/sysdeps/x86_64/fpu/multiarch/s_exp10m1f.c @@ -18,6 +18,7 @@ #include #if MINIMUM_X86_ISA_LEVEL < AVX2_X86_ISA_LEVEL +# include # include extern float __redirect_exp10m1f (float); diff --git a/sysdeps/x86_64/fpu/multiarch/s_exp2m1f.c b/sysdeps/x86_64/fpu/multiarch/s_exp2m1f.c index 1361b79e51..890b149ec2 100644 --- a/sysdeps/x86_64/fpu/multiarch/s_exp2m1f.c +++ b/sysdeps/x86_64/fpu/multiarch/s_exp2m1f.c @@ -18,6 +18,7 @@ #include #if MINIMUM_X86_ISA_LEVEL < AVX2_X86_ISA_LEVEL +# include # include extern float __redirect_exp2m1f (float); diff --git a/sysdeps/x86_64/fpu/multiarch/s_sincos.c b/sysdeps/x86_64/fpu/multiarch/s_sincos.c index 5d60cd0548..4514eedcd1 100644 --- a/sysdeps/x86_64/fpu/multiarch/s_sincos.c +++ b/sysdeps/x86_64/fpu/multiarch/s_sincos.c @@ -18,6 +18,7 @@ #include #if MINIMUM_X86_ISA_LEVEL < AVX2_X86_ISA_LEVEL +# include # include extern void __redirect_sincos (double, double *, double *); diff --git a/sysdeps/x86_64/multiarch/mempcpy.c b/sysdeps/x86_64/multiarch/mempcpy.c index ba5297e7c3..cc67b425be 100644 --- a/sysdeps/x86_64/multiarch/mempcpy.c +++ b/sysdeps/x86_64/multiarch/mempcpy.c @@ -36,7 +36,7 @@ weak_alias (__mempcpy, mempcpy) # ifdef SHARED __hidden_ver1 (__mempcpy, __GI___mempcpy, __redirect___mempcpy) __attribute__ ((visibility ("hidden"))) __attribute_copy__ (mempcpy); -__hidden_ver1 (mempcpy, __GI_mempcpy, __redirect_mempcpy) +__hidden_ver1 (__mempcpy, __GI_mempcpy, __redirect_mempcpy) __attribute__ ((visibility ("hidden"))) __attribute_copy__ (mempcpy); # endif #endif diff --git a/sysdeps/x86_64/multiarch/stpcpy.c b/sysdeps/x86_64/multiarch/stpcpy.c index df027e314e..5b084e78f7 100644 --- a/sysdeps/x86_64/multiarch/stpcpy.c +++ b/sysdeps/x86_64/multiarch/stpcpy.c @@ -36,7 +36,7 @@ weak_alias (__stpcpy, stpcpy) # ifdef SHARED __hidden_ver1 (__stpcpy, __GI___stpcpy, __redirect___stpcpy) __attribute__ ((visibility ("hidden"))) __attribute_copy__ (stpcpy); -__hidden_ver1 (stpcpy, __GI_stpcpy, __redirect_stpcpy) +__hidden_ver1 (__stpcpy, __GI_stpcpy, __redirect_stpcpy) __attribute__ ((visibility ("hidden"))) __attribute_copy__ (stpcpy); # endif #endif diff --git a/sysdeps/x86_64/multiarch/strnlen.c b/sysdeps/x86_64/multiarch/strnlen.c index 6444ca1d80..0b0bd977de 100644 --- a/sysdeps/x86_64/multiarch/strnlen.c +++ b/sysdeps/x86_64/multiarch/strnlen.c @@ -33,7 +33,7 @@ weak_alias (__strnlen, strnlen); # ifdef SHARED __hidden_ver1 (__strnlen, __GI___strnlen, __redirect___strnlen) __attribute__((visibility ("hidden"))) __attribute_copy__ (strnlen); -__hidden_ver1 (strnlen, __GI_strnlen, __redirect_strnlen) +__hidden_ver1 (__strnlen, __GI_strnlen, __redirect_strnlen) __attribute__((weak, visibility ("hidden"))) __attribute_copy__ (strnlen); # endif #endif diff --git a/sysdeps/x86_64/multiarch/wcschr.c b/sysdeps/x86_64/multiarch/wcschr.c index 3df2367f93..5a10cccde1 100644 --- a/sysdeps/x86_64/multiarch/wcschr.c +++ b/sysdeps/x86_64/multiarch/wcschr.c @@ -33,7 +33,7 @@ weak_alias (__wcschr, wcschr); # ifdef SHARED __hidden_ver1 (__wcschr, __GI___wcschr, __redirect___wcschr) __attribute__((visibility ("hidden"))); -__hidden_ver1 (wcschr, __GI_wcschr, __redirect_wcschr) +__hidden_ver1 (__wcschr, __GI_wcschr, __redirect_wcschr) __attribute__((weak, visibility ("hidden"))); # endif #endif diff --git a/sysdeps/x86_64/multiarch/wmemchr.c b/sysdeps/x86_64/multiarch/wmemchr.c index bba610394c..b5bee75f38 100644 --- a/sysdeps/x86_64/multiarch/wmemchr.c +++ b/sysdeps/x86_64/multiarch/wmemchr.c @@ -33,7 +33,7 @@ weak_alias (__wmemchr, wmemchr) # ifdef SHARED __hidden_ver1 (__wmemchr, __GI___wmemchr, __redirect___wmemchr) __attribute__((visibility ("hidden"))); -__hidden_ver1 (wmemchr, __GI_wmemchr, __redirect_wmemchr) +__hidden_ver1 (__wmemchr, __GI_wmemchr, __redirect_wmemchr) __attribute__((weak, visibility ("hidden"))); # endif #endif diff --git a/sysdeps/x86_64/multiarch/wmemset.c b/sysdeps/x86_64/multiarch/wmemset.c index 0169f2ac54..096633b7ac 100644 --- a/sysdeps/x86_64/multiarch/wmemset.c +++ b/sysdeps/x86_64/multiarch/wmemset.c @@ -34,7 +34,7 @@ weak_alias (__wmemset, wmemset) # ifdef SHARED __hidden_ver1 (__wmemset, __GI___wmemset, __redirect___wmemset) __attribute__ ((visibility ("hidden"))); -__hidden_ver1 (wmemset, __GI_wmemset, __redirect_wmemset) +__hidden_ver1 (__wmemset, __GI_wmemset, __redirect_wmemset) __attribute__ ((visibility ("hidden"))); # endif #endif diff --git a/termios/Makefile b/termios/Makefile index 1e23608255..0308bacf74 100644 --- a/termios/Makefile +++ b/termios/Makefile @@ -53,4 +53,3 @@ routines := \ include ../Rules CFLAGS-tcdrain.c += -fexceptions -fasynchronous-unwind-tables -CFLAGS-tcsetattr.c += $(config-cflags-wno-ignored-attributes) diff --git a/time/Makefile b/time/Makefile index 3e010d2c15..55b8b690ca 100644 --- a/time/Makefile +++ b/time/Makefile @@ -141,7 +141,6 @@ CFLAGS-tzset.c += $(tz-cflags) CFLAGS-getdate.c += -fexceptions CFLAGS-clock_nanosleep.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-nanosleep.c += -fexceptions -fasynchronous-unwind-tables -CFLAGS-mktime.c += $(config-cflags-wno-ignored-attributes) # Don't warn about Y2k problem in strftime format string. CFLAGS-test_time.c += -Wno-format diff --git a/time/mktime.c b/time/mktime.c index 86d496ca65..6769bab478 100644 --- a/time/mktime.c +++ b/time/mktime.c @@ -573,6 +573,6 @@ mktime (struct tm *tp) #endif -weak_alias (mktime, timelocal) +static_weak_alias (mktime, timelocal) libc_hidden_def (mktime) libc_hidden_weak (timelocal) diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile index 559438c1ce..383cf43a07 100644 --- a/wcsmbs/Makefile +++ b/wcsmbs/Makefile @@ -248,32 +248,24 @@ CFLAGS-wcwidth.c += -I../wctype CFLAGS-wcswidth.c += -I../wctype strtox-CFLAGS = -I../include -CFLAGS-wcstol.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes) -CFLAGS-wcstoul.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes) +CFLAGS-wcstol.c += $(strtox-CFLAGS) +CFLAGS-wcstoul.c += $(strtox-CFLAGS) CFLAGS-wcstoll.c += $(strtox-CFLAGS) CFLAGS-wcstoull.c += $(strtox-CFLAGS) -CFLAGS-wcstod.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes) -CFLAGS-wcstold.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes) +CFLAGS-wcstod.c += $(strtox-CFLAGS) +CFLAGS-wcstold.c += $(strtox-CFLAGS) CFLAGS-wcstof128.c += $(strtox-CFLAGS) -CFLAGS-wcstof.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes) +CFLAGS-wcstof.c += $(strtox-CFLAGS) CFLAGS-wcstol_l.c += $(strtox-CFLAGS) CFLAGS-wcstoul_l.c += $(strtox-CFLAGS) CFLAGS-wcstoll_l.c += $(strtox-CFLAGS) CFLAGS-wcstoull_l.c += $(strtox-CFLAGS) -CFLAGS-wcstod_l.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes) -CFLAGS-wcstold_l.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes) +CFLAGS-wcstod_l.c += $(strtox-CFLAGS) +CFLAGS-wcstold_l.c += $(strtox-CFLAGS) CFLAGS-wcstof128_l.c += $(strtox-CFLAGS) -CFLAGS-wcstof_l.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes) +CFLAGS-wcstof_l.c += $(strtox-CFLAGS) CPPFLAGS-tst-wchar-h.c += $(no-fortify-source) -D_FORTIFY_SOURCE=2 -CFLAGS-wcschr.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-wmemchr.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-wmemset.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-mbrtowc.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-wcrtomb.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-wcstoll.c += $(config-cflags-wno-ignored-attributes) -CFLAGS-wcstoull.c += $(config-cflags-wno-ignored-attributes) - CFLAGS-isoc99_wscanf.c += -fexceptions CFLAGS-isoc99_fwscanf.c += -fexceptions CFLAGS-isoc99_vwscanf.c += -fexceptions diff --git a/wcsmbs/mbrtowc.c b/wcsmbs/mbrtowc.c index 47068ed0e0..ce8f6045b1 100644 --- a/wcsmbs/mbrtowc.c +++ b/wcsmbs/mbrtowc.c @@ -117,5 +117,5 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) return result; } libc_hidden_def (__mbrtowc) -weak_alias (__mbrtowc, mbrtowc) +static_weak_alias (__mbrtowc, mbrtowc) libc_hidden_weak (mbrtowc) diff --git a/wcsmbs/wcrtomb.c b/wcsmbs/wcrtomb.c index d4ce187781..19788ffbb5 100644 --- a/wcsmbs/wcrtomb.c +++ b/wcsmbs/wcrtomb.c @@ -123,5 +123,5 @@ __wcrtomb (char *s, wchar_t wc, mbstate_t *ps) { return __wcrtomb_internal (s, wc, ps, (size_t) -1); } -weak_alias (__wcrtomb, wcrtomb) +static_weak_alias (__wcrtomb, wcrtomb) libc_hidden_weak (wcrtomb) diff --git a/wcsmbs/wcschr.c b/wcsmbs/wcschr.c index 6bd3ad9ddf..f64f6baac4 100644 --- a/wcsmbs/wcschr.c +++ b/wcsmbs/wcschr.c @@ -45,5 +45,5 @@ WCSCHR (const wchar_t *wcs, const wchar_t wc) return dest; } libc_hidden_def (__wcschr) -weak_alias (__wcschr, wcschr) +static_weak_alias (__wcschr, wcschr) libc_hidden_weak (wcschr) diff --git a/wcsmbs/wmemchr.c b/wcsmbs/wmemchr.c index a5403581a3..e78874d302 100644 --- a/wcsmbs/wmemchr.c +++ b/wcsmbs/wmemchr.c @@ -60,5 +60,5 @@ __wmemchr (const wchar_t *s, wchar_t c, size_t n) return NULL; } libc_hidden_def (__wmemchr) -weak_alias (__wmemchr, wmemchr) +static_weak_alias (__wmemchr, wmemchr) libc_hidden_weak (wmemchr) diff --git a/wcsmbs/wmemset.c b/wcsmbs/wmemset.c index 3441ece2b2..517a22b06b 100644 --- a/wcsmbs/wmemset.c +++ b/wcsmbs/wmemset.c @@ -52,5 +52,5 @@ __wmemset (wchar_t *s, wchar_t c, size_t n) return s; } libc_hidden_def (__wmemset) -weak_alias (__wmemset, wmemset) +static_weak_alias (__wmemset, wmemset) libc_hidden_weak (wmemset) diff --git a/wctype/Makefile b/wctype/Makefile index 4708594d84..cdcf3b2328 100644 --- a/wctype/Makefile +++ b/wctype/Makefile @@ -29,5 +29,3 @@ routines := wcfuncs wctype iswctype wctrans towctrans \ tests := test_wctype test_wcfuncs bug-wctypeh include ../Rules - -CFLAGS-wcfuncs.c += $(config-cflags-wno-ignored-attributes) diff --git a/wctype/wcfuncs.c b/wctype/wcfuncs.c index 49f9ed2157..0d078609a5 100644 --- a/wctype/wcfuncs.c +++ b/wctype/wcfuncs.c @@ -34,7 +34,7 @@ const char *desc = _NL_CURRENT (LC_CTYPE, i); \ return wctype_table_lookup (desc, wc); \ } \ - weak_alias (__isw##name, isw##name) + static_weak_alias (__isw##name, isw##name) #undef iswalnum func (alnum, __ISwalnum) @@ -78,7 +78,7 @@ __towlower (wint_t wc) return wctrans_table_lookup (desc, wc); } libc_hidden_def (__towlower) -weak_alias (__towlower, towlower) +static_weak_alias (__towlower, towlower) libc_hidden_weak (towlower) #undef towupper @@ -90,5 +90,5 @@ __towupper (wint_t wc) return wctrans_table_lookup (desc, wc); } libc_hidden_def (__towupper) -weak_alias (__towupper, towupper) +static_weak_alias (__towupper, towupper) libc_hidden_weak (towupper) From patchwork Thu Nov 20 18:30:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 124881 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 8BF443856946 for ; Thu, 20 Nov 2025 18:34:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8BF443856946 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=H16LBp17 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by sourceware.org (Postfix) with ESMTPS id 393AA385841B for ; Thu, 20 Nov 2025 18:31:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 393AA385841B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 393AA385841B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::544 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663488; cv=none; b=pncVRdgkjdn+dSr5EqsnBBPWD8bnh4CcGKDn8140AX2Yy7dCT6ju+HNZKe2jlB+0kVf2wVOU3R+VNAljjgotKVUCpExaXqdP+PbG43RJ1145hwGkYxTFUa6Qj50K1IEEAVC2DC1MMsV1tdUOcTnrAwUCZmuCzLj0i5yAsP/8DZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663488; c=relaxed/simple; bh=1D9qDMfQvzIoqY3c1syOLBGtzH+6XRtSRXweMsFzV9g=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vWrDbl4QtfYvvNKz/cR3Pnlo7nyUgbWQpH1iY5PgysVPbNdxo7zLJ5+RhIx02vzaZw+nT/vJBnh/x197HZnnsrt/7O6qGKAxhm1OYb6qvwNoUYOStxvSNn1P228g6gzeaqMqlniuGOBSzygVuGtQNIqgkhba/xMLcYegKW+jwsU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 393AA385841B Received: by mail-pg1-x544.google.com with SMTP id 41be03b00d2f7-b55517e74e3so871961a12.2 for ; Thu, 20 Nov 2025 10:31:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763663487; x=1764268287; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XiNpsva06sLalr4aqNx641fXx4Axp++j6gORFOlVA5s=; b=H16LBp17VglgF+/Io025Lt8OjNtkH53cgyoRpnKcHEY/ua8tEq+uU3mYRc6K183f5H 4v9GKPqZF1UhlXeHUuI6b1Ud4p77cd5KoRcj+Se4tsO1U0wGhd87/ye9XvdBQyIA6but od4r7uiFHsEHx27MI68GSbUR9sLSI6b6SCMiTrjzBQvBZfTK6a4q/WvoXMorvenAz6ql 6RoP8ijY6pB4+MiBLymabsVoPy/xhrvP1R9Mz44VycBQhqzbf5wvccMvT4XHX4RS/6i7 unTFic0sAmWowXlN9Q956+W+l5VcW+3laUkAmn9Kf3F3Tq7L7cvEI7J2MqP1KbCK/7JR kf2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763663487; x=1764268287; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=XiNpsva06sLalr4aqNx641fXx4Axp++j6gORFOlVA5s=; b=Numirv0kJr2VPlgvE2QPt/30fPxN9pv+70uTTNL772M6dgwIxE/MU4VS5mKII28kuE zSJMogJEyXFCAWgYrrDgZ58lvonHadzEJiBAm2mHCLo8z1BD0urOQvhKwEL/5ULZS4+V 7ijvbQlvVJ1Isu9GlMc5SLDfgkwAEhphbM3mxBqjf1pBJIsDHNRLdU8WrN4UaF9RMSku 3hzKovyT2plREj21RD/uTM9M/e/aTxdNAeW3ZVEM8z2QBMQa6SSHAnLJZ9cQeETcO7hy 3uzLhC1w+7yt4WNCoxCi8bHcX9SQY+L8fkFdLzvFVBhlSxQsnoFgX+opPBP1cdjqS8CU EbwA== X-Gm-Message-State: AOJu0Yz0cb3dPPpC6TBA2IfrgjDVvlgUIj3cPIVX8cGTxRS+YejYWL8/ KwA+3ZsoP5Kk6FBzu0UKv1vY1Oif194DvaTFWP/pfBjMSr8mcMS3qTVpQeYDNt7cGNpxoCmVUa4 w49VBW93hNg== X-Gm-Gg: ASbGncsZVKeSPeFYqmxjKc1RkQtEPsdLobNaFM/EL4n9z6nBqcdSw873dB/lkzJaUkS MvWfiKBNTd9jeILBTnapXAAnRyCSFfV5csDQQtF1N4vkX2bmnTci9+JkRXc6aB9VZhQqwpKuZhy 3JMEZh0uurj905V6/WX171RXzN33frEOErx/u9eVEjl2UO2ddLYcxbdw149ZR6LGm3OiI0pDdsc 9sdVw6lXie11cFdryVO0pCdHwJX92utRFbn2ItLdarui+mLyyLsNSzJ21IqEO8ouQ9cGeWN4f0L nN5yQee6QES799lEpxB0rIvbTfrqVqrlh2gCWQsf1rVTAfYRMasW3Xaq+ExOsTeOAz8f7iKdrDu cvtSSPNRXNsh/TpT0HQIdXnQOA514I2sAiEI3Y3bBBJ5tr2N5VrurHFMFG8Js0Y0ygIw5mIaXxr 9dG6dJHmQv77no9OPRyna3Yg== X-Google-Smtp-Source: AGHT+IG8ugTzOpRtPJ+wTg1GHjEvtMmQvVBBvro7WzOE1yW57xkH+4Afb43owzOMLIHiT4ZvPW+WUA== X-Received: by 2002:a05:7300:af06:b0:2a7:760:2b61 with SMTP id 5a478bee46e88-2a707605014mr744878eec.3.1763663486732; Thu, 20 Nov 2025 10:31:26 -0800 (PST) Received: from ubuntu-vm.. ([187.11.52.82]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2a6fc5e3750sm9664359eec.6.2025.11.20.10.31.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 10:31:25 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Sam James , Collin Funk , "H . J . Lu" Subject: [PATCH v5 06/12] configure: Only use -fno-fp-int-builtin-inexact if compiler supports it Date: Thu, 20 Nov 2025 15:30:10 -0300 Message-ID: <20251120183107.2334580-7-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> References: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, 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 Checked on x86_64-linux-gnu. Reviewed-by: Sam James --- configure | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 11 ++++++++++ math/Makefile | 32 +++++++++++++-------------- 3 files changed, 87 insertions(+), 16 deletions(-) diff --git a/configure b/configure index 7883e8c99c..9b72ca3b17 100755 --- a/configure +++ b/configure @@ -9140,6 +9140,66 @@ have-cc-gcs = $libc_cv_cc_gcs" config_vars="$config_vars have-test-cc-gcs = $libc_cv_test_cc_gcs" +# Check if compiler supports -fno-fp-int-builtin-inexact + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler supports -fno-fp-int-builtin-inexact" >&5 +printf %s "checking if compiler supports -fno-fp-int-builtin-inexact... " >&6; } +if test ${libc_cv_cc_no_fp_builtin_inexact+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if { ac_try='${CC-cc} -Werror -fno-fp-int-builtin-inexact -xc /dev/null -S -o /dev/null' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + libc_cv_cc_no_fp_builtin_inexact=-fno-fp-int-builtin-inexact +else case e in #( + e) libc_cv_cc_no_fp_builtin_inexact= ;; +esac +fi ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_no_fp_builtin_inexact" >&5 +printf "%s\n" "$libc_cv_cc_no_fp_builtin_inexact" >&6; } +if test "$TEST_CC" = "$CC"; then + libc_cv_test_cc_no_fp_builtin_inexact=$libc_cv_cc_no_fp_builtin_inexact +else + +saved_CC="$CC" +CC="$TEST_CC" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler supports -fno-fp-int-builtin-inexact in testing" >&5 +printf %s "checking if compiler supports -fno-fp-int-builtin-inexact in testing... " >&6; } +if test ${libc_cv_test_cc_no_fp_builtin_inexact+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if { ac_try='${CC-cc} -Werror -fno-fp-int-builtin-inexact -xc /dev/null -S -o /dev/null' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + libc_cv_test_cc_no_fp_builtin_inexact=-fno-fp-int-builtin-inexact +else case e in #( + e) libc_cv_test_cc_no_fp_builtin_inexact= ;; +esac +fi ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_test_cc_no_fp_builtin_inexact" >&5 +printf "%s\n" "$libc_cv_test_cc_no_fp_builtin_inexact" >&6; } + +CC="$saved_CC" + +fi + +config_vars="$config_vars +config-cflags-no-fp-builtin-inexact = $libc_cv_cc_no_fp_builtin_inexact" + # Check if linker supports GCS marking { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker that supports -z gcs=always" >&5 printf %s "checking for linker that supports -z gcs=always... " >&6; } diff --git a/configure.ac b/configure.ac index 8771a738fa..ef269340cb 100644 --- a/configure.ac +++ b/configure.ac @@ -2037,6 +2037,17 @@ LIBC_TRY_CC_AND_TEST_CC_OPTION([if compiler supports -mbranch-protection=gcs], LIBC_CONFIG_VAR([have-cc-gcs], [$libc_cv_cc_gcs]) LIBC_CONFIG_VAR([have-test-cc-gcs], [$libc_cv_test_cc_gcs]) +# Check if compiler supports -fno-fp-int-builtin-inexact +LIBC_TRY_CC_AND_TEST_CC_OPTION([if compiler supports -fno-fp-int-builtin-inexact], + [-Werror -fno-fp-int-builtin-inexact], + libc_cv_cc_no_fp_builtin_inexact, + [libc_cv_cc_no_fp_builtin_inexact=-fno-fp-int-builtin-inexact], + [libc_cv_cc_no_fp_builtin_inexact=], + libc_cv_test_cc_no_fp_builtin_inexact, + [libc_cv_test_cc_no_fp_builtin_inexact=-fno-fp-int-builtin-inexact], + [libc_cv_test_cc_no_fp_builtin_inexact=]) +LIBC_CONFIG_VAR([config-cflags-no-fp-builtin-inexact], [$libc_cv_cc_no_fp_builtin_inexact]) + # Check if linker supports GCS marking LIBC_LINKER_FEATURE([-z gcs=always], [-Wl,-z,gcs=always], [libc_cv_ld_gcs=yes], [libc_cv_ld_gcs=no]) diff --git a/math/Makefile b/math/Makefile index d05108def1..f7a1d9016c 100644 --- a/math/Makefile +++ b/math/Makefile @@ -1827,22 +1827,22 @@ CFLAGS-s_modff128.c += $(config-cflags-signaling-nans) # These files rely on C23 semantics for avoiding "inexact" exceptions # from rounding functions. These settings can be removed when glibc # builds with -std=gnu23 or later. -CFLAGS-s_fromfp.c += -fno-fp-int-builtin-inexact -CFLAGS-s_fromfpx.c += -fno-fp-int-builtin-inexact -CFLAGS-s_ufromfp.c += -fno-fp-int-builtin-inexact -CFLAGS-s_ufromfpx.c += -fno-fp-int-builtin-inexact -CFLAGS-s_fromfpf.c += -fno-fp-int-builtin-inexact -CFLAGS-s_fromfpxf.c += -fno-fp-int-builtin-inexact -CFLAGS-s_ufromfpf.c += -fno-fp-int-builtin-inexact -CFLAGS-s_ufromfpxf.c += -fno-fp-int-builtin-inexact -CFLAGS-s_fromfpl.c += -fno-fp-int-builtin-inexact -CFLAGS-s_fromfpxl.c += -fno-fp-int-builtin-inexact -CFLAGS-s_ufromfpl.c += -fno-fp-int-builtin-inexact -CFLAGS-s_ufromfpxl.c += -fno-fp-int-builtin-inexact -CFLAGS-s_fromfpf128.c += -fno-fp-int-builtin-inexact -CFLAGS-s_fromfpxf128.c += -fno-fp-int-builtin-inexact -CFLAGS-s_ufromfpf128.c += -fno-fp-int-builtin-inexact -CFLAGS-s_ufromfpxf128.c += -fno-fp-int-builtin-inexact +CFLAGS-s_fromfp.c += $(config-cflags-no-fp-builtin-inexact) +CFLAGS-s_fromfpx.c += $(config-cflags-no-fp-builtin-inexact) +CFLAGS-s_ufromfp.c += $(config-cflags-no-fp-builtin-inexact) +CFLAGS-s_ufromfpx.c += $(config-cflags-no-fp-builtin-inexact) +CFLAGS-s_fromfpf.c += $(config-cflags-no-fp-builtin-inexact) +CFLAGS-s_fromfpxf.c += $(config-cflags-no-fp-builtin-inexact) +CFLAGS-s_ufromfpf.c += $(config-cflags-no-fp-builtin-inexact) +CFLAGS-s_ufromfpxf.c += $(config-cflags-no-fp-builtin-inexact) +CFLAGS-s_fromfpl.c += $(config-cflags-no-fp-builtin-inexact) +CFLAGS-s_fromfpxl.c += $(config-cflags-no-fp-builtin-inexact) +CFLAGS-s_ufromfpl.c += $(config-cflags-no-fp-builtin-inexact) +CFLAGS-s_ufromfpxl.c += $(config-cflags-no-fp-builtin-inexact) +CFLAGS-s_fromfpf128.c += $(config-cflags-no-fp-builtin-inexact) +CFLAGS-s_fromfpxf128.c += $(config-cflags-no-fp-builtin-inexact) +CFLAGS-s_ufromfpf128.c += $(config-cflags-no-fp-builtin-inexact) +CFLAGS-s_ufromfpxf128.c += $(config-cflags-no-fp-builtin-inexact) $(addprefix $(objpfx),\ $(filter-out $(tests-static) $(libm-tests-vector),\ From patchwork Thu Nov 20 18:30:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 124894 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 0A11F3856DFD for ; Thu, 20 Nov 2025 18:55:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0A11F3856DFD Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=W+cpw484 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by sourceware.org (Postfix) with ESMTPS id 6AA9D3856DCA for ; Thu, 20 Nov 2025 18:31:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6AA9D3856DCA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6AA9D3856DCA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::531 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663490; cv=none; b=f2eMYgNSR9PwLQLbtOtHeHogAyEJDYMIN8awOdRPCeEGvTEf65TXxByL1AnQ99XsMKWtGs6xFlldWrzGLpxtzFWxV8+OiG19KM4WCGJVR+G+VYOoB5HG3HjUIZOZ+4QcyTagw5RtrUfPaNPFXBx8NX4eMSJ7hoFa5n6tXJKEW0I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663490; c=relaxed/simple; bh=FQrmRUgkaAfUA6lE+ZQlQdDLDFTnyhoCqB9LeIoKK8w=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=bYxP1zKjDOoA/cQUsvzbR4HOn9eTf3Tom86kl8T4inKzXKi26/JygadvE/4r08oE8i1U7Hl0j/lFK/4D+wZ623ZhVR3V1SBpVG5AcyxohqmKTMsjgiVkw4wyequqk7zEFUcCmGJ1NMkGTu5GB7wZZsySbtFChNdDgAtuINtoLao= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6AA9D3856DCA Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-bc17d39ccd2so608562a12.3 for ; Thu, 20 Nov 2025 10:31:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763663489; x=1764268289; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tXAiE122uMHa2vjqS9vsipoHThZyDcAIaK3m/N6Yu+g=; b=W+cpw484aArIfMJbypd80ADMiENYNR8nsJJgPCG+Gid7CPkFNDl9eOClJhtQXfIrvm 632Rm2vMEk3+9dFPggnL+/oExTode4WI5BOC5pkbJ6//j3z5KtG+CrE2IVEvhrkZGTyg nVTysM2ltEXTOWJMyGTVeQGGl5j4mTUXqFECFoM/yc3rFeiMUEDMG0qErAE14+9yWwjY 6Y03jTa3i0dC8JIxgWYd10CtEkQmS6hjSocLkZAhJdKcHCcTRgsebBuhOSqmHvC6w7/B pI62tjDGRIrXCy8xUxY23szEU4GBmh3DS+2fTZCDxcUVwW+xjrrLgHWqwFOoVi7Pfh2J AlZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763663489; x=1764268289; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=tXAiE122uMHa2vjqS9vsipoHThZyDcAIaK3m/N6Yu+g=; b=JI0Rq9HbK+eyFlZR0a8+Mza/3N/6mw9zE6U24FltJTSfxwCDXj7wtxhbZhNlQbFah2 qjWkc8RIFdboESXsfiSwhd4Uf2k3aUMhAq23ax33oEfZ7ixrIaiYthsvSSfLr4FfFkvJ 1NUiwNGUGso56ZhhPK0T0MPm4e4hQmUTF/I/jOBjaYxuqA4H5Flm9vVRd8l6kzSHdAEU 3h4lEmzczZpTkKX6G7gyi14IfUsfZVFOEwIEdF0xdKI/SLMBp7R+EZPwqbnWHqPQ9hOr MiY27GVJB11hiJ8Pm3UVwG4V/xcun4P+/s3m86DV5HnJ3/LaTkbQKwqqaaBP3F5+bh2x uJMQ== X-Gm-Message-State: AOJu0Yy2JE4yZX9zcHrY4ANXvwkYDjvB5JrI+B+7M+Q4JHpZnd/8moF3 MabA3g/9gBtebmYubYuWPQYD+7MID9KDKPDhbyh/u02HobL0NeJRJjrlbauuaq3+Mgspfx/2xLW 13zIHdmA= X-Gm-Gg: ASbGncu8zTPqrMZ/SC7hReBYTnTSm5cTrdgcftgNFZ2M52gB0sebeToQHGqIy5y91vY XczHYekX6ScHAOjppvrWQDw7fyI4hjpuFM+ppCVeSM6qV7RHrUVtvsGiWZ3p71J13+hP/QrvQC+ F1yzGtTpIq0TvV7zhbF33RLd+L2X/kEYMS5P4gjT1yJYvYteFWLMUced4rWQ9zKBDxbV+SW7pRr Q0zzm/M36yj+lfEnvuCHeIHp0sv5ktdH+VgJWWQGleR6kOpAgG66LWZrnpmdyjMU0oN7AwG3Sn4 0nn0SOrziBd9n1whs/p7lQfB+gmMMfUspnZ9o+lGsbdNN5QJgde/2kOnkoetWdxpcGfU1E7j3eZ sjUaycYxnPuDqQvZM6G5BWV2zOw5uekr5xypVa+4Yb9tHLMcO+aQg7Mp2lvGbcrnvIwOCcNMb+D glXEpaZQpOZ7vHgH+cnng7tQ== X-Google-Smtp-Source: AGHT+IF5og59hgcbEjk/xsfOKvOVGiwPnDZxepZv0VnTMCfFjfZN8dDGuwGmOPCA4GEWE4NwlM9fHw== X-Received: by 2002:a05:7301:faa:b0:2a4:4884:e03d with SMTP id 5a478bee46e88-2a6fd02cd21mr1161488eec.11.1763663488921; Thu, 20 Nov 2025 10:31:28 -0800 (PST) Received: from ubuntu-vm.. ([187.11.52.82]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2a6fc5e3750sm9664359eec.6.2025.11.20.10.31.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 10:31:28 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Sam James , Collin Funk , "H . J . Lu" Subject: [PATCH v5 07/12] Enable --enable-fortify-source with clang Date: Thu, 20 Nov 2025 15:30:11 -0300 Message-ID: <20251120183107.2334580-8-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> References: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, 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 clang generates internal calls for some _chk symbol, so add internal aliases for them, and stub some with rtld-stubbed-symbols to avoid ld.so linker issues. Reviewed-by: Sam James --- debug/vasprintf_chk.c | 1 + debug/vfprintf_chk.c | 1 + elf/Makefile | 8 ++++++++ include/arpa/inet.h | 2 -- include/bits/inet-fortified-decl.h | 5 +++++ include/bits/stdio2-decl.h | 7 +++++++ include/bits/string_fortified.h | 15 +++++++++++++++ include/bits/syslog-decl.h | 4 ++++ include/bits/unistd-decl.h | 6 ++++++ include/bits/wchar2-decl.h | 5 +++++ include/stdio.h | 10 ++++++++-- include/unistd.h | 4 ---- include/wchar.h | 1 - inet/bits/inet-fortified.h | 2 ++ libio/Makefile | 1 + misc/syslog.c | 4 +++- string/Makefile | 1 + sysdeps/generic/symbol-hacks.h | 15 +++++++++++++++ .../ieee754/ldbl-128ibm-compat/ieee128-snprintf.c | 4 ++++ .../ieee754/ldbl-128ibm-compat/ieee128-syslog.c | 5 +++-- 20 files changed, 89 insertions(+), 12 deletions(-) diff --git a/debug/vasprintf_chk.c b/debug/vasprintf_chk.c index 41c15689ee..f86320cadb 100644 --- a/debug/vasprintf_chk.c +++ b/debug/vasprintf_chk.c @@ -35,3 +35,4 @@ __vasprintf_chk (char **result_ptr, int flag, const char *format, va_list ap) return __vasprintf_internal (result_ptr, format, ap, mode); } +libc_hidden_def (__vasprintf_chk) diff --git a/debug/vfprintf_chk.c b/debug/vfprintf_chk.c index 74b7c86add..999b6aa393 100644 --- a/debug/vfprintf_chk.c +++ b/debug/vfprintf_chk.c @@ -29,3 +29,4 @@ ___vfprintf_chk (FILE *fp, int flag, const char *format, va_list ap) return __vfprintf_internal (fp, format, ap, mode); } ldbl_strong_alias (___vfprintf_chk, __vfprintf_chk) +ldbl_hidden_def (___vfprintf_chk, __vfprintf_chk) diff --git a/elf/Makefile b/elf/Makefile index bcdc6aa625..07b456f4f5 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -1494,6 +1494,14 @@ rtld-stubbed-symbols += \ # rtld-stubbed-symbols endif +# These symbols might be emitted by the compiler when fortify is enabled +# (through builtins). +rtld-stubbed-symbols += \ + __GI___vfprintf_chk \ + __GI___vsprintf_chk \ + __GI___vsyslog_chk \ + # rtld-stubbed-symbols + ifeq ($(have-ssp),yes) # rtld is not built with the stack protector, so these references will # go away in the rebuilds. diff --git a/include/arpa/inet.h b/include/arpa/inet.h index 3db8f1a96f..7650e1acb5 100644 --- a/include/arpa/inet.h +++ b/include/arpa/inet.h @@ -14,12 +14,10 @@ libc_hidden_proto (__inet_aton_exact) extern __typeof (inet_ntop) __inet_ntop; libc_hidden_proto (__inet_ntop) -libc_hidden_proto (__inet_ntop_chk) libc_hidden_proto (inet_pton) extern __typeof (inet_pton) __inet_pton; libc_hidden_proto (__inet_pton) -libc_hidden_proto (__inet_pton_chk) extern __typeof (inet_makeaddr) __inet_makeaddr; libc_hidden_proto (__inet_makeaddr) diff --git a/include/bits/inet-fortified-decl.h b/include/bits/inet-fortified-decl.h index e6ad4d4663..1110ce49f2 100644 --- a/include/bits/inet-fortified-decl.h +++ b/include/bits/inet-fortified-decl.h @@ -1 +1,6 @@ #include + +#ifndef _ISOMAC +libc_hidden_proto (__inet_ntop_chk) +libc_hidden_proto (__inet_pton_chk) +#endif diff --git a/include/bits/stdio2-decl.h b/include/bits/stdio2-decl.h index bbb052f192..9758bf4b55 100644 --- a/include/bits/stdio2-decl.h +++ b/include/bits/stdio2-decl.h @@ -1 +1,8 @@ #include + +#ifndef _ISOMAC +libc_hidden_proto (__fgets_unlocked_chk) +libc_hidden_ldbl_proto (vfprintf) +libc_hidden_ldbl_proto (__vasprintf_chk) +libc_hidden_ldbl_proto (__vfprintf_chk) +#endif diff --git a/include/bits/string_fortified.h b/include/bits/string_fortified.h index 88bf073c9c..0cf0e76db1 100644 --- a/include/bits/string_fortified.h +++ b/include/bits/string_fortified.h @@ -1 +1,16 @@ +#ifndef _ISOMAC +# if IS_IN(libc) && defined SHARED +/* Redirect calls from __builtin_stpcpy_chk to internal __stpcpy when building + with fortify enable. */ +__asm__ ("stpcpy = __GI___stpcpy"); +# endif + +/* Add the internal aliass attribute to symbol before they first usage on the + fortify wrappers. */ +libc_hidden_builtin_proto (memcpy) +libc_hidden_builtin_proto (mempcpy) +libc_hidden_builtin_proto (memmove) +libc_hidden_builtin_proto (memset) +#endif + #include diff --git a/include/bits/syslog-decl.h b/include/bits/syslog-decl.h index 491a263777..762b289184 100644 --- a/include/bits/syslog-decl.h +++ b/include/bits/syslog-decl.h @@ -1 +1,5 @@ #include + +#ifndef _ISOMAC +libc_hidden_ldbl_proto (__vsyslog_chk) +#endif diff --git a/include/bits/unistd-decl.h b/include/bits/unistd-decl.h index 7fcbd272ac..dd6af7e4c8 100644 --- a/include/bits/unistd-decl.h +++ b/include/bits/unistd-decl.h @@ -1 +1,7 @@ #include + +#ifndef _ISOMAC +libc_hidden_proto (__read_chk) +libc_hidden_proto (__getdomainname_chk) +libc_hidden_proto (__getlogin_r_chk) +#endif diff --git a/include/bits/wchar2-decl.h b/include/bits/wchar2-decl.h index 00b1b93342..f3b8a8cf87 100644 --- a/include/bits/wchar2-decl.h +++ b/include/bits/wchar2-decl.h @@ -1 +1,6 @@ #include + +#ifndef _ISOMAC +libc_hidden_builtin_proto (__wmemset_chk) +libc_hidden_proto (__wcrtomb_chk) +#endif diff --git a/include/stdio.h b/include/stdio.h index 17bb5ffdb6..88166993dd 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -23,8 +23,12 @@ redirecting ldouble to _Float128 variants. We can therefore safely directly alias them to their internal name. */ # if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) -# define stdio_hidden_ldbl_proto(p, f) \ - extern __typeof (p ## f) p ## f __asm (__ASMNAME ("___ieee128_" #f)); +# ifdef SHARED +# define stdio_hidden_ldbl_proto(p, f) __LDBL_REDIR2_DECL (f) +# else +# define stdio_hidden_ldbl_proto(p, f) \ + extern __typeof (p ## f) p ## f __asm (#p __ASMNAME (#f "ieee128")); +# endif # elif __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # define stdio_hidden_ldbl_proto(p,f) __LDBL_REDIR1_DECL (p ## f, p ## f ## ieee128) # else @@ -70,10 +74,12 @@ extern int __printf_chk (int, const char *, ...); extern int __fprintf_chk (FILE *, int, const char *, ...); extern int __vprintf_chk (int, const char *, __gnuc_va_list); extern int __vfprintf_chk (FILE *, int, const char *, __gnuc_va_list); +stdio_hidden_ldbl_proto (__, vfprintf_chk) extern char *__fgets_unlocked_chk (char *buf, size_t size, int n, FILE *fp); extern char *__fgets_chk (char *buf, size_t size, int n, FILE *fp); extern int __asprintf_chk (char **, int, const char *, ...) __THROW; extern int __vasprintf_chk (char **, int, const char *, __gnuc_va_list) __THROW; +stdio_hidden_ldbl_proto (__, vasprintf_chk) extern int __dprintf_chk (int, int, const char *, ...); extern int __vdprintf_chk (int, int, const char *, __gnuc_va_list); extern int __obstack_printf_chk (struct obstack *, int, const char *, ...) diff --git a/include/unistd.h b/include/unistd.h index 376ab5a936..c1a4736951 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -32,10 +32,6 @@ libc_hidden_proto (readlinkat) libc_hidden_proto (fsync) libc_hidden_proto (fdatasync) -libc_hidden_proto (__read_chk) -libc_hidden_proto (__getdomainname_chk) -libc_hidden_proto (__getlogin_r_chk) - /* Now define the internal interfaces. */ extern int __access (const char *__name, int __type); libc_hidden_proto (__access) diff --git a/include/wchar.h b/include/wchar.h index bf32625736..6abb0d2697 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -166,7 +166,6 @@ libc_hidden_proto (putwc) libc_hidden_proto (mbrtowc) libc_hidden_proto (wcrtomb) -libc_hidden_proto (__wcrtomb_chk) extern int __wcscmp (const wchar_t *__s1, const wchar_t *__s2) __THROW __attribute_pure__; diff --git a/inet/bits/inet-fortified.h b/inet/bits/inet-fortified.h index cc476ebcfd..0919bc9779 100644 --- a/inet/bits/inet-fortified.h +++ b/inet/bits/inet-fortified.h @@ -45,6 +45,7 @@ __NTH (inet_pton (int __af, __fortify_clang_warning_only_if_bos0_lt (4, __dst, "inet_pton called with destination buffer size less than 4") { +#if !__fortify_use_clang size_t __sz = 0; if (__af == AF_INET) __sz = sizeof (struct in_addr); @@ -52,6 +53,7 @@ __NTH (inet_pton (int __af, __sz = sizeof (struct in6_addr); else return __inet_pton_alias (__af, __src, __dst); +#endif return __glibc_fortify (inet_pton, __sz, sizeof (char), __glibc_objsize (__dst), diff --git a/libio/Makefile b/libio/Makefile index 2bc9836522..f946cd311b 100644 --- a/libio/Makefile +++ b/libio/Makefile @@ -60,6 +60,7 @@ routines_no_fortify += \ iofgets_u \ iofgetws \ iofgetws_u \ + iovdprintf \ swprintf \ vasprintf \ vsnprintf \ diff --git a/misc/syslog.c b/misc/syslog.c index 53bb334259..b7414e7b43 100644 --- a/misc/syslog.c +++ b/misc/syslog.c @@ -114,10 +114,12 @@ ldbl_hidden_def (___syslog_chk, __syslog_chk) ldbl_strong_alias (___syslog_chk, __syslog_chk) void -__vsyslog_chk (int pri, int flag, const char *fmt, va_list ap) +___vsyslog_chk (int pri, int flag, const char *fmt, va_list ap) { __vsyslog_internal (pri, fmt, ap, (flag > 0) ? PRINTF_FORTIFY : 0); } +ldbl_hidden_def (___vsyslog_chk, __vsyslog_chk) +ldbl_strong_alias (___vsyslog_chk, __vsyslog_chk) void __vsyslog_internal (int pri, const char *fmt, va_list ap, diff --git a/string/Makefile b/string/Makefile index 2f30e66df5..7c0245452b 100644 --- a/string/Makefile +++ b/string/Makefile @@ -121,6 +121,7 @@ routines := \ # Exclude fortified routines from being built with _FORTIFY_SOURCE routines_no_fortify += \ + bzero \ explicit_bzero \ memcpy \ memmove \ diff --git a/sysdeps/generic/symbol-hacks.h b/sysdeps/generic/symbol-hacks.h index 1115e4c0a7..58398d33a5 100644 --- a/sysdeps/generic/symbol-hacks.h +++ b/sysdeps/generic/symbol-hacks.h @@ -6,6 +6,21 @@ asm ("memmove = __GI_memmove"); asm ("memset = __GI_memset"); asm ("memcpy = __GI_memcpy"); +/* clang might generate the internal fortfify calls when it is enabled, + through the buitintin. */ +asm ("__vfprintf_chk = __GI___vfprintf_chk"); +asm ("__vsprintf_chk = __GI___vsprintf_chk"); +asm ("__vsyslog_chk = __GI___vsyslog_chk"); +asm ("__memcpy_chk = __GI___memcpy_chk"); +asm ("__memmove_chk = __GI___memmove_chk"); +asm ("__memset_chk = __GI___memset_chk"); +asm ("__mempcpy_chk = __GI___mempcpy_chk"); +asm ("__stpcpy_chk = __GI___stpcpy_chk"); +asm ("__strcpy_chk = __GI___strcpy_chk"); +asm ("strcpy = __GI_strcpy"); +asm ("strncpy = __GI_strncpy"); +asm ("strcat = __GI_strcat"); + /* Some targets do not use __stack_chk_fail_local. In libc.so, redirect __stack_chk_fail to a hidden reference __stack_chk_fail_local, to avoid the PLT reference. diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c index d458da7903..f880a55e0b 100644 --- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c +++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c @@ -33,3 +33,7 @@ ___ieee128_snprintf (char *s, size_t maxlen, const char *format, ...) return done; } strong_alias (___ieee128_snprintf, __snprintfieee128) +ldbl_hidden_def (___ieee128_snprintf, ___ieee128_snprintf) +#ifdef SHARED +strong_alias (___ieee128_snprintf, __GI____ieee128___snprintf) +#endif diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-syslog.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-syslog.c index 197b149d0f..e08ae3aa28 100644 --- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-syslog.c +++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-syslog.c @@ -56,7 +56,7 @@ hidden_def (___ieee128___syslog_chk) strong_alias (___ieee128___syslog_chk, __syslog_chkieee128) void -___ieee128___vsyslog_chk (int pri, int flag, const char *fmt, va_list ap) +____ieee128___vsyslog_chk (int pri, int flag, const char *fmt, va_list ap) { unsigned int mode = PRINTF_LDBL_USES_FLOAT128; if (flag > 0) @@ -64,4 +64,5 @@ ___ieee128___vsyslog_chk (int pri, int flag, const char *fmt, va_list ap) __vsyslog_internal (pri, fmt, ap, mode); } -strong_alias (___ieee128___vsyslog_chk, __vsyslog_chkieee128) +strong_alias (____ieee128___vsyslog_chk, ___ieee128___vsyslog_chk) +strong_alias (____ieee128___vsyslog_chk, __vsyslog_chkieee128) From patchwork Thu Nov 20 18:30:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 124891 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 0D3493858C53 for ; Thu, 20 Nov 2025 18:52:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D3493858C53 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=j2M3NqE3 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 51245385AC1C for ; Thu, 20 Nov 2025 18:31:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 51245385AC1C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 51245385AC1C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::42f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663492; cv=none; b=m/s+bZz59jfF9dDTP5Iow8Zo2TjlXzXmURcLuzltNH8OamJPHPrteIapvvE00E7l7qe6hFQGmBI87VHlNPnyt4/8OrjzLqIbcaIKwqUstz8O7Qq2AncgRjv6o/c7pVm68i0N6DX6ipagP5dcjgQ9VUiJHV6D8eemKzdOdEhhJso= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663492; c=relaxed/simple; bh=f+v6ihH0sZ67u1ef+LwW/MXeQ1Cp3kIxbad5aeZtObs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=J3hdTmPQIDXFtIY0ova0mODMKkTIZwtoaY7z/mJt9sXYaybOMhKgiFKqheSLGG3rydRKCdP4A7autZK1b8boTNfDl28+UTDP7XvzKhAwl+0DD4UwKzlg6nfhykHMpLrnuAavstFfbxqwqEinAkuEMu0xwDQAkoUfOMj8PdU8Xb4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 51245385AC1C Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-7b9215e55e6so865470b3a.2 for ; Thu, 20 Nov 2025 10:31:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763663491; x=1764268291; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JK9Re5aHRWfscc7kpQVGBJOzOGmymFItZge4hodybdY=; b=j2M3NqE3740gFNkIARsLtlZHYlTCkKvHLfb4FD+ahkFjOm8eFrM2JPLRNhEzDBBpqF Q/g6dTcgo3zhShXR3XF349EU2SKqg9Z8C3CyMJhIeVfdBXXDGvL5bcj09KnA+UjItEVQ LFwFw3ouLdAJX0RJi6BtN6OxSo5RbaTOwD5IkjCznrKgL0frF8wK97hE04j8DGolNR6/ 0uaMOOF1ZPr5lrKv54OrAJgBnVIOht+hHNejMRgaXnoURdg1/TX1k5lxOleWdNqo0D9A 6e72mwhoxBQ8qKL8Br7CYcWc6aifFvVxzKpGc+KDYpB/+vOX/3RIM17CAIe2qsIwMZpv Qvdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763663491; x=1764268291; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=JK9Re5aHRWfscc7kpQVGBJOzOGmymFItZge4hodybdY=; b=BAgd+KNehH9NomGB4tlEKEyGVpLqhX/0xYY26pynY3VCMmtey3CZ9Bp+/8ECY9zn03 H34e0GNQ3vZXOhkU1saOAoz2e4zVSec5hv/gIWzNuQsQ4RbqV2bNjgxQgrgHxFlQc79d UneJ7cus0mUEj+A4yTH3V9TEEHsbAnBJHJHh8TawjVEc48cjM/Uq4tCjwbp+Bfazckwq KcC99nP3L7PB4nq5NmYKkby679c0/DmzeXZNwGljtjO0yCw3QBUhrpURrXmBaXYc8knZ JylUPq11iGGsMWSae9k8/EwdVq8TQ87mT45tGq9fUhgVkGrdhrOp+ihjIL4vh7Um9OaT HbDA== X-Gm-Message-State: AOJu0YwjEtaNrbT60ufR1GazSQpXBjz5hbesA+EPdILuCuQ0HDpZIMqd GrAF+GV3tQV/UKGBGuMo7BkH+mRPE1Iwc8J/aVp4rbanstFMdgRoY2YgeFbiQrtdyLFcMJNKYNW oV4vz7B4= X-Gm-Gg: ASbGnctYYr3h7MBR5lDsnqi9Xl6v4FcuOkcz5jkIEYWoHbMe0zHRfapkwXRshELAASi uy0lgqexRuk9Cl1o5VoOoolxpR0/R0wdpTactykYCM3Hww6nWFMdBNhlc8QuSvJINyFlae0kHPg juAnioSUvgIS/9nIZXuS5rzz8m+BsLJ2+vivEG/R2VXBAcaTuLjoEKckDxyOkeOvzwWJDjqrXQV qnm7EbBpTCuo5YCBx94eaQqbH8D4lkMsEnNswJUDQtj6aoAJnjN+LK2X1Qn5AKMG4LltloZ9Nv/ FLN0Irgquv8N8jD0gqOhKHW7XLvC6IEbce/VX4MWrykrj/9Z8XQ423IznnxTiqWL7iPtMjwPyau SluR27w/5V52PrTCGsPDqxF9c6D11eooU+RzZiTKeUYeiOa8FtqGbkvluzyLnUE8f4UKRU0qN32 MMYHwIVwBbqPyMbYYsmM5C28NDs2RynBCP X-Google-Smtp-Source: AGHT+IGT/cBpehYL16kDeKqBpkDOqVgJ1y7WzPUy2vG0BLPwWF52xJdrOZvOaUJq1TEcyZ29W9vTuA== X-Received: by 2002:a05:7022:3717:b0:119:e56b:98b8 with SMTP id a92af1059eb24-11c938920fbmr969869c88.31.1763663490899; Thu, 20 Nov 2025 10:31:30 -0800 (PST) Received: from ubuntu-vm.. ([187.11.52.82]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2a6fc5e3750sm9664359eec.6.2025.11.20.10.31.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 10:31:30 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Sam James , Collin Funk , "H . J . Lu" Subject: [PATCH v5 08/12] benchtests: Use __f128 on ilogbf128-inputs constants Date: Thu, 20 Nov 2025 15:30:12 -0300 Message-ID: <20251120183107.2334580-9-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> References: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, 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 The f128 is not a valid floating constant suffix on clang. Reviewed-by: Sam James --- benchtests/ilogbf128-inputs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/benchtests/ilogbf128-inputs b/benchtests/ilogbf128-inputs index bfbfc93714..596ab4f513 100644 --- a/benchtests/ilogbf128-inputs +++ b/benchtests/ilogbf128-inputs @@ -3,9 +3,9 @@ ## includes: math.h ## name: subnormal -6.47517511943802511092443895822764655e-4966f128 -0x1.fffffffffffffff8p-16383f128 +__f128(6.47517511943802511092443895822764655e-4966) +__f128(0x1.fffffffffffffff8p-16383) ## name: normal -1.0 --0x8.2faf442f390a9211f5af128673fp+0L +__f128(1.0) +__f128(-0x8.2faf442f390a9211f5af128673fp+0) From patchwork Thu Nov 20 18:30:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 124895 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 4A555385703C for ; Thu, 20 Nov 2025 18:57:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A555385703C Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=lJ5Y5oiQ X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by sourceware.org (Postfix) with ESMTPS id 6E8833856946 for ; Thu, 20 Nov 2025 18:31:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6E8833856946 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6E8833856946 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::52d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663494; cv=none; b=qIGhXx4SUcHPt4tL9kPacz57muf7aWM1/nKL/Yqk7QfDjIbMJL9e+jKHXx4ohUTF7UbNLd+kzDUSqytsWhNKtFqyvwvgf0vsLUNUXdgxgHxtfjVZcyAljKmLyw97b3SXp2CvfQr6HlKSHZG6M9fSNLwoGba5GPZYkn2syBnELFg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663494; c=relaxed/simple; bh=+o7oYr7pyRgMDTyi+4PJEFGOd1IxM2y5XAb6pUsKAwY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=KUwOBGBvuZNLNL4xT55GPKmX0Cac+At4F4kLD6Grb2YK17oHPDOrVHm/0FyH7PMZHFpBMRIszPgvN1NSL3ywcxNNgoBD/khWdsf/ddHxgc1543NFWJJD3qTq43c1QhbEeatB+Kum/p2UpOFq9GS1x5p7k6WTN53HoCxH7vWWtfc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6E8833856946 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-bc59a785697so1126501a12.0 for ; Thu, 20 Nov 2025 10:31:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763663493; x=1764268293; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZnETExDeb0RdT9wZ9Y8veW/W/KtLE/h6bka8j17/T1Y=; b=lJ5Y5oiQhho3agoufMtsvWLpu8JBxx0eQ+B3o4jU2gPZepDKk27xDM06lyfaa2pvI0 Lb+qbHIUCiq9o/R5NuqIa5uvPklqDlq3Gn68tHdgbdW2+QCTYxccIAb+nhwVws7JfVoy tFKSLgnV4n0SjZGCOkz3rfx7WTuudfxIAb5+Q1hyiKVSK+6vd4fLD48mdc725hXCEZXm vaGeRueG4Y8ISjV69kCgYyDjnv9Y6bQLjUlgSp7fnsuEtThY105fU/mKDP7/EqSCSkgb ZA5jrS/hmGX2Ezrs7+SRlVHWdMBgbnfOJdr9xfjcyEColUR0B+JZuskI6tjYvvbDkz8o pKwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763663493; x=1764268293; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ZnETExDeb0RdT9wZ9Y8veW/W/KtLE/h6bka8j17/T1Y=; b=WrHiaNf5rnDl74Ph0HjTi3Ztjzr6cBU+CjFGJIH244Cur77RZNS/KtOUrWXS1YKamg XGyg2GCwrHQfzrpGLDi2EoK3WInXHm6M4QLYxOaQexx0IJxZhO3ktVJjm4yHYF/HCZSR CjiZBRYsNLt2YuqFp80IHDP/hhHU+3SjK50ORKet7d+aQ37001GxNMYd0YEiZirMgbj9 HFKaczepbiw7d2ICie5KAKvjDxe5bQZ27YpEZ0TwxyZvvRJ3mTUHD6NQO9EG+HXIEC2t 7Nx021xsbcgJA9GUzcJkn3fd6wGVDTNegWKA+g7ebjemDTak7vd38QC23mtrFnhrsSV4 KHvw== X-Gm-Message-State: AOJu0YyFgJ3zlopGuGSqoQOm3zp5gb0M38sFH91e5u+hUJlhksfWTBq1 iGuIWCbzadoGDOucJI7IHKJF1rLYocpNUb6f51eqTZ2NZEbjgqEbJvuoogIAOQJ9zvsmRr4p9MN IW3qbK0s= X-Gm-Gg: ASbGncsUnW37n432GbyGG2Gba5fqvAEXRkTysc5A8J8ULLrVoF+QqntV2IpdGBaOzsi siLrRmaZHOhz4KIllYPB8SUttlZgI/A5XyW2ZdbdyxNXRyz3jUeFbI2I4Qs/FL6hZkLTRlwVvia I1Drk70IirObvNTkVyIG8qD6alC40rB2M6MDUPEyBCQ/Y01cxoBS1u+wbVtSTcVYM9Rekdr7Nzn oxWjPx0knV9dqHyHlvqwmm+rTVUS4uJc8yEjriP0nGPxGx03lbP4A96u9QbCQ7pTxGGoQnp1bmU EZKR5GZWq22ORpHWVPXW1hWy+absBbTDOmIMAxHdeuLC9V+ycXawlk7fbdDoMNXakNiX/5/pYtu 0ozLtnaRalMiFP3jpyfPq20Q0GcoXF+0bP17NXR3ReLT4vSQrwvYx23/4UHJD6xP1wjE/YAvJBF uAF3oL16hnDsDWi0rjXP72gA== X-Google-Smtp-Source: AGHT+IHbungSmc1ai/IedVG7LaywvI88uI/fr9Nt1szCyQ3ZZdgYiqgiREZR3ZERlKNLCOK1aK3Usg== X-Received: by 2002:a05:7301:490a:b0:2a4:4f6c:53b4 with SMTP id 5a478bee46e88-2a7013cfbfamr765930eec.11.1763663493025; Thu, 20 Nov 2025 10:31:33 -0800 (PST) Received: from ubuntu-vm.. ([187.11.52.82]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2a6fc5e3750sm9664359eec.6.2025.11.20.10.31.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 10:31:32 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Sam James , Collin Funk , "H . J . Lu" Subject: [PATCH v5 09/12] benchtests: Add attribute_optimize Date: Thu, 20 Nov 2025 15:30:13 -0300 Message-ID: <20251120183107.2334580-10-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> References: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, 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 Similar to tst-printf-bz18872.sh, add the attribute_optimize to avoid build failures with compilers that do not support "GCC optimize" pragma. Reviewed-by: Sam James --- benchtests/bench-pthread-lock-base.c | 11 +++++------ benchtests/bench-pthread-locks.c | 10 +++------- benchtests/bench-util.h | 6 ++++++ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/benchtests/bench-pthread-lock-base.c b/benchtests/bench-pthread-lock-base.c index 5386addf04..c8c90c7d6a 100644 --- a/benchtests/bench-pthread-lock-base.c +++ b/benchtests/bench-pthread-lock-base.c @@ -28,6 +28,7 @@ #include #include #include "bench-timing.h" +#include "bench-util.h" #include "json-lib.h" static bench_lock_t lock; @@ -36,10 +37,8 @@ static pthread_barrier_t barrier; #define START_ITERS 1000 -#pragma GCC push_options -#pragma GCC optimize(1) - -static int __attribute__ ((noinline)) fibonacci (int i) +static int __attribute__ ((noinline)) attribute_optimize (1) +fibonacci (int i) { asm(""); if (i > 2) @@ -48,6 +47,7 @@ static int __attribute__ ((noinline)) fibonacci (int i) } static void +attribute_optimize (1) do_filler (void) { char buf1[512], buf2[512]; @@ -56,6 +56,7 @@ do_filler (void) } static void +attribute_optimize (1) do_filler_shared (void) { static char buf1[512], buf2[512]; @@ -63,8 +64,6 @@ do_filler_shared (void) memcpy (buf1, buf2, f); } -#pragma GCC pop_options - #define UNIT_WORK_CRT do_filler_shared () #define UNIT_WORK_NON_CRT do_filler () diff --git a/benchtests/bench-pthread-locks.c b/benchtests/bench-pthread-locks.c index 8971c77da9..6f219db999 100644 --- a/benchtests/bench-pthread-locks.c +++ b/benchtests/bench-pthread-locks.c @@ -29,6 +29,7 @@ #include #include #include "bench-timing.h" +#include "bench-util.h" #include "json-lib.h" /* The point of this benchmark is to measure the overhead of an empty @@ -61,10 +62,7 @@ typedef timing_t (*test_t)(long, int); total time each test iteration takes, so as to not swamp the useful timings. */ -#pragma GCC push_options -#pragma GCC optimize(1) - -static int __attribute__((noinline)) +static int __attribute__((noinline)) attribute_optimize (1) fibonacci (int i) { asm(""); @@ -73,7 +71,7 @@ fibonacci (int i) return 10+i; } -static void +static void attribute_optimize (1) do_filler (void) { static char buf1[512], buf2[512]; @@ -81,8 +79,6 @@ do_filler (void) memcpy (buf1, buf2, f); } -#pragma GCC pop_options - static timing_t test_mutex (long iters, int filler) { diff --git a/benchtests/bench-util.h b/benchtests/bench-util.h index 02180c3887..819fb3482a 100644 --- a/benchtests/bench-util.h +++ b/benchtests/bench-util.h @@ -24,6 +24,12 @@ __v; \ }) +#if __GNUC_PREREQ (4, 4) || __glibc_has_attribute (__optimize__) +# define attribute_optimize(level) __attribute__ ((optimize (level))) +#else +# define attribute_optimize(level) +#endif + #ifndef START_ITER # define START_ITER (100000000) #endif From patchwork Thu Nov 20 18:30:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 124884 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 4AC59385AC1C for ; Thu, 20 Nov 2025 18:37:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4AC59385AC1C Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=aDulpJPI X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by sourceware.org (Postfix) with ESMTPS id 7C773385AC27 for ; Thu, 20 Nov 2025 18:31:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7C773385AC27 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7C773385AC27 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::52a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663496; cv=none; b=MzEaeHSCs0m3p5rSd47vcvMEtuR87LmmHoxvJQvvG33o1CP1Wt2WzdDbunAzTlMd8F1fv+RRsqsZPEtCakgC81WnatjYKCGv+UwK7qKzwkj3UXg+aAzqc24QypRHfZxcEaLoYbryreliOFAQdyjF55zslg7CWK84PnzdnuBTBHs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663496; c=relaxed/simple; bh=DrPa2J1ZEeMuyqnjNlyc3VM2bIrqbgDUuT40kclAxVI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=OxwabJhfdLaEslrQ5BW5GPq0/IewgYUVQuVVYuTd0gnnltaPbS/HCIPtIrs4TLReBEAcYZX98gO7mfiVPudMnRdlnkLrZ6EIjT3L8CF06fT+DrGwFECL9E7OmPOAoU7kvG9ix+7TfUI8J24vITtFVOMVNlY1daBFx9Vb71rmUOc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7C773385AC27 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-bc29d64b39dso734740a12.3 for ; Thu, 20 Nov 2025 10:31:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763663495; x=1764268295; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YaYy4frG7pl89IT/6/18RdK5TOKziQ2ogyrtc+CULX0=; b=aDulpJPIdzxfFxLUnGZfThz+yCWn5Ic/9Q8H3H6+vslLsSfAaVPl/K122g5wlDdOlp 01Qwipmbg6vwgmP/Wr0eXdYqUrQhnQBq9halMbgZqTwimDEXoxT8irv5tLGlli+M0+aC MY+IMEfMQIk8IaP0GVRLE121DCTzOn93DC7gVVL3ExHM9UdYchUDABcsE2HZ/PirLM2b xn3lzr0JxAJp2II2H2zTLO7pC+shIyBlzojVghBcHKfpj8exW/pQAGcl1fA8AXY7XZ+J OZfm9PrTiPLefLaFZhFV6YhX0ftQqCRhH8zKewBppwjfbK3vwrl6VBtZtziKb4cSbfL9 lkHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763663495; x=1764268295; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=YaYy4frG7pl89IT/6/18RdK5TOKziQ2ogyrtc+CULX0=; b=BOEQuvYsKVFikQJKuxXDTURidpTILHgRUiGnnkBXw3n4eBAlFJAzHGR2SOS8R60yMq 0F0G8RgXfrqS2K0Ix6MBwCmviS7H5FZMSzMDAI81NSvu8wGxr2QWQJv3am4tBAGvsylQ NMfSFDaFz6q0F0UsoOTbDJIWYUkZ+2cBTigmKrtBjMVVu2PCxeb+BTs8VZdqKR8m0WjW R8guXBcyE3HMkkDy69K4VKhRV6yjwhI4wqSkYRcKglazlLWO2eS4iCnJaU/6bRdRv3o4 aIg8Q5IATwtVOdKBCnhHezeJtKp9e1fX3ZUyqn8N6LRaw8AUUQxgkV0Be1cT53JXfYgt rLlg== X-Gm-Message-State: AOJu0YyBODjIza1c8DwcPZmTcL4iumE6pPTdPgPPsg57IgJhoArabqrM 9SK1ripu1a1CNpiNiv+jfG6YkUNNwZ3C6mCGb5sX2MCq2llMYLqBZhAOj3UAd2E5ivuYCA5791a m8YzpVNw= X-Gm-Gg: ASbGnctfHIN2kISfxSny1OlbOIM8VH3MslowAQSSgp0Y1VbsSr9pR6kjkrQFc4FIo+b qMzp12mWDpgBD8dAgdO3InjXj+xn9PKbeBXTCWWkWeHi3Mhg+hltDearfKcL80/dWwmKKkuB4Ua LQX5WPGksVts2MKCJQz8D6qSlmuFfhM8Skp0OxHbX+pJMhnXU7l7c0jIwPnwsPGs+4ZWMTQBLi5 bunYm4cimraau6WPptUuPMsBXdxr1ipNiopcSDHp+Y6qoelO5iXH5blqk68EGJwE1RmuDAUTCs2 jOzDs4hv9axMuAwuP4AN+vQgZNw79wXjR13/lp8B8aj97/1m3Kp8faY8USR/8jkAJW2HXuGQe5J qoAFIBRlm5Kfsk5Z9apaeFF+WA0P3g7O/kFqcoVafQHYH++DGbKVa7hSYFyQIVkSy498M39sRT5 oFPzlE5HzSoOm9zRsZ0hMwVsxAe/1h6OAb X-Google-Smtp-Source: AGHT+IH43XePjKLCIGDGOSZugWsUo6hhN/AfFXoXM8Pf6yL/WwRMJfgaaniZJEm5s6t+I461kzBNNA== X-Received: by 2002:a05:7022:90c:b0:11b:c2fd:3960 with SMTP id a92af1059eb24-11c93888cadmr1415592c88.28.1763663495120; Thu, 20 Nov 2025 10:31:35 -0800 (PST) Received: from ubuntu-vm.. ([187.11.52.82]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2a6fc5e3750sm9664359eec.6.2025.11.20.10.31.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 10:31:34 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Sam James , Collin Funk , "H . J . Lu" Subject: [PATCH v5 10/12] benchtests: Remove clang warnings Date: Thu, 20 Nov 2025 15:30:14 -0300 Message-ID: <20251120183107.2334580-11-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> References: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, 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 clangs warns of the implicit cast of RAND_MAX to float: error: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Werror,-Wimplicit-const-int-float-conversion] So make it explicit. Reviewed-by: Sam James --- benchtests/bench-malloc-thread.c | 2 +- benchtests/bench-strchr.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/benchtests/bench-malloc-thread.c b/benchtests/bench-malloc-thread.c index 7759c61847..2371c42e65 100644 --- a/benchtests/bench-malloc-thread.c +++ b/benchtests/bench-malloc-thread.c @@ -68,7 +68,7 @@ get_block_size (unsigned int rand_data) float min_pow = powf (dist_min, exponent + 1); float max_pow = powf (dist_max, exponent + 1); - float r = (float) rand_data / RAND_MAX; + float r = (float) rand_data / (float) RAND_MAX; return (unsigned int) powf ((max_pow - min_pow) * r + min_pow, 1 / (exponent + 1)); diff --git a/benchtests/bench-strchr.c b/benchtests/bench-strchr.c index 63bb9552de..734d44b6de 100644 --- a/benchtests/bench-strchr.c +++ b/benchtests/bench-strchr.c @@ -100,7 +100,7 @@ do_one_rand_plus_branch_test (json_ctx_t *json_ctx, impl_t *impl, const CHAR *s, const CHAR *c) { size_t i, iters = INNER_LOOP_ITERS8; - int must_execute = 0; + volatile int must_execute = 0; timing_t start, stop, cur; TIMING_NOW (start); for (i = 0; i < iters; ++i) @@ -166,7 +166,7 @@ do_rand_test (json_ctx_t *json_ctx, size_t align, size_t pos, size_t len, buf[align + len] = 0; buf[align + pos] = 1; - perc_zero_int = perc_zero * RAND_MAX; + perc_zero_int = perc_zero * (float) RAND_MAX; for (i = 0; i < NUM_SEARCH_CHARS; ++i) { if (rand () > perc_zero_int) From patchwork Thu Nov 20 18:30:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 124886 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 3CBE9385697E for ; Thu, 20 Nov 2025 18:40:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3CBE9385697E Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=TMOWnr4z X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 5DCF8385696F for ; Thu, 20 Nov 2025 18:31:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5DCF8385696F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5DCF8385696F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::436 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663498; cv=none; b=HwAKBPwqAAnSv1AkiKTMeHk4FFfMWl6Y44oT83buK35QpVvDFHl+BAaLQx19UOY4LLjK20seGL66ML3+BBUeTafR5FbZAiD4jOeIgBsJC2jZheVldJuhsiiZKAmmZyq0KaeJjEdNkr3MkqWQQO25Qmzp2z9IbyRyrFl3PQbYz50= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663498; c=relaxed/simple; bh=kYtvfwIja+ThJ3MDI8RdYGDw9ckUxsojehtbKonJFyM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=jpbJsj9yNTGJHZH+0v89I6NEvuslcUWEY/T0ejFTsSTi+aBAIyJbLbGQ2OYkiXz2lZ+/cts8IplTSdoBuanLwU0PcPPH6g+rWQUmnLG8kxgQCL1PfZf2zkjQP41RLrd7Rm2J3puyipIy9mZDNifTFvfqZS6eNUo08tKzEEzgY8U= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5DCF8385696F Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-7aad4823079so1061229b3a.0 for ; Thu, 20 Nov 2025 10:31:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763663497; x=1764268297; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DSKjZL/wK1SXJC3hn0MfMhSaRleOvduoSbNSoALsx3U=; b=TMOWnr4ztROiIlh7bJ1xXW5VLVJLC96+4Q//TVDxv4ZSlycptBeNlZ78107869NTEt qFHowq7yeurS89wSKqGumAIAMy9rXb/aYcitM6+2kTWk4aU0glccuZt2qOIMFbdW5Zkm glg9bkKY9HyiK5pJfVOb2AGrk88Cfu5wVkNinYJFbSlj/ZBXlEz7fIpwe+6C9GuJF1Vq SeSjvB5cwOKkmb+btnbvXg4vYIbJ67vDUDZ0yaaxD8VFaVZ7qUuUCLWAgaQdTEnwDxiD s4F7BIELm4Oa6fLekLPGDVt4hXd0nlTiDmFAxEDSMfJBATWZ9Cqj9bUxQDb0OK5hLLqD wbyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763663497; x=1764268297; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=DSKjZL/wK1SXJC3hn0MfMhSaRleOvduoSbNSoALsx3U=; b=bwQhxamMrnXBKzo71PeN8cYUXBdKi7RuIWGvjj118QQEX5HOJwjpsfYpApjv+jtrHh ArwaVRVIK2/5wweE1z0q3gPRQsiByP92Kv2DV4LP1N9FGad4/0J4nl0wqIs15hqCreWj 8gNnm13JOKqCW6rAX3hM+s0wwFqIexX8DjI+rUq9Dfd+QKb2z/Vs6isbAJgBPw3384B+ dTdOP1aBbuTEMn13PPudsaiFu1nf8eEodKhlwSyANnDqb8fbeABYAtBYd1utrcpbjPuW hhGbolajAFKvUxy8cz3MMHilPXyObkpZoTiDNgpqQWd0y4aEcJiwIzCA3L0gMSr0fcy/ ogvA== X-Gm-Message-State: AOJu0YzvQK5KeyT6dZWJruuA/ZZHzwPtA8z/IGhlT6kSDri6hjCWEbBa Nb5OxfR6HSYWcxzyESqbde8FshS/k2GDdDs0JsBjg3S7ZleqzPjvlqvjPyZpRpcCxsKHH2FrQOg KT8+ORVw= X-Gm-Gg: ASbGncuGzmGfgAgPS1WqkrjtPkhwuVlsdWDaPjegh2c4PEpQq9Nb0Z+mMNehaSsKwk+ vcOA9fHgHu01SajvsJZ/VJvo6TuOZ+w5C9clc1HwSFrUqlE3iq58gEb0tipfS02pvuc14E3NOA4 j1EwlU6ORMmmwB0f/5Q34oSAPJIQ/LXqMW87SKKv1xArsfCbEG/h9WfgoLkDwefQiyaTZodr1cC H+gZ3qppUm2pYwTSvESZpUetFGTUUIe5g6hbn4eYxYLx4pDoLwIi0hVeR3m14JJVMwe+LKai3Wi 8XzVpca9NkzQHTch5XoMtJrA/oL6lAHOOYusBtIwHTb/p30QnQf5SBWKUe+EWuALmn37M9YuJoq oKfEp8G9Lstip4YA0FFKoHZLdYalj5YIHLKrmTp5KH1c/FGiuiI+ptIc0sx9PWxaaLiAqlMRTuG 8/b1rZQyS7FNzYae5suW0ruQ== X-Google-Smtp-Source: AGHT+IGmSp4sMFj13OJGqccNbzTqVALUUYliIjcQkBcFG4TuYpCVitHXUWuMMq0pg/ZoFK3aTyjZXw== X-Received: by 2002:a05:7023:d0c:b0:11b:923d:7753 with SMTP id a92af1059eb24-11c9380d1f0mr1004131c88.3.1763663497067; Thu, 20 Nov 2025 10:31:37 -0800 (PST) Received: from ubuntu-vm.. ([187.11.52.82]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2a6fc5e3750sm9664359eec.6.2025.11.20.10.31.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 10:31:36 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Sam James , Collin Funk , "H . J . Lu" Subject: [PATCH v5 11/12] bench-malloc-thread: Add libm for powf Date: Thu, 20 Nov 2025 15:30:15 -0300 Message-ID: <20251120183107.2334580-12-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> References: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, 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 The compiler might not constant fold the call, which issues linker error. Reviewed-by: Sam James --- benchtests/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/benchtests/Makefile b/benchtests/Makefile index 0d3dfdfc36..b740ea15a7 100644 --- a/benchtests/Makefile +++ b/benchtests/Makefile @@ -393,6 +393,8 @@ $(addprefix $(objpfx)bench-,$(bench-pthread)): $(thread-library-benchtests) $(addprefix $(objpfx)bench-,$(bench-malloc)): $(thread-library-benchtests) $(addprefix $(objpfx)bench-,pthread-locks): $(libm-benchtests) $(addprefix $(objpfx)bench-,pthread-mutex-locks): $(libm-benchtests) +$(addprefix $(objpfx)bench-,malloc-thread): $(libm-benchtests) +$(addprefix $(objpfx)bench-,calloc-thread): $(libm-benchtests) From patchwork Thu Nov 20 18:30:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 124883 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 BE9A1385695B for ; Thu, 20 Nov 2025 18:37:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BE9A1385695B Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=rgxw//BD X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by sourceware.org (Postfix) with ESMTPS id 720B4385703C for ; Thu, 20 Nov 2025 18:31:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 720B4385703C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 720B4385703C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::641 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663512; cv=none; b=gumd5iERb0Yb6ICycYsIWN50f3Wgbify7xhiVDdIQbhZcpzThT6yCt+31WMCFBi1c7zKSEpo/2mk/880WdhKaoNSqlCsNE5YN03oGWu4BXa5f5D16k71DDfW8tlCaO+5+8XYHbJA2K/QYdOxzpQmDU8hy7LtjQ+BDExWY1smNYM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763663512; c=relaxed/simple; bh=HaXEl6dqt9YmnegsGqH2UHm3n712ibKF2s6ZWh7RWiw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ZKaWfjEHmvVxGqY3WaExdyM4XQ6aj+CoGPKPS30r3CjcKuHaJ0NKO5SzlQasMGXnTFFzQh2nvArdK+Sv05z7UH5XmRTvf+6egYkx2RNF2nzh1Py2siMRjjORXAspPY65vL/nDOaLt2I/sT5pQFD8g864Rv5vKGJqzh0yF5mWtpI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 720B4385703C Received: by mail-pl1-x641.google.com with SMTP id d9443c01a7336-29853ec5b8cso14272315ad.3 for ; Thu, 20 Nov 2025 10:31:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1763663511; x=1764268311; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=24uO61Uy4DYDt1Vsf4q9sY7D9XZgDt9krc515YMKTdk=; b=rgxw//BD/YIbQLDOc0wtoxkTWRTrjdu8r8246HEfTydtKDoE5xhe8HV3er+esPZiL9 wwBqOykEv/ob1r3rJA947mdXVJH7DSC3zWM0Dct/EemN226kpD4PgCWBLXckMafjfWzP oQoL5fiGAMsS6hNKoKUJ/VL3IX4DEgs2qjTDuq1PMii+uqhmiWBWm1dWg3lxamUUPUrS sla0JsZCF2GnbE6p3B0TGXvvlupiG2zvAv7y9Cd9evcbOFM24CD+tqaYhRLtjnek85wE rHM69Qo493/NBpEm/aRh6PXhPnBxn1qGQaNzNw9G1rhnijiUmQuzrjzRFHiHBDG9kHk9 LT3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763663511; x=1764268311; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=24uO61Uy4DYDt1Vsf4q9sY7D9XZgDt9krc515YMKTdk=; b=qkD5YvbD0nee+pDkvyVrVJ+qLEM3864jKugin76fydCMcD7XR/tglv6JwVSJTbBsjH J+opQjWmhdftc87KoLax0iNE/hYomJWDKJFeaqMI4OdieQ3/LAEezu7GzpW2PVjVOVbb wXdcGBXqvenfGYyfAwHWoaKR4g9+FSAZR3bPJwD6s/g7VYWEmmN7EAyzDwz6RSi7atFg mt8xRhfdAaYohD9Eqx9u40CUIUbSBT8ysfYFlyGp6EzUzgwFHM2s8yKHJms6GLpGPyoi ctPtnz6M6Vp2wF7ywVRN/ONZTb8Vf6wtkVUQGOJrTi7vNqmRBaQE9fEr3DK0W7/G+4yy gyNA== X-Gm-Message-State: AOJu0YxOSTykzPtk/HaffzySodIEJs0CoVNBUBQ5mnmX+LiTRjkNVroE 5Q2aH+Hp/a5dKZqWvTJws7/Af0evoUAgYcNzudOheQ7vZKoy1W786TSaYUEmrj6K8VaR0Hx5a36 ShPFc6N1cUw== X-Gm-Gg: ASbGncv8Ve0XEPjagI148nJGb6ANPwzyDpJGliGpB/QDpSiBDqjdkc0wMDz3vNtqAcQ MoaD7SUojHCFGY9NdBTqBZPIvsP+VMkdwBZs/krZxKBM/lJ165VV+ypcqjuy+i/nB3MqivYnGxY 19qO7vGuu3/VeiN4yiFgA8xx59H/7YGPftZpVOxRS+o9eBDTj7V4w0LRUME4FSbaVQNEEd7rlwV 5QS30xYdgxcqEXs1Wz32yufql8rDPUYFJyKWBI9h7WA/5hziKaW38rIawtyBZkTyGOXvGpTLopU wMIl/8fVCk18gMQnHLDaSsqATbyvCAx1JkXXrHcbL3OBU1EIRCyjJTH/GfE3UFi93feHINv+uig rAYn4aNuE/Ju8FzEL3a115UxTBKatXZYaQMRtYsuA0miIK4KSvlehNAvdHBomCeEHTqsWwcw9Gv HAWS5HHIfVmZCmwf8CF7VqVg== X-Google-Smtp-Source: AGHT+IHbIqQDXB67cqWoN+aOd7yNsJuKtdPHZJwY2tL2NRjRJF7rC8Y1FN9nQVLbRBNRx/aGiMyYqw== X-Received: by 2002:a05:7022:63a9:b0:11b:a892:80b4 with SMTP id a92af1059eb24-11c937fe5ffmr1265462c88.5.1763663511038; Thu, 20 Nov 2025 10:31:51 -0800 (PST) Received: from ubuntu-vm.. ([187.11.52.82]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2a6fc5e3750sm9664359eec.6.2025.11.20.10.31.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 10:31:50 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Sam James , Collin Funk , "H . J . Lu" Subject: [PATCH v5 12/12] configure: remove overly restrictive check for clang Date: Thu, 20 Nov 2025 15:30:16 -0300 Message-ID: <20251120183107.2334580-13-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> References: <20251120183107.2334580-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, 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 The clang support is still experimental and not all testcase build or run correctly. Only clang 18 and onwards is supported and only for x86_64-linux-gnu and aarch64-linux-gnu. Reviewed-by: Collin Funk --- NEWS | 5 +++++ configure | 2 +- configure.ac | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 7e1264f448..2a116438f1 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,11 @@ Major new features: * The ISO C23 functions free_sized and free_aligned_sized are now supported in . +* Experimental support for building with clang has been added. It requires + at least clang version 18, aarch64-linux-gnu or x86_64-linux-gnu + targets, and libgcc compatible runtime (including libgcc_s.so for + pthread cancellation and backtrace runtime support). + Deprecated and removed features, and other changes affecting compatibility: * Support for dumped heaps has been removed - malloc_set_state() now always diff --git a/configure b/configure index 9b72ca3b17..c1649903a9 100755 --- a/configure +++ b/configure @@ -5799,7 +5799,7 @@ int main (void) { -#if !defined __GNUC__ || __GNUC__ < 12 || (__GNUC__ == 12 && __GNUC_MINOR__ < 1) +#if (!defined __GNUC__ || __GNUC__ < 12 || (__GNUC__ == 12 && __GNUC_MINOR__ < 1)) && (!defined __clang__ || __clang_major__ < 18) #error insufficient compiler #endif ; diff --git a/configure.ac b/configure.ac index ef269340cb..b731ba4dc4 100644 --- a/configure.ac +++ b/configure.ac @@ -585,7 +585,7 @@ AC_CHECK_PROG_VER(BISON, bison, --version, # Require GCC 12.1 to build. AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [ AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[ -#if !defined __GNUC__ || __GNUC__ < 12 || (__GNUC__ == 12 && __GNUC_MINOR__ < 1) +#if (!defined __GNUC__ || __GNUC__ < 12 || (__GNUC__ == 12 && __GNUC_MINOR__ < 1)) && (!defined __clang__ || __clang_major__ < 18) #error insufficient compiler #endif]])], [libc_cv_compiler_ok=yes],