From patchwork Tue Feb 7 13:12:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 64444 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 98AB53858C20 for ; Tue, 7 Feb 2023 13:14:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 98AB53858C20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675775644; bh=wZqB4mstXA6J/ps8P+QGGsu/gLddeqO7WMYBhA2+NfU=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=ftrEDGlg/4RdHnnWLkDL+DorFRocBGsjsnG7F1SCiz3YuSLE8NC5eIHClBt5vo+Y+ LorqKpAntpxnye+8eeUNj3LNtuAoYD9a4aa9MLJnoajIY7NNJmo72XBWt0iNTbtdTI Rljfou09jsDSLgLgbmmaq+O736uYStNQ6kvA6vYM= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id D67E03858D35 for ; Tue, 7 Feb 2023 13:13:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D67E03858D35 Received: by mail-ot1-x32b.google.com with SMTP id f5-20020a9d5f05000000b00684c0c2eb3fso4146199oti.10 for ; Tue, 07 Feb 2023 05:13:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wZqB4mstXA6J/ps8P+QGGsu/gLddeqO7WMYBhA2+NfU=; b=iHnoue4wNd+U4cBgLecNNAF2JlbQM6sMFuT7D/lVyu7qT8n6fB6M1+ys+dNr+Z2Yg/ E9kVupgckVV+ppAJ02pj9iZj+uO6WLdpHbsqW5gddtvtSu3ngtr6whbt0DpQTBjagCna a1dWcuSbLVrO5nM10EMBaWuE6/96yPAOyNR4rwkhZeIK8KE7GtIDeO7nQbw+sR7vFmw+ xFUS8R3yUQR00IXOEMvKjKyH8QrJvt0vpC5gOTz17dAHIlv66Z4z2Fftr1WAc8J7/I+8 5s6JDMucSRNhQPt1NWDNGO7ikYQwLXzlU4Zhpbe5uuyxxpAZYVtE4QrOA20cHxKGYHNx UoiQ== X-Gm-Message-State: AO0yUKWeByEtXK4MuDALWfeIPFpm5tJ47u72Brhcu96Wl+Xf/iG1tryS WWesP6TdEWMPuO3qXu14M0bY5YMCntxCQwpr+94= X-Google-Smtp-Source: AK7set+Yd/EdYb9ESAvcRK6Bb2MhhReBES/49Eb+Yv3KCOJJAcohd6DUC3mMkTP2yqrbMhT4W4HchA== X-Received: by 2002:a05:6830:114:b0:68d:b7ff:84b with SMTP id i20-20020a056830011400b0068db7ff084bmr324062otp.27.1675775581452; Tue, 07 Feb 2023 05:13:01 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c2:8ced:3d04:3626:cc0e:457c]) by smtp.gmail.com with ESMTPSA id c15-20020a9d75cf000000b0068bbaf7a1b0sm6414113otl.34.2023.02.07.05.12.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Feb 2023 05:13:00 -0800 (PST) To: libc-alpha@sourceware.org, Richard Henderson , Noah Goldstein Subject: [PATCH 1/3] string: Add libc_hidden_proto for strchrnul Date: Tue, 7 Feb 2023 10:12:53 -0300 Message-Id: <20230207131255.3396143-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230207131255.3396143-1-adhemerval.zanella@linaro.org> References: <20230207131255.3396143-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Although static linker can optimize it to local call, it follow the internal scheme to provide hidden proto and definitions. Reviewed-by: Carlos Eduardo Seo --- include/string.h | 1 + string/strchrnul.c | 1 + sysdeps/aarch64/strchrnul.S | 1 + sysdeps/i386/strchrnul.S | 1 + sysdeps/m68k/strchrnul.S | 1 + .../power4/multiarch/strchrnul-ppc32.c | 7 +++++++ .../powerpc32/power4/multiarch/strchrnul.c | 17 +++++++++-------- sysdeps/powerpc/powerpc64/multiarch/strchrnul.c | 1 + sysdeps/s390/strchrnul-c.c | 4 +++- sysdeps/s390/strchrnul.c | 8 +++++--- sysdeps/x86_64/multiarch/strchrnul.c | 4 ++++ sysdeps/x86_64/strchrnul.S | 1 + 12 files changed, 35 insertions(+), 12 deletions(-) diff --git a/include/string.h b/include/string.h index 21f641a413..6e364e8a67 100644 --- a/include/string.h +++ b/include/string.h @@ -95,6 +95,7 @@ libc_hidden_proto (__rawmemchr) libc_hidden_proto (__strcasecmp) libc_hidden_proto (__strcasecmp_l) libc_hidden_proto (__strncasecmp_l) +libc_hidden_proto (__strchrnul) extern __typeof (strncat) __strncat; libc_hidden_proto (__strncat) libc_hidden_proto (__strdup) diff --git a/string/strchrnul.c b/string/strchrnul.c index e7887fa285..01fa25bdb7 100644 --- a/string/strchrnul.c +++ b/string/strchrnul.c @@ -51,5 +51,6 @@ __strchrnul (const char *str, int c_in) return (char *) word_ptr + index_first_zero_eq (word, repeated_c); } #ifndef STRCHRNUL +libc_hidden_def (__strchrnul) weak_alias (__strchrnul, strchrnul) #endif diff --git a/sysdeps/aarch64/strchrnul.S b/sysdeps/aarch64/strchrnul.S index aa8c9a4363..00ce463439 100644 --- a/sysdeps/aarch64/strchrnul.S +++ b/sysdeps/aarch64/strchrnul.S @@ -95,4 +95,5 @@ L(end): ret END(__strchrnul) +libc_hidden_def (__strchrnul) weak_alias (__strchrnul, strchrnul) diff --git a/sysdeps/i386/strchrnul.S b/sysdeps/i386/strchrnul.S index a4fa7469d6..274e83534c 100644 --- a/sysdeps/i386/strchrnul.S +++ b/sysdeps/i386/strchrnul.S @@ -273,4 +273,5 @@ L(6): popl %edi /* restore saved register content */ ret END (__strchrnul) +libc_hidden_def (__strchrnul) weak_alias (__strchrnul, strchrnul) diff --git a/sysdeps/m68k/strchrnul.S b/sysdeps/m68k/strchrnul.S index f4759a0fb3..1aee431f41 100644 --- a/sysdeps/m68k/strchrnul.S +++ b/sysdeps/m68k/strchrnul.S @@ -263,4 +263,5 @@ L(L9:) rts END(__strchrnul) +libc_hidden_def (__strchrnul) weak_alias (__strchrnul, strchrnul) diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul-ppc32.c b/sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul-ppc32.c index da03ac7c04..fbd947def1 100644 --- a/sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul-ppc32.c +++ b/sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul-ppc32.c @@ -22,3 +22,10 @@ extern __typeof (strchrnul) __strchrnul_ppc attribute_hidden; #include +#undef __strchrnul +weak_alias (__strchrnul_ppc, __strchrnul) +#ifdef SHARED +__hidden_ver1 (__strchrnul_ppc, __GI___strchrnul, __strchrnul_ppc); +#else +weak_alias (__strchrnul_ppc, strchrnul) +#endif diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul.c b/sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul.c index d17dfa4fcf..b11e2a4ff7 100644 --- a/sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul.c +++ b/sysdeps/powerpc/powerpc32/power4/multiarch/strchrnul.c @@ -16,22 +16,23 @@ License along with the GNU C Library; if not, see . */ -#if IS_IN (libc) +#if defined SHARED && IS_IN (libc) +# define __strchrnul __redirect___strchrnul +# define strchrnul __redirect_strchrnul # include # include # include "init-arch.h" extern __typeof (__strchrnul) __strchrnul_ppc attribute_hidden; extern __typeof (__strchrnul) __strchrnul_power7 attribute_hidden; +# undef __strchrnul +# undef strchrnul /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle ifunc symbol properly. */ -libc_ifunc (__strchrnul, - (hwcap & PPC_FEATURE_HAS_VSX) - ? __strchrnul_power7 - : __strchrnul_ppc); - +libc_ifunc_redirected (__redirect___strchrnul, __strchrnul, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __strchrnul_power7 + : __strchrnul_ppc); weak_alias (__strchrnul, strchrnul) -#else -#include #endif diff --git a/sysdeps/powerpc/powerpc64/multiarch/strchrnul.c b/sysdeps/powerpc/powerpc64/multiarch/strchrnul.c index a901fa3c45..94873507a6 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/strchrnul.c +++ b/sysdeps/powerpc/powerpc64/multiarch/strchrnul.c @@ -35,6 +35,7 @@ libc_ifunc (__strchrnul, ? __strchrnul_power7 : __strchrnul_ppc); +libc_hidden_def (__strchrnul) weak_alias (__strchrnul, strchrnul) #else #include diff --git a/sysdeps/s390/strchrnul-c.c b/sysdeps/s390/strchrnul-c.c index ff6aa38d4f..f6f5bae311 100644 --- a/sysdeps/s390/strchrnul-c.c +++ b/sysdeps/s390/strchrnul-c.c @@ -21,8 +21,10 @@ #if HAVE_STRCHRNUL_C # if HAVE_STRCHRNUL_IFUNC # define STRCHRNUL STRCHRNUL_C -# define __strchrnul STRCHRNUL # endif # include +# if defined SHARED && IS_IN (libc) +__hidden_ver1 (__strchrnul_c, __GI___strchrnul, __strchrnul_c); +# endif #endif diff --git a/sysdeps/s390/strchrnul.c b/sysdeps/s390/strchrnul.c index a480d28356..e86ba6db75 100644 --- a/sysdeps/s390/strchrnul.c +++ b/sysdeps/s390/strchrnul.c @@ -19,18 +19,20 @@ #include #if HAVE_STRCHRNUL_IFUNC +# define __strchrnul __redirect_strchrnul # include +# undef __strchrnul # include # if HAVE_STRCHRNUL_C -extern __typeof (__strchrnul) STRCHRNUL_C attribute_hidden; +extern __typeof (__redirect_strchrnul) STRCHRNUL_C attribute_hidden; # endif # if HAVE_STRCHRNUL_Z13 -extern __typeof (__strchrnul) STRCHRNUL_Z13 attribute_hidden; +extern __typeof (__redirect_strchrnul) STRCHRNUL_Z13 attribute_hidden; # endif -s390_libc_ifunc_expr (__strchrnul, __strchrnul, +s390_libc_ifunc_expr (__redirect_strchrnul, __strchrnul, (HAVE_STRCHRNUL_Z13 && (hwcap & HWCAP_S390_VX)) ? STRCHRNUL_Z13 : STRCHRNUL_DEFAULT diff --git a/sysdeps/x86_64/multiarch/strchrnul.c b/sysdeps/x86_64/multiarch/strchrnul.c index be9221bb31..69d691631a 100644 --- a/sysdeps/x86_64/multiarch/strchrnul.c +++ b/sysdeps/x86_64/multiarch/strchrnul.c @@ -31,4 +31,8 @@ libc_ifunc_redirected (__redirect_strchrnul, __strchrnul, IFUNC_SELECTOR ()); weak_alias (__strchrnul, strchrnul) +# ifdef SHARED +__hidden_ver1 (__strchrnul, __GI___strchrnul, __redirect_strchrnul) + __attribute__((visibility ("hidden"))) __attribute_copy__ (strchrnul); +# endif #endif diff --git a/sysdeps/x86_64/strchrnul.S b/sysdeps/x86_64/strchrnul.S index 02cfcba263..07df9a5b06 100644 --- a/sysdeps/x86_64/strchrnul.S +++ b/sysdeps/x86_64/strchrnul.S @@ -24,4 +24,5 @@ #include "isa-default-impl.h" +libc_hidden_def (__strchrnul) weak_alias (__strchrnul, strchrnul) From patchwork Tue Feb 7 13:12:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 64443 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 2B25E3858439 for ; Tue, 7 Feb 2023 13:13:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2B25E3858439 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675775609; bh=3TbeteBkktsjHfYF5DgcHPnOmfeZg1p4O9xBcjLNGCI=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=HW6/hsPHLX1qnj5OApvFmazcQm3lnGjjEe//dVfYqPiiKgxAQePkhqjyEfyxPTN11 E/6Lx6hQQ8YMz/zD5uR1WWN/wwOW7SMP2vZ86VI4KuX2HojUenOQ8L5eK4vPGh/pF5 ekenpMJGb6GynxhbNtdjeo+fMy1InxmXCzuUdR9g= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id 895583858C50 for ; Tue, 7 Feb 2023 13:13:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 895583858C50 Received: by mail-ot1-x32f.google.com with SMTP id x26-20020a056830115a00b0068bbc0ee3eeso4166076otq.0 for ; Tue, 07 Feb 2023 05:13:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3TbeteBkktsjHfYF5DgcHPnOmfeZg1p4O9xBcjLNGCI=; b=gqjjUzULrlraMWVoNsxSBC82h0BEzQC94ehjyPpfnKSGgpo2du3G3Qfh5oWpqT72FV FQb/CL0UAVqeGZI5FrThMlDKlFuV9m+MAlOmhVZ5sBCkeAfSj5Kn4gg5XMFH4UGQr6tf XxMcp6J3gTqLAWGBGlEl5xTkyftQrkry0U+CqfH+uZ5H03Vqb9YPRxuL6slaY/2OFtiw NphDpAolZ3vGQsaNIGcvCS7c9ncP6GvmHY++UYAMmjftGlys7pRvsa77FRtWFgUE/tkX TRQleboIgoVoK0ZXF1B0wmzJhItLgUKu8OCe5k/iJck/Zq5bB3CnPvMl2eQYPh2JAVaQ SICw== X-Gm-Message-State: AO0yUKWM5aq1sN2v9ycGEdV4XQfxWaLDU/u0NCcBYLj43qUF7ebG8tuO wkSpTPynfvoorqGpMK70RjbqVwId5vw9UnJKYG0= X-Google-Smtp-Source: AK7set+bp5iDNqBNmdMTpLKnX4H4ylrd54IthoeGwaVuf9O/cbkgTJdz5gw2jEJ3GMjOnnmpmKVugw== X-Received: by 2002:a05:6830:e05:b0:68d:92fd:e378 with SMTP id do5-20020a0568300e0500b0068d92fde378mr1625461otb.35.1675775583318; Tue, 07 Feb 2023 05:13:03 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c2:8ced:3d04:3626:cc0e:457c]) by smtp.gmail.com with ESMTPSA id c15-20020a9d75cf000000b0068bbaf7a1b0sm6414113otl.34.2023.02.07.05.13.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Feb 2023 05:13:02 -0800 (PST) To: libc-alpha@sourceware.org, Richard Henderson , Noah Goldstein Subject: [PATCH 2/3] string: Add libc_hidden_proto for memrchr Date: Tue, 7 Feb 2023 10:12:54 -0300 Message-Id: <20230207131255.3396143-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230207131255.3396143-1-adhemerval.zanella@linaro.org> References: <20230207131255.3396143-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.6 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_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.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Although static linker can optimize it to local call, it follow the internal scheme to provide hidden proto and definitions. Reviewed-by: Carlos Eduardo Seo --- include/string.h | 1 + string/memrchr.c | 1 + sysdeps/aarch64/memrchr.S | 1 + sysdeps/i386/i686/multiarch/memrchr-sse2.S | 1 + sysdeps/i386/i686/multiarch/memrchr.c | 2 ++ .../powerpc32/power4/multiarch/memrchr-ppc32.c | 10 ++++++++++ .../powerpc32/power4/multiarch/memrchr.c | 12 ++++++------ sysdeps/powerpc/powerpc32/power7/memrchr.S | 1 + sysdeps/powerpc/powerpc64/multiarch/memrchr.c | 18 +++++++++--------- sysdeps/powerpc/powerpc64/power7/memrchr.S | 1 + sysdeps/powerpc/powerpc64/power8/memrchr.S | 1 + sysdeps/s390/memrchr-c.c | 4 ++++ sysdeps/s390/memrchr.c | 8 +++++--- sysdeps/x86_64/memrchr.S | 1 + sysdeps/x86_64/multiarch/memrchr.c | 1 + 15 files changed, 45 insertions(+), 18 deletions(-) diff --git a/include/string.h b/include/string.h index 6e364e8a67..a9120ff37c 100644 --- a/include/string.h +++ b/include/string.h @@ -119,6 +119,7 @@ extern __typeof (memmem) __memmem; libc_hidden_proto (__memmem) libc_hidden_proto (__ffs) libc_hidden_proto (__strerror_l) +libc_hidden_proto (__memrchr) #if IS_IN (libc) /* Avoid hidden reference to IFUNC symbol __explicit_bzero_chk. */ diff --git a/string/memrchr.c b/string/memrchr.c index b37f2a68c8..3de5ec691c 100644 --- a/string/memrchr.c +++ b/string/memrchr.c @@ -75,5 +75,6 @@ __memrchr (const void *s, int c_in, size_t n) return NULL; } #ifndef MEMRCHR +libc_hidden_def (__memrchr) weak_alias (__memrchr, memrchr) #endif diff --git a/sysdeps/aarch64/memrchr.S b/sysdeps/aarch64/memrchr.S index 621fc65109..af7d847dab 100644 --- a/sysdeps/aarch64/memrchr.S +++ b/sysdeps/aarch64/memrchr.S @@ -123,5 +123,6 @@ L(nomatch): ret END (__memrchr) +libc_hidden_def (__memrchr) weak_alias (__memrchr, memrchr) libc_hidden_builtin_def (memrchr) diff --git a/sysdeps/i386/i686/multiarch/memrchr-sse2.S b/sysdeps/i386/i686/multiarch/memrchr-sse2.S index c2c37f7ce1..aa15e7cf24 100644 --- a/sysdeps/i386/i686/multiarch/memrchr-sse2.S +++ b/sysdeps/i386/i686/multiarch/memrchr-sse2.S @@ -720,4 +720,5 @@ L(ret_null): ret END (__memrchr_sse2) +strong_alias (__memrchr_sse2, __GI___memrchr) #endif diff --git a/sysdeps/i386/i686/multiarch/memrchr.c b/sysdeps/i386/i686/multiarch/memrchr.c index c820a9d607..80dca18000 100644 --- a/sysdeps/i386/i686/multiarch/memrchr.c +++ b/sysdeps/i386/i686/multiarch/memrchr.c @@ -20,8 +20,10 @@ /* Define multiple versions only for the definition in libc. */ #if IS_IN (libc) # define memrchr __redirect_memrchr +# define __memrchr __redirect___memrchr # include # undef memrchr +# undef __memrchr # define SYMBOL_NAME memrchr # include "ifunc-sse2-bsf.h" diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/memrchr-ppc32.c b/sysdeps/powerpc/powerpc32/power4/multiarch/memrchr-ppc32.c index 62e7a12989..038c5f4532 100644 --- a/sysdeps/powerpc/powerpc32/power4/multiarch/memrchr-ppc32.c +++ b/sysdeps/powerpc/powerpc32/power4/multiarch/memrchr-ppc32.c @@ -23,3 +23,13 @@ extern void *__memrchr_ppc (const void *, int, size_t); #endif #include +# if IS_IN (libc) +# undef __memrchr +# ifdef SHARED +__hidden_ver1 (__memrchr_ppc, __GI___memrchr, __memrchr_ppc); +strong_alias (__memrchr_ppc, __memrchr_ppc1); +__hidden_ver1 (__memrchr_ppc1, __memrchr, __memrchr_ppc1); +# else +strong_alias (__memrchr_ppc, __memrchr) +# endif +#endif diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/memrchr.c b/sysdeps/powerpc/powerpc32/power4/multiarch/memrchr.c index 8c1385fe6a..fb0d2c0617 100644 --- a/sysdeps/powerpc/powerpc32/power4/multiarch/memrchr.c +++ b/sysdeps/powerpc/powerpc32/power4/multiarch/memrchr.c @@ -17,21 +17,21 @@ . */ #if IS_IN (libc) +# define memrchr __redirect_memrchr # include # include # include "init-arch.h" extern __typeof (__memrchr) __memrchr_ppc attribute_hidden; extern __typeof (__memrchr) __memrchr_power7 attribute_hidden; +# undef memrchr /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle ifunc symbol properly. */ -libc_ifunc (__memrchr, - (hwcap & PPC_FEATURE_HAS_VSX) - ? __memrchr_power7 - : __memrchr_ppc); - -weak_alias (__memrchr, memrchr) +libc_ifunc_redirected (__redirect_memrchr, memrchr, + (hwcap & PPC_FEATURE_HAS_VSX) + ? __memrchr_power7 + : __memrchr_ppc); #else #include #endif diff --git a/sysdeps/powerpc/powerpc32/power7/memrchr.S b/sysdeps/powerpc/powerpc32/power7/memrchr.S index 9c70517d37..9f0f17fa46 100644 --- a/sysdeps/powerpc/powerpc32/power7/memrchr.S +++ b/sysdeps/powerpc/powerpc32/power7/memrchr.S @@ -191,5 +191,6 @@ L(loop_small): blr END (__memrchr) +libc_hidden_def (__memrchr) weak_alias (__memrchr, memrchr) libc_hidden_builtin_def (memrchr) diff --git a/sysdeps/powerpc/powerpc64/multiarch/memrchr.c b/sysdeps/powerpc/powerpc64/multiarch/memrchr.c index 59527a83eb..5e7c00fdce 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/memrchr.c +++ b/sysdeps/powerpc/powerpc64/multiarch/memrchr.c @@ -17,6 +17,7 @@ . */ #if IS_IN (libc) +# define memrchr __redirect_memrchr # include # include # include "init-arch.h" @@ -24,18 +25,17 @@ extern __typeof (__memrchr) __memrchr_ppc attribute_hidden; extern __typeof (__memrchr) __memrchr_power7 attribute_hidden; extern __typeof (__memrchr) __memrchr_power8 attribute_hidden; +# undef memrchr /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle ifunc symbol properly. */ -libc_ifunc (__memrchr, - (hwcap2 & PPC_FEATURE2_ARCH_2_07 - && hwcap & PPC_FEATURE_HAS_ALTIVEC) - ? __memrchr_power8 : - (hwcap & PPC_FEATURE_ARCH_2_06) - ? __memrchr_power7 - : __memrchr_ppc); - -weak_alias (__memrchr, memrchr) +libc_ifunc_redirected (__redirect_memrchr, memrchr, + (hwcap2 & PPC_FEATURE2_ARCH_2_07 + && hwcap & PPC_FEATURE_HAS_ALTIVEC) + ? __memrchr_power8 : + (hwcap & PPC_FEATURE_ARCH_2_06) + ? __memrchr_power7 + : __memrchr_ppc); #else #include #endif diff --git a/sysdeps/powerpc/powerpc64/power7/memrchr.S b/sysdeps/powerpc/powerpc64/power7/memrchr.S index 56e79f3cd5..3b0430ccff 100644 --- a/sysdeps/powerpc/powerpc64/power7/memrchr.S +++ b/sysdeps/powerpc/powerpc64/power7/memrchr.S @@ -196,5 +196,6 @@ L(loop_small): blr END (MEMRCHR) +libc_hidden_def (__memrchr) weak_alias (__memrchr, memrchr) libc_hidden_builtin_def (memrchr) diff --git a/sysdeps/powerpc/powerpc64/power8/memrchr.S b/sysdeps/powerpc/powerpc64/power8/memrchr.S index fec76cf586..ebe4017968 100644 --- a/sysdeps/powerpc/powerpc64/power8/memrchr.S +++ b/sysdeps/powerpc/powerpc64/power8/memrchr.S @@ -332,5 +332,6 @@ L(loop_small): blr END (MEMRCHR) +libc_hidden_def (__memrchr) weak_alias (__memrchr, memrchr) libc_hidden_builtin_def (memrchr) diff --git a/sysdeps/s390/memrchr-c.c b/sysdeps/s390/memrchr-c.c index ce97bc6714..bdf3c7bbe0 100644 --- a/sysdeps/s390/memrchr-c.c +++ b/sysdeps/s390/memrchr-c.c @@ -24,4 +24,8 @@ # endif # include + +# if defined SHARED && IS_IN (libc) +__hidden_ver1 (__memrchr_c, __GI___memrchr, __memrchr_c); +# endif #endif diff --git a/sysdeps/s390/memrchr.c b/sysdeps/s390/memrchr.c index 73e75628c1..405990faef 100644 --- a/sysdeps/s390/memrchr.c +++ b/sysdeps/s390/memrchr.c @@ -19,18 +19,20 @@ #include #if HAVE_MEMRCHR_IFUNC +# define __memrchr __redirect_memrchr # include +# undef __memrchr # include # if HAVE_MEMRCHR_C -extern __typeof (__memrchr) MEMRCHR_C attribute_hidden; +extern __typeof (__redirect_memrchr) MEMRCHR_C attribute_hidden; # endif # if HAVE_MEMRCHR_Z13 -extern __typeof (__memrchr) MEMRCHR_Z13 attribute_hidden; +extern __typeof (__redirect_memrchr) MEMRCHR_Z13 attribute_hidden; # endif -s390_libc_ifunc_expr (__memrchr, __memrchr, +s390_libc_ifunc_expr (__redirect_memrchr, __memrchr, (HAVE_MEMRCHR_Z13 && (hwcap & HWCAP_S390_VX)) ? MEMRCHR_Z13 : MEMRCHR_DEFAULT diff --git a/sysdeps/x86_64/memrchr.S b/sysdeps/x86_64/memrchr.S index fe33998111..98a220f3f4 100644 --- a/sysdeps/x86_64/memrchr.S +++ b/sysdeps/x86_64/memrchr.S @@ -25,4 +25,5 @@ #include "isa-default-impl.h" +libc_hidden_def (__memrchr) weak_alias (__memrchr, memrchr) diff --git a/sysdeps/x86_64/multiarch/memrchr.c b/sysdeps/x86_64/multiarch/memrchr.c index f7db8b4708..49026538d4 100644 --- a/sysdeps/x86_64/multiarch/memrchr.c +++ b/sysdeps/x86_64/multiarch/memrchr.c @@ -27,5 +27,6 @@ # include "ifunc-avx2.h" libc_ifunc_redirected (__redirect_memrchr, __memrchr, IFUNC_SELECTOR ()); +libc_hidden_def (__memrchr) weak_alias (__memrchr, memrchr) #endif From patchwork Tue Feb 7 13:12:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 64445 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 2B1B23858D35 for ; Tue, 7 Feb 2023 13:14:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2B1B23858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675775686; bh=+xvGUOPNjx7ilSHGCI6qct+D57TgDg/t9tA8o5SFz7Y=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=aUkjjWRp2jGjddLe0LdN1XEI5IGYaPWo2Y0r30OaAMTID1mHLq9ztq4OFVrzfS1fz fl/DNM/OYj4/f19mS3Z0VFhP79U3aDTNLVB0zYWsNAA5MhKIpPHXD7jHvXILAJ6LWq K2vbWLqq0FofRR7jEtMU0XW3YxsIj1sqT2e/6wsw= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id 749EB3858414 for ; Tue, 7 Feb 2023 13:13:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 749EB3858414 Received: by mail-ot1-x336.google.com with SMTP id 14-20020a9d010e000000b0068bdddfa263so4154758otu.2 for ; Tue, 07 Feb 2023 05:13:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+xvGUOPNjx7ilSHGCI6qct+D57TgDg/t9tA8o5SFz7Y=; b=4Gx8oFkDCTPlpXaI7V2e+9vAG/gG4LsWdUUUu+llIhDKpV4/PdMeEdClmaTEDzwx4D rZkJtcoCSDD+naxbLh2xLLD3bcaK+QNgJdph2AyBu2wsOone4Z0s4vjG5/ulNkLegGOz 6rf0uSAM0YJ0BxxzQ1xO6p9sHCfOJyyrW8EbJZzD19Afh25o61gk/cY18VwKb+AxFnHj 249QGrUcrL1vGn+siwERFHJanNYcXR/tOyk3hTkt+8hvU5S2QysncI3nr21jBh2HFrFd 3JbLwtA4zGB18XGRDdR0gXDXtI3ZnHC+F7Jpm/AiidyF5IJ7JVPgWDQ4TcENy0VaodkF Pvpw== X-Gm-Message-State: AO0yUKUlWGWqQBXeMrjxhviqVJLWdx8r8Om2guoTGXvsgslcOpe1LUVk OBxZuWYC8D2A8bkf7ldnyIn5pfWXbdYXlyd1d8w= X-Google-Smtp-Source: AK7set/JoC1jMGQDRINjpz5MlgCnvdsRRDwapO6V9JqX168GLnhu4rX+WnoV5bsbT6BxGeYgcR5fMQ== X-Received: by 2002:a05:6830:906:b0:68b:d0db:f8c5 with SMTP id v6-20020a056830090600b0068bd0dbf8c5mr2620224ott.16.1675775585281; Tue, 07 Feb 2023 05:13:05 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c2:8ced:3d04:3626:cc0e:457c]) by smtp.gmail.com with ESMTPSA id c15-20020a9d75cf000000b0068bbaf7a1b0sm6414113otl.34.2023.02.07.05.13.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Feb 2023 05:13:04 -0800 (PST) To: libc-alpha@sourceware.org, Richard Henderson , Noah Goldstein Subject: [PATCH 3/3] string: Disable stack protector in early static initialization Date: Tue, 7 Feb 2023 10:12:55 -0300 Message-Id: <20230207131255.3396143-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230207131255.3396143-1-adhemerval.zanella@linaro.org> References: <20230207131255.3396143-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" For powerpc, strncmp is used on _dl_string_platform issued by __tcb_parse_hwcap_and_convert_at_platform. Reviewed-by: Carlos Eduardo Seo --- string/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/string/Makefile b/string/Makefile index 3eced0d027..c84b49aaa5 100644 --- a/string/Makefile +++ b/string/Makefile @@ -230,6 +230,8 @@ LDFLAGS-tst-xbzero-opt = -z now # Called during TLS initialization. CFLAGS-memcpy.c += $(no-stack-protector) CFLAGS-wordcopy.c += $(no-stack-protector) +# Called during static initialization +CFLAGS-strncmp.c += $(no-stack-protector) CFLAGS-argz-next.c += $(config-cflags-wno-ignored-attributes) CFLAGS-basename.c += $(config-cflags-wno-ignored-attributes)