From patchwork Thu Oct 26 19:06:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 117255 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1124347qgn; Thu, 26 Oct 2017 12:08:02 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SzbICj3mo6VxPBQtzAfXsYqym3uZegi9PmcqYvRxQxb+Uf5oikvuLXS6yDsd8ky5XhGYiu X-Received: by 10.99.152.17 with SMTP id q17mr5684516pgd.287.1509044882109; Thu, 26 Oct 2017 12:08:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509044882; cv=none; d=google.com; s=arc-20160816; b=TwEbvNcU0Ee+/AFxPURkPh/yxijrSOOAkklGBWuuYZFgHUo/0xMSKufqUqiVPC5mX0 pee/+NKLpgK3Lkyl7tEwNgCNwR8p9BLQJ6cMzvo/LiAzoFewwdkgaevH32MCw9dCHl4w TGQ5HYfMzIDfoofnpOGJaa1HtvZXgAjZr7R2S5+lVEXJstcqwn8efF+9Y5Ze21cH4QAk QTISHy8c9YZamtyWlvSfzsqq5orJ4S5w83PTadJ4pEfWG2kzfZDEEVGh8skbUjLm9JyF x7GfalYA/MqlRrUaF2ovmbjisJUSI67UBU2E/TOaS+5nPIzjO6/uhAYDp/ftGEcKvrfd VIaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from:delivered-to :sender:list-help:list-post:list-archive:list-subscribe :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=1/4/IFxXQVVo27k/5mQQvUDuKVoyc0gNj1oBspp3+Nw=; b=YnMemcweo42keUHEcLeYOaZiCbi9rT6mortwXkz6xR1ckHNQtSbW9j0+osRxMyobAY 6QWk+/iQGV+/3EB+4yp/Gtmvm5FpKcTpX+K8mZXilGO3n2CQjn5EEHuuza3zB6m6aike Gy0PlyHtBzL7gRy2Xr5H70E57DHb48mjbj6N1CVeO/GaFhYqhcPODYOwADBjRnCmxgY1 UkHkAOzoy2VoCHsg9RPsvfhIU2nDIs2V9JtbsSa49CEI7ZBkbLw01KE4l0Gtf2Axy4Gj lXQLmCu+azws9uwOx0HUEoFyvVdEsuq3zJPZpF9U0Y9TC/V6atigqqgIwewyqNvMCqIv NKyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Z4hWUHOm; spf=pass (google.com: domain of libc-alpha-return-86405-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-86405-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id q12si4112561pfl.470.2017.10.26.12.08.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Oct 2017 12:08:02 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-86405-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Z4hWUHOm; spf=pass (google.com: domain of libc-alpha-return-86405-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-86405-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=y4+HL5i2xVzDzGfJ4Ie+CpnZXDUCSwG XfQ6i6aDyI1uE3ZKwqk7ZcUazxYjyVqe0WnSbD9ojj9p5VBCr7updX4ymEwUSgKl LYWvmrSKqVEcp5RA+SiCxe8OwISCkis2zlwmOjZEeZt4KYK2lP/USCafBZ8miyR9 QuQJRruPqNgw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=S0rjJM+A9mEU/CJ05SvcKybx5Qw=; b=Z4hWU HOmNm3IfK+sks+UA30XcKeI4EdnIPolvzzxZ00QJp0+DVNbkkyq+PoF36G9MyL2t xtA/VDmYtDvnI+kjyMdzCLgvnS39TXhw9gts0ujA8pwB5fD8LOwRLykXRg8/Oek/ GFA+vqCVTsRxVHf/AjEO60Yx8mXT4vV6/KqCs8= Received: (qmail 97468 invoked by alias); 26 Oct 2017 19:07:11 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 97438 invoked by uid 89); 26 Oct 2017 19:07:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qk0-f195.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=1/4/IFxXQVVo27k/5mQQvUDuKVoyc0gNj1oBspp3+Nw=; b=Gpr72wyL5Hn4v5R3xqqim+wG48JxN5UKN3/TGAmOfesx6CMF7Zyz9TNSQJk9peFehZ U23uaYqculdwfCxMitsDI82GGn39Op5roMJE0WpfXeLXIARBr6o1VMoCoCjTzrFleF3F 03VidQvB/jWKI+qKw8+qb+t0cmUB+Nrk5sTTKmdqp+qRTtqNK2MRa9ptejmQjjXPL40U va4eCdmRMuzDI7uYAt7B6sz3zF2meYxiVJ2bDrB1a1XlOlrgFSlPEXIPlR8nPp3/W7T8 4Cqq0jHqqAcWtcrgTzEuAKugDPihBxcwx6wYgttYiKWrGg0jHR5DGwVEGnJZC7Y2Pe4d 3+pA== X-Gm-Message-State: AMCzsaWfobnrD5vVUXKnGnk2X1ajnvUUuNPDrI3E0l3h09eJJ0ajUvTL YBqZ3PH/a9J/PMWNTIJQ/FaWPd16PjU= X-Received: by 10.55.165.213 with SMTP id o204mr9836088qke.313.1509044824249; Thu, 26 Oct 2017 12:07:04 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 03/25] sparc: Implement memcpy/mempcpy ifunc selection in C Date: Thu, 26 Oct 2017 17:06:31 -0200 Message-Id: <1509044813-9951-4-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1509044813-9951-1-git-send-email-adhemerval.zanella@linaro.org> References: <1509044813-9951-1-git-send-email-adhemerval.zanella@linaro.org> This patch refactor the SPARC64 ifunc selector to a C implementation. The x86_64 implementation is used as default, which resulted in common definitions (ifunc-init.h) used on both architectures. No functional change is expected, including ifunc resolution rules. Checked on sparc64-linux-gnu, sparcv9-linux-gnu and x86_64-linux-gnu. * sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy-ultra1.S: New file. * sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy.c: Likewise. * sysdeps/sparc/sparc32/sparcv9/multiarch/mempcpy.c: Likewise. * sysdeps/sparc/sparc32/sparcv9/multiarch/rtld-mempcpy.S: Likewise. * sysdeps/sparc/sparc64/multiarch/ifunc-memcpy.h: Likewise. * sysdeps/sparc/sparc64/multiarch/memcpy-ultra1.S: Likewise. * sysdeps/sparc/sparc64/multiarch/memcpy.c: Likewise. * sysdeps/sparc/sparc64/multiarch/mempcpy.c: Likewise. * sysdeps/sparc/sparc64/multiarch/rtld-mempcpy.S: Likewise. * sysdeps/sparc/sparc-ifunc.h (sparc_libc_ifunc_redirected): New macro. * sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile [$(subdir) = string] (sysdep_routines): Add memcpy-ultra1. * sysdeps/sparc/sparc64/multiarch/Makefile [$(subdir) = string] (sysdep_routines): Add memcpy-ultra1. * sysdeps/sparc/sparc64/multiarch/memcpy.S: Remove file. * sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy.S: Likewise. Signed-off-by: Adhemerval Zanella --- ChangeLog | 19 +++ sysdeps/sparc/sparc-ifunc.h | 13 ++ sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile | 3 +- .../sparc32/sparcv9/multiarch/memcpy-ultra1.S | 32 ++++ sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy.S | 4 - sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy.c | 1 + sysdeps/sparc/sparc32/sparcv9/multiarch/mempcpy.c | 1 + .../sparc/sparc32/sparcv9/multiarch/rtld-mempcpy.S | 1 + sysdeps/sparc/sparc64/multiarch/Makefile | 3 +- sysdeps/sparc/sparc64/multiarch/ifunc-memcpy.h | 40 +++++ sysdeps/sparc/sparc64/multiarch/memcpy-ultra1.S | 33 ++++ sysdeps/sparc/sparc64/multiarch/memcpy.S | 167 --------------------- sysdeps/sparc/sparc64/multiarch/memcpy.c | 33 ++++ sysdeps/sparc/sparc64/multiarch/mempcpy.c | 39 +++++ sysdeps/sparc/sparc64/multiarch/rtld-mempcpy.S | 1 + 15 files changed, 217 insertions(+), 173 deletions(-) create mode 100644 sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy-ultra1.S delete mode 100644 sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy.S create mode 100644 sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy.c create mode 100644 sysdeps/sparc/sparc32/sparcv9/multiarch/mempcpy.c create mode 100644 sysdeps/sparc/sparc32/sparcv9/multiarch/rtld-mempcpy.S create mode 100644 sysdeps/sparc/sparc64/multiarch/ifunc-memcpy.h create mode 100644 sysdeps/sparc/sparc64/multiarch/memcpy-ultra1.S delete mode 100644 sysdeps/sparc/sparc64/multiarch/memcpy.S create mode 100644 sysdeps/sparc/sparc64/multiarch/memcpy.c create mode 100644 sysdeps/sparc/sparc64/multiarch/mempcpy.c create mode 100644 sysdeps/sparc/sparc64/multiarch/rtld-mempcpy.S -- 2.7.4 diff --git a/sysdeps/sparc/sparc-ifunc.h b/sysdeps/sparc/sparc-ifunc.h index 4b1ea00..044fe36 100644 --- a/sysdeps/sparc/sparc-ifunc.h +++ b/sysdeps/sparc/sparc-ifunc.h @@ -161,10 +161,23 @@ END (__##name) #else /* __ASSEMBLER__ */ +# define INIT_ARCH() + +# define sparc_libc_ifunc_redirected(redirected_name, name, expr) \ + __ifunc (redirected_name, name, expr(hwcap), int hwcap, INIT_ARCH) # define sparc_libm_ifunc(name, expr) \ __ifunc (name, name, expr, int hwcap, libm_ifunc_init) # define sparc_libc_ifunc(name, expr) sparc_libm_ifunc (name, expr) +/* It essentially does libc_hidden_builtin_def (name) and redirect + the internal redirected symbol to ifunc implementation. */ +# if defined SHARED +# define sparc_ifunc_redirected_hidden_def(redirect_name, name) \ + __hidden_ver1 (name, __GI_##name, redirect_name) \ + __attribute__ ((visibility ("hidden"))); +# else +# define sparc_ifunc_redirected_hidden_def(redirect_name, name) +# endif #endif /* __ASSEMBLER__ */ diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile b/sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile index 4ad7aff..ca44798 100644 --- a/sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile +++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile @@ -8,5 +8,6 @@ endif ifeq ($(subdir),string) sysdep_routines += memcpy-ultra3 memcpy-niagara1 memcpy-niagara2 \ - memset-niagara1 memcpy-niagara4 memset-niagara4 + memset-niagara1 memcpy-niagara4 memset-niagara4 \ + memcpy-ultra1 endif diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy-ultra1.S b/sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy-ultra1.S new file mode 100644 index 0000000..ac0e7aa --- /dev/null +++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy-ultra1.S @@ -0,0 +1,32 @@ +/* Default SPARC32 memcpy implementation. + Copyright (C) 2017 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 + . */ + +#if IS_IN (libc) +# include + +# undef libc_hidden_builtin_def +# define libc_hidden_builtin_def(name) +# undef weak_alias +# define weak_alias(x, y) +# undef libc_hidden_def +# define libc_hidden_def(name) + +# define memcpy __memcpy_ultra1 +# define __mempcpy __mempcpy_ultra1 +# include +#endif diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy.S b/sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy.S deleted file mode 100644 index 14df91e..0000000 --- a/sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy.S +++ /dev/null @@ -1,4 +0,0 @@ -#define ASI_PNF 0x82 -#define ASI_BLK_P 0xf0 -#define XCC icc -#include diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy.c b/sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy.c new file mode 100644 index 0000000..369acac --- /dev/null +++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/mempcpy.c b/sysdeps/sparc/sparc32/sparcv9/multiarch/mempcpy.c new file mode 100644 index 0000000..616a538 --- /dev/null +++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/mempcpy.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/rtld-mempcpy.S b/sysdeps/sparc/sparc32/sparcv9/multiarch/rtld-mempcpy.S new file mode 100644 index 0000000..f18c9f9 --- /dev/null +++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/rtld-mempcpy.S @@ -0,0 +1 @@ +/* rtld-mempcpy is implemented by rtld-memcpy.S. */ diff --git a/sysdeps/sparc/sparc64/multiarch/Makefile b/sysdeps/sparc/sparc64/multiarch/Makefile index 55b757f..4e52526 100644 --- a/sysdeps/sparc/sparc64/multiarch/Makefile +++ b/sysdeps/sparc/sparc64/multiarch/Makefile @@ -8,7 +8,8 @@ endif ifeq ($(subdir),string) sysdep_routines += memcpy-ultra3 memcpy-niagara1 memcpy-niagara2 \ - memset-niagara1 memcpy-niagara4 memset-niagara4 + memset-niagara1 memcpy-niagara4 memset-niagara4 \ + memcpy-ultra1 endif ifeq ($(subdir),stdlib) diff --git a/sysdeps/sparc/sparc64/multiarch/ifunc-memcpy.h b/sysdeps/sparc/sparc64/multiarch/ifunc-memcpy.h new file mode 100644 index 0000000..46f3795 --- /dev/null +++ b/sysdeps/sparc/sparc64/multiarch/ifunc-memcpy.h @@ -0,0 +1,40 @@ +/* Common definition for memcpy and mempcpy implementation. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017 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 + . */ + +#include + +extern __typeof (REDIRECT_NAME) OPTIMIZE (niagara4) attribute_hidden; +extern __typeof (REDIRECT_NAME) OPTIMIZE (niagara2) attribute_hidden; +extern __typeof (REDIRECT_NAME) OPTIMIZE (niagara1) attribute_hidden; +extern __typeof (REDIRECT_NAME) OPTIMIZE (ultra3) attribute_hidden; +extern __typeof (REDIRECT_NAME) OPTIMIZE (ultra1) attribute_hidden; + +static inline void * +IFUNC_SELECTOR (int hwcap) +{ + if (hwcap & HWCAP_SPARC_CRYPTO) + return OPTIMIZE (niagara4); + if (hwcap & HWCAP_SPARC_N2) + return OPTIMIZE (niagara2); + if (hwcap & HWCAP_SPARC_BLKINIT) + return OPTIMIZE (niagara1); + if (hwcap & HWCAP_SPARC_ULTRA3) + return OPTIMIZE (ultra3); + return OPTIMIZE (ultra1); +} diff --git a/sysdeps/sparc/sparc64/multiarch/memcpy-ultra1.S b/sysdeps/sparc/sparc64/multiarch/memcpy-ultra1.S new file mode 100644 index 0000000..fc392c5 --- /dev/null +++ b/sysdeps/sparc/sparc64/multiarch/memcpy-ultra1.S @@ -0,0 +1,33 @@ +/* Default SPARC64 memcpy implementation. + Copyright (C) 2017 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 + . */ + +#if IS_IN (libc) +# include + +# undef libc_hidden_builtin_def +# define libc_hidden_builtin_def(name) +# undef weak_alias +# define weak_alias(x, y) +# undef libc_hidden_def +# define libc_hidden_def(name) + +# define memcpy __memcpy_ultra1 +# define __mempcpy __mempcpy_ultra1 + +#include +#endif diff --git a/sysdeps/sparc/sparc64/multiarch/memcpy.S b/sysdeps/sparc/sparc64/multiarch/memcpy.S deleted file mode 100644 index b6396ee..0000000 --- a/sysdeps/sparc/sparc64/multiarch/memcpy.S +++ /dev/null @@ -1,167 +0,0 @@ -/* Multiple versions of memcpy - All versions must be listed in ifunc-impl-list.c. - Copyright (C) 2010-2017 Free Software Foundation, Inc. - Contributed by David S. Miller (davem@davemloft.net) - 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 - . */ - -#include - -#if IS_IN (libc) - .text -ENTRY(memcpy) - .type memcpy, @gnu_indirect_function -# ifdef SHARED - SETUP_PIC_REG_LEAF(o3, o5) -# endif - set HWCAP_SPARC_CRYPTO, %o1 - andcc %o0, %o1, %g0 - be 1f - andcc %o0, HWCAP_SPARC_N2, %g0 -# ifdef SHARED - sethi %gdop_hix22(__memcpy_niagara4), %o1 - xor %o1, %gdop_lox10(__memcpy_niagara4), %o1 -# else - set __memcpy_niagara4, %o1 -# endif - ba 10f - nop -1: be 1f - andcc %o0, HWCAP_SPARC_BLKINIT, %g0 -# ifdef SHARED - sethi %gdop_hix22(__memcpy_niagara2), %o1 - xor %o1, %gdop_lox10(__memcpy_niagara2), %o1 -# else - set __memcpy_niagara2, %o1 -# endif - ba 10f - nop -1: be 1f - andcc %o0, HWCAP_SPARC_ULTRA3, %g0 -# ifdef SHARED - sethi %gdop_hix22(__memcpy_niagara1), %o1 - xor %o1, %gdop_lox10(__memcpy_niagara1), %o1 -# else - set __memcpy_niagara1, %o1 -# endif - ba 10f - nop -1: be 9f - nop -# ifdef SHARED - sethi %gdop_hix22(__memcpy_ultra3), %o1 - xor %o1, %gdop_lox10(__memcpy_ultra3), %o1 -# else - set __memcpy_ultra3, %o1 -# endif - ba 10f - nop -9: -# ifdef SHARED - sethi %gdop_hix22(__memcpy_ultra1), %o1 - xor %o1, %gdop_lox10(__memcpy_ultra1), %o1 -# else - set __memcpy_ultra1, %o1 -# endif -10: -# ifdef SHARED - add %o3, %o1, %o1 -# endif - retl - mov %o1, %o0 -END(memcpy) - -ENTRY(__mempcpy) - .type __mempcpy, @gnu_indirect_function -# ifdef SHARED - SETUP_PIC_REG_LEAF(o3, o5) -# endif - set HWCAP_SPARC_CRYPTO, %o1 - andcc %o0, %o1, %g0 - be 1f - andcc %o0, HWCAP_SPARC_N2, %g0 -# ifdef SHARED - sethi %gdop_hix22(__mempcpy_niagara4), %o1 - xor %o1, %gdop_lox10(__mempcpy_niagara4), %o1 -# else - set __mempcpy_niagara4, %o1 -# endif - ba 10f - nop -1: be 1f - andcc %o0, HWCAP_SPARC_BLKINIT, %g0 -# ifdef SHARED - sethi %gdop_hix22(__mempcpy_niagara2), %o1 - xor %o1, %gdop_lox10(__mempcpy_niagara2), %o1 -# else - set __mempcpy_niagara2, %o1 -# endif - ba 10f - nop -1: be 1f - andcc %o0, HWCAP_SPARC_ULTRA3, %g0 -# ifdef SHARED - sethi %gdop_hix22(__mempcpy_niagara1), %o1 - xor %o1, %gdop_lox10(__mempcpy_niagara1), %o1 -# else - set __mempcpy_niagara1, %o1 -# endif - ba 10f - nop -1: be 9f - nop -# ifdef SHARED - sethi %gdop_hix22(__mempcpy_ultra3), %o1 - xor %o1, %gdop_lox10(__mempcpy_ultra3), %o1 -# else - set __mempcpy_ultra3, %o1 -# endif - ba 10f - nop -9: -# ifdef SHARED - sethi %gdop_hix22(__mempcpy_ultra1), %o1 - xor %o1, %gdop_lox10(__mempcpy_ultra1), %o1 -# else - set __mempcpy_ultra1, %o1 -# endif -10: -# ifdef SHARED - add %o3, %o1, %o1 -# endif - retl - mov %o1, %o0 -END(__mempcpy) - -libc_hidden_builtin_def (memcpy) - -libc_hidden_def (__mempcpy) -weak_alias (__mempcpy, mempcpy) -libc_hidden_builtin_def (mempcpy) - -#undef libc_hidden_builtin_def -#define libc_hidden_builtin_def(name) -#undef weak_alias -#define weak_alias(x, y) -#undef libc_hidden_def -#define libc_hidden_def(name) - -#define memcpy __memcpy_ultra1 -#define __mempcpy __mempcpy_ultra1 - -#endif - -#include "../memcpy.S" diff --git a/sysdeps/sparc/sparc64/multiarch/memcpy.c b/sysdeps/sparc/sparc64/multiarch/memcpy.c new file mode 100644 index 0000000..5510e15 --- /dev/null +++ b/sysdeps/sparc/sparc64/multiarch/memcpy.c @@ -0,0 +1,33 @@ +/* Multiple versions of memcpy. + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017 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 + . */ + +#if IS_IN (libc) +# define memcpy __redirect_memcpy +# include +# undef memcpy + +# include + +# define SYMBOL_NAME memcpy +# include "ifunc-memcpy.h" + +sparc_libc_ifunc_redirected (__redirect_memcpy, memcpy, IFUNC_SELECTOR) + +sparc_ifunc_redirected_hidden_def (__redirect_memcpy, memcpy) +#endif diff --git a/sysdeps/sparc/sparc64/multiarch/mempcpy.c b/sysdeps/sparc/sparc64/multiarch/mempcpy.c new file mode 100644 index 0000000..8a4b2a1 --- /dev/null +++ b/sysdeps/sparc/sparc64/multiarch/mempcpy.c @@ -0,0 +1,39 @@ +/* Multiple versions of memcpy + All versions must be listed in ifunc-impl-list.c. + Copyright (C) 2017 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 + . */ + +#if IS_IN (libc) +# define mempcpy __redirect_mempcpy +# define __mempcpy __redirect___mempcpy +# define NO_MEMPCPY_STPCPY_REDIRECT +# define __NO_STRING_INLINES +# include +# undef mempcpy +# undef __mempcpy + +# include + +# define SYMBOL_NAME mempcpy +# include "ifunc-memcpy.h" + +sparc_libc_ifunc_redirected (__redirect_mempcpy, __mempcpy, IFUNC_SELECTOR) + +sparc_ifunc_redirected_hidden_def (__redirect___mempcpy, __mempcpy) +weak_alias (__mempcpy, mempcpy) +sparc_ifunc_redirected_hidden_def (__redirect_mempcpy, mempcpy) +#endif diff --git a/sysdeps/sparc/sparc64/multiarch/rtld-mempcpy.S b/sysdeps/sparc/sparc64/multiarch/rtld-mempcpy.S new file mode 100644 index 0000000..f18c9f9 --- /dev/null +++ b/sysdeps/sparc/sparc64/multiarch/rtld-mempcpy.S @@ -0,0 +1 @@ +/* rtld-mempcpy is implemented by rtld-memcpy.S. */