This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch azanella/ifunc-c created. glibc-2.26.9000-618-g9a45303


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, azanella/ifunc-c has been created
        at  9a4530337d8f2da060ff7e4e7d1964461f4700fa (commit)

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=9a4530337d8f2da060ff7e4e7d1964461f4700fa

commit 9a4530337d8f2da060ff7e4e7d1964461f4700fa
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Sat Oct 14 07:55:54 2017 -0300

    x32: Remove unused getcpu implementation
    
    	* sysdeps/unix/sysv/linux/x86_64/x32/getcpu.c: Remove file.

diff --git a/ChangeLog b/ChangeLog
index 9cc105c..2b78f8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/unix/sysv/linux/x86_64/x32/getcpu.c: Remove file.
+
 	* sysdeps/sparc/sparc-ifunc.h (SPARC_ASM_IFUNC_DFLT,
 	SPARC_ASM_IFUNC1, SPARC_ASM_IFUNC2, SET, SPARC_ASM_VIS2_IFUNC,
 	SPARC_ASM_VIS3_IFUNC, SPARC_ASM_VIS3_VIS2_IFUNC): Remove macros.
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/getcpu.c b/sysdeps/unix/sysv/linux/x86_64/x32/getcpu.c
deleted file mode 100644
index cd26d2e..0000000
--- a/sysdeps/unix/sysv/linux/x86_64/x32/getcpu.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 2012-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
-   <http://www.gnu.org/licenses/>.  */
-
-#ifdef SHARED
-# include <dl-vdso.h>
-
-void *getcpu_ifunc (void) __asm__ ("__getcpu");
-
-void *
-inhibit_stack_protector
-getcpu_ifunc (void)
-{
-  PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
-
-  return _dl_vdso_vsym ("__vdso_getcpu", &linux26);
-}
-__asm (".type __getcpu, %gnu_indirect_function");
-#endif

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=254aa9e343708edb3c17f260865428ed5131a083

commit 254aa9e343708edb3c17f260865428ed5131a083
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 13:47:36 2017 -0300

    sparc: Remove ununsed ifunc assembly macros
    
    	* sysdeps/sparc/sparc-ifunc.h (SPARC_ASM_IFUNC_DFLT,
    	SPARC_ASM_IFUNC1, SPARC_ASM_IFUNC2, SET, SPARC_ASM_VIS2_IFUNC,
    	SPARC_ASM_VIS3_IFUNC, SPARC_ASM_VIS3_VIS2_IFUNC): Remove macros.

diff --git a/ChangeLog b/ChangeLog
index 65bd6aa..9cc105c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/sparc/sparc-ifunc.h (SPARC_ASM_IFUNC_DFLT,
+	SPARC_ASM_IFUNC1, SPARC_ASM_IFUNC2, SET, SPARC_ASM_VIS2_IFUNC,
+	SPARC_ASM_VIS3_IFUNC, SPARC_ASM_VIS3_VIS2_IFUNC): Remove macros.
+
 	* sysdeps/sparc/sparc64/cpu_relax.c: New file.
 	* sysdeps/sparc/sparc32/sparcv9/cpu_relax.c: Likewise.
 	* sysdeps/sparc/sparc64/cpu_relax.S: Remove file.
diff --git a/sysdeps/sparc/sparc-ifunc.h b/sysdeps/sparc/sparc-ifunc.h
index 4ae9742..cca6728 100644
--- a/sysdeps/sparc/sparc-ifunc.h
+++ b/sysdeps/sparc/sparc-ifunc.h
@@ -17,155 +17,21 @@
 
 #include <sysdep.h>
 
-#ifdef __ASSEMBLER__
-
-# ifdef SHARED
-
-#  define SPARC_ASM_IFUNC_DFLT(name, dflt)		\
-ENTRY (__##name)					\
-	.type	__##name, @gnu_indirect_function;	\
-	SETUP_PIC_REG_LEAF(o3, o5);			\
-	sethi	%gdop_hix22(dflt), %o1;			\
-	xor	%o1, %gdop_lox10(dflt), %o1;		\
-	add	%o3, %o1, %o1;				\
-	retl;						\
-	 mov	%o1, %o0;				\
-END (__##name)
-
-#  define SPARC_ASM_IFUNC1(name, m1, f1, dflt)		\
-ENTRY (__##name)					\
-	.type	__##name, @gnu_indirect_function;	\
-	SETUP_PIC_REG_LEAF(o3, o5);			\
-	set	m1, %o1;				\
-	andcc	%o0, %o1, %g0;				\
-	be	9f;					\
-	 nop;						\
-	sethi	%gdop_hix22(f1), %o1;			\
-	xor	%o1, %gdop_lox10(f1), %o1;		\
-	ba	10f;					\
-	 nop;						\
-9:	sethi	%gdop_hix22(dflt), %o1;			\
-	xor	%o1, %gdop_lox10(dflt), %o1;		\
-10:	add	%o3, %o1, %o1;				\
-	retl;						\
-	 mov	%o1, %o0;				\
-END (__##name)
-
-#  define SPARC_ASM_IFUNC2(name, m1, f1, m2, f2, dflt)	\
-ENTRY (__##name)					\
-	.type	__##name, @gnu_indirect_function;	\
-	SETUP_PIC_REG_LEAF(o3, o5);			\
-	set	m1, %o1;				\
-	andcc	%o0, %o1, %g0;				\
-	be	8f;					\
-	 nop;						\
-	sethi	%gdop_hix22(f1), %o1;			\
-	xor	%o1, %gdop_lox10(f1), %o1;		\
-	ba	10f;					\
-	 nop;						\
-8:	set	m2, %o1;				\
-	andcc	%o0, %o1, %g0;				\
-	be	9f;					\
-	 nop;						\
-	sethi	%gdop_hix22(f2), %o1;			\
-	xor	%o1, %gdop_lox10(f2), %o1;		\
-	ba	10f;					\
-	 nop;						\
-9:	sethi	%gdop_hix22(dflt), %o1;			\
-	xor	%o1, %gdop_lox10(dflt), %o1;		\
-10:	add	%o3, %o1, %o1;				\
-	retl;						\
-	 mov	%o1, %o0;				\
-END (__##name)
-
-# else /* SHARED */
-
-# ifdef __arch64__
-#  define SET(SYM, TMP, REG)	setx SYM, TMP, REG
-# else
-#  define SET(SYM, TMP, REG)	set SYM, REG
-# endif
-
-#  define SPARC_ASM_IFUNC_DFLT(name, dflt)		\
-ENTRY (__##name)					\
-	.type	__##name, @gnu_indirect_function;	\
-	SET(dflt, %g1, %o1);				\
-	retl;						\
-	 mov	%o1, %o0;				\
-END (__##name)
-
-#  define SPARC_ASM_IFUNC1(name, m1, f1, dflt)		\
-ENTRY (__##name)					\
-	.type	__##name, @gnu_indirect_function;	\
-	set	m1, %o1;				\
-	andcc	%o0, %o1, %g0;				\
-	be	9f;					\
-	 nop;						\
-	SET(f1, %g1, %o1);				\
-	ba	10f;					\
-	 nop;						\
-9:	SET(dflt, %g1, %o1);				\
-10:	retl;						\
-	 mov	%o1, %o0;				\
-END (__##name)
-
-#  define SPARC_ASM_IFUNC2(name, m1, f1, m2, f2, dflt)	\
-ENTRY (__##name)					\
-	.type	__##name, @gnu_indirect_function;	\
-	set	m1, %o1;				\
-	andcc	%o0, %o1, %g0;				\
-	be	8f;					\
-	 nop;						\
-	SET(f1, %g1, %o1);				\
-	ba	10f;					\
-	 nop;						\
-8:	set	m2, %o1;				\
-	andcc	%o0, %o1, %g0;				\
-	be	9f;					\
-	 nop;						\
-	SET(f2, %g1, %o1);				\
-	ba	10f;					\
-	 nop;						\
-9:	SET(dflt, %g1, %o1);				\
-10:	retl;						\
-	 mov	%o1, %o0;				\
-END (__##name)
-
-# endif /* SHARED */
-
-#define SPARC_ASM_VIS2_IFUNC(name)			\
-	SPARC_ASM_IFUNC1(name, HWCAP_SPARC_VIS2,	\
-			 __##name##_vis2, __##name##_generic)
-
-#define SPARC_ASM_VIS3_IFUNC(name)			\
-	SPARC_ASM_IFUNC1(name, HWCAP_SPARC_VIS3,	\
-			 __##name##_vis3, __##name##_generic)
-
-#define SPARC_ASM_VIS3_VIS2_IFUNC(name)			\
-	SPARC_ASM_IFUNC2(name, HWCAP_SPARC_VIS3,	\
-			 __##name##_vis3,		\
-			 HWCAP_SPARC_VIS2,		\
-			 __##name##_vis2, __##name##_generic)
-
-#else	/* __ASSEMBLER__ */
-
-# define sparc_libc_ifunc_redirected(redirected_name, name, expr)	\
+#define sparc_libc_ifunc_redirected(redirected_name, name, expr)	\
   __ifunc (redirected_name, name, expr(hwcap), int hwcap, INIT_ARCH)
 
-# define sparc_libc_ifunc(name, expr) sparc_libm_ifunc (name, expr)
+#define sparc_libc_ifunc(name, expr) sparc_libm_ifunc (name, expr)
 
-# define sparc_libm_ifunc(name, expr)				\
+#define sparc_libm_ifunc(name, expr)				\
   __ifunc (name, name, expr, int hwcap, libm_ifunc_init)
 
-# define sparc_libm_ifunc_redirected(redirected_name, name, expr)	\
+#define sparc_libm_ifunc_redirected(redirected_name, name, expr)	\
   __ifunc (redirected_name, name, expr, int hwcap, libm_ifunc_init)
 
-# if defined SHARED
-# define sparc_ifunc_redirected_hidden_def(redirect_name, name) \
+#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__ */
+#else
+#define sparc_ifunc_redirected_hidden_def(redirect_name, name)
+#endif

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=54d11c24eb24ac8ea472680ffc4f29896f2181ad

commit 54d11c24eb24ac8ea472680ffc4f29896f2181ad
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Oct 17 16:42:25 2017 -0200

    sparc: refactor cpu_relax to C
    
    	* sysdeps/sparc/sparc64/cpu_relax.c: New file.
    	* sysdeps/sparc/sparc32/sparcv9/cpu_relax.c: Likewise.
    	* sysdeps/sparc/sparc64/cpu_relax.S: Remove file.
    	* sysdeps/sparc/sparc32/sparcv9/cpu_relax.S: Likewise.

diff --git a/ChangeLog b/ChangeLog
index 679a384..65bd6aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/sparc/sparc64/cpu_relax.c: New file.
+	* sysdeps/sparc/sparc32/sparcv9/cpu_relax.c: Likewise.
+	* sysdeps/sparc/sparc64/cpu_relax.S: Remove file.
+	* sysdeps/sparc/sparc32/sparcv9/cpu_relax.S: Likewise.
+
 	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
 	(libm-sysdep_routines): Add s_nearbyintf-generic and
 	s_nearbyint-generic.
diff --git a/sysdeps/sparc/sparc32/sparcv9/cpu_relax.S b/sysdeps/sparc/sparc32/sparcv9/cpu_relax.S
deleted file mode 100644
index 41a5e72..0000000
--- a/sysdeps/sparc/sparc32/sparcv9/cpu_relax.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/sparc/sparc64/cpu_relax.S>
diff --git a/sysdeps/sparc/sparc64/cpu_relax.c b/sysdeps/sparc/sparc64/cpu_relax.c
index 00c94d5..388e76c 100644
--- a/sysdeps/sparc/sparc64/cpu_relax.c
+++ b/sysdeps/sparc/sparc64/cpu_relax.c
@@ -1,3 +1,21 @@
+/* CPU strand yielding for busy loops.  Linux/sparc64 version.
+   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
+   <http://www.gnu.org/licenses/>.  */
+
 #include <sparc-ifunc.h>
 
 static void

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=169c0a8105e4eafeaabc3431679bb6b82665d6d0

commit 169c0a8105e4eafeaabc3431679bb6b82665d6d0
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Sat Oct 14 09:47:08 2017 -0300

    sparc: cpu_relax ifunc

diff --git a/sysdeps/sparc/sparc64/cpu_relax.S b/sysdeps/sparc/sparc64/cpu_relax.S
deleted file mode 100644
index 5271164..0000000
--- a/sysdeps/sparc/sparc64/cpu_relax.S
+++ /dev/null
@@ -1,67 +0,0 @@
-/* CPU strand yielding for busy loops.
-   Copyright (C) 2012-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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-
-	.text
-__cpu_relax_generic:
-	rd	%ccr, %g0
-	rd	%ccr, %g0
-	rd	%ccr, %g0
-	retl
-	 nop
-	.size	__cpu_relax_generic,.-__cpu_relax_generic
-
-__cpu_relax_pause:
-	wr	%g0, 128, %asr27
-	retl
-	 nop
-	.size	__cpu_relax_pause,.-__cpu_relax_pause
-
-ENTRY(__cpu_relax)
-	.type	__cpu_relax, @gnu_indirect_function
-# ifdef SHARED
-	SETUP_PIC_REG_LEAF(o3, o5)
-# endif
-	set	HWCAP_SPARC_PAUSE, %o1
-	andcc	%o0, %o1, %g0
-	be	1f
-	 nop
-# ifdef SHARED
-	sethi	%gdop_hix22(__cpu_relax_pause), %o1
-	xor	%o1, %gdop_lox10(__cpu_relax_pause), %o1
-# else
-	set	__cpu_relax_pause, %o1
-# endif
-	ba	10f
-	 nop
-1:
-# ifdef SHARED
-	sethi	%gdop_hix22(__cpu_relax_generic), %o1
-	xor	%o1, %gdop_lox10(__cpu_relax_generic), %o1
-# else
-	set	__cpu_relax_generic, %o1
-# endif
-10:
-# ifdef SHARED
-	add	%o3, %o1, %o1
-# endif
-	retl
-	 mov	%o1, %o0
-END(__cpu_relax)
diff --git a/sysdeps/sparc/sparc64/cpu_relax.c b/sysdeps/sparc/sparc64/cpu_relax.c
new file mode 100644
index 0000000..00c94d5
--- /dev/null
+++ b/sysdeps/sparc/sparc64/cpu_relax.c
@@ -0,0 +1,20 @@
+#include <sparc-ifunc.h>
+
+static void
+__cpu_relax_generic (void)
+{
+  asm volatile ("rd %ccr, %g0;"
+		"rd %ccr, %g0;"
+		"rd %ccr, %g0");
+}
+
+static void
+__cpu_relax_pause (void)
+{
+  asm volatile ("wr %g0, 128, %asr27;");
+}
+
+sparc_libc_ifunc (__cpu_relax,
+		  hwcap & HWCAP_SPARC_PAUSE
+		  ? __cpu_relax_pause
+		  : __cpu_relax_generic)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a9fe8f2db2723b77c6e2364c4ce135a8f0e25f37

commit a9fe8f2db2723b77c6e2364c4ce135a8f0e25f37
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 16:11:33 2017 -0300

    sparc: refactor sparc32 nearbyint{f} selector to C
    
    	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
    	(libm-sysdep_routines): Add s_nearbyintf-generic and
    	s_nearbyint-generic.
    	* sysdeps/sparc/sparcv9/fpu/multiarch/s_nearbyint-generic.S: New
    	file.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_nearbyint.c: Likewise.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-generic.S:
    	Likewise.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.c: Likewise.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_nearbyint.S: Remove file.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.S: Likewise.

diff --git a/ChangeLog b/ChangeLog
index 18a32ef..679a384 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,18 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
 	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
+	(libm-sysdep_routines): Add s_nearbyintf-generic and
+	s_nearbyint-generic.
+	* sysdeps/sparc/sparcv9/fpu/multiarch/s_nearbyint-generic.S: New
+	file.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_nearbyint.c: Likewise.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-generic.S:
+	Likewise.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.c: Likewise.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_nearbyint.S: Remove file.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.S: Likewise.
+
+	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
 	(libm-sysdep_routines): Add s_rintf-generic and s_rint-generic.
 	* sysdeps/sparc/sparcv9/fpu/multiarch/s_rint-generic.S: New
 	file.
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
index 459c0e5..1a26ee1 100644
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
@@ -11,9 +11,9 @@ libm-sysdep_routines += s_fabs-vis3 s_fabsf-vis3 s_fabs-generic \
 			s_fabsf-generic s_llrintf-vis3 s_llrint-vis3 \
 			s_llrintf-generic s_llrint-generic \
 			s_rintf-vis3 s_rint-vis3 s_rintf-generic \
-			s_rint-generic \
-			s_fmaf-vis3 s_fma-vis3 s_fma-generic s_fmaf-generic \
-			s_nearbyint-vis3 s_nearbyintf-vis3 \
+			s_rint-generic s_fmaf-vis3 s_fma-vis3 s_fma-generic \
+			s_fmaf-generic s_nearbyint-vis3 s_nearbyintf-vis3 \
+			s_nearbyint-generic s_nearbyintf-generic \
 			s_fdimf-vis3 s_fdim-vis3 s_fdim-generic \
 			s_fdimf-generic \
 			$(sysdep_calls:s_%=m_%)
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-generic.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-generic.S
new file mode 100644
index 0000000..fd4112e
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-generic.S
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+
+#define __nearbyint __nearbyint_generic
+#undef weak_alias
+#define weak_alias(a, b)
+#undef compat_symbol
+#define compat_symbol(a, b, c, d)
+
+#include <sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S>
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint.S
deleted file mode 100644
index 47da9ea..0000000
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint.S
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <sparc-ifunc.h>
-#include <math_ldbl_opt.h>
-
-SPARC_ASM_VIS3_IFUNC(nearbyint)
-
-weak_alias (__nearbyint, nearbyint)
-
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __nearbyint, nearbyintl, GLIBC_2_1)
-#endif
-
-# undef weak_alias
-# define weak_alias(a, b)
-# undef compat_symbol
-# define compat_symbol(a, b, c, d)
-
-#define __nearbyint __nearbyint_generic
-
-#include "../s_nearbyint.S"
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint.c
new file mode 100644
index 0000000..5a2b6e4
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint.c
@@ -0,0 +1,35 @@
+/* nearbyint ifunc resolver, Linux/sparc32 version.
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#define __nearbyint __redirect_nearbyint
+#include <math.h>
+#undef __nearbyint
+#include <math_ldbl_opt.h>
+#include <sparc-ifunc.h>
+
+extern __typeof (__redirect_nearbyint) __nearbyint_vis3 attribute_hidden;
+extern __typeof (__redirect_nearbyint) __nearbyint_generic attribute_hidden;
+
+sparc_libm_ifunc_redirected (__redirect_nearbyint, __nearbyint,
+			     hwcap & HWCAP_SPARC_VIS3
+			     ? __nearbyint_vis3 
+			     : __nearbyint_generic);
+weak_alias (__nearbyint, nearbyint)
+#if LONG_DOUBLE_COMPAT (libm, GLIBC_2_1)
+compat_symbol (libm, __nearbyint, nearbyintl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-generic.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-generic.S
new file mode 100644
index 0000000..8f9088e
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-generic.S
@@ -0,0 +1,4 @@
+#define __nearbyintf __nearbyintf_generic
+#undef weak_alias
+#define weak_alias(a, b)
+#include <sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S>
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.S
deleted file mode 100644
index 95100c1..0000000
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.S
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(nearbyintf)
-
-weak_alias (__nearbyintf, nearbyintf)
-
-# undef weak_alias
-# define weak_alias(a, b)
-
-#define __nearbyintf __nearbyintf_generic
-
-#include "../s_nearbyintf.S"
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.c
new file mode 100644
index 0000000..a513fa7
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.c
@@ -0,0 +1,29 @@
+/* nearbyintf ifunc resolver, Linux/sparc32 version.
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+#include <sparc-ifunc.h>
+
+extern __typeof (nearbyintf) __nearbyintf_vis3 attribute_hidden;
+extern __typeof (nearbyintf) __nearbyintf_generic attribute_hidden;
+
+sparc_libm_ifunc (__nearbyintf,
+		  hwcap & HWCAP_SPARC_VIS3
+		  ? __nearbyintf_vis3 
+		  : __nearbyintf_generic);
+weak_alias (__nearbyintf, nearbyintf)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c4ed918503001f89607682c6f342920223773bc3

commit c4ed918503001f89607682c6f342920223773bc3
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 16:05:24 2017 -0300

    sparc: refactor sparc32 rint{f} selector to C
    
    	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
    	(libm-sysdep_routines): Add s_rintf-generic and s_rint-generic.
    	* sysdeps/sparc/sparcv9/fpu/multiarch/s_rint-generic.S: New
    	file.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_rint.c: Likewise.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_rintf-generic.S:
    	Likewise.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_rintf.c: Likewise.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_rint.S: Remove file.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_rintf.S: Likewise.

diff --git a/ChangeLog b/ChangeLog
index 425c978..18a32ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,17 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
 	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
+	(libm-sysdep_routines): Add s_rintf-generic and s_rint-generic.
+	* sysdeps/sparc/sparcv9/fpu/multiarch/s_rint-generic.S: New
+	file.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_rint.c: Likewise.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_rintf-generic.S:
+	Likewise.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_rintf.c: Likewise.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_rint.S: Remove file.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_rintf.S: Likewise.
+
+	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
 	(libm-sysdep_routines): Add s_llrintf-generic and s_llrint-generic.
 	* sysdeps/sparc/sparcv9/fpu/multiarch/s_llrint-generic.S: New
 	file.
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
index 5b6e2a6..459c0e5 100644
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
@@ -10,7 +10,8 @@ sysdep_routines += $(sysdep_calls)
 libm-sysdep_routines += s_fabs-vis3 s_fabsf-vis3 s_fabs-generic \
 			s_fabsf-generic s_llrintf-vis3 s_llrint-vis3 \
 			s_llrintf-generic s_llrint-generic \
-			s_rintf-vis3 s_rint-vis3 \
+			s_rintf-vis3 s_rint-vis3 s_rintf-generic \
+			s_rint-generic \
 			s_fmaf-vis3 s_fma-vis3 s_fma-generic s_fmaf-generic \
 			s_nearbyint-vis3 s_nearbyintf-vis3 \
 			s_fdimf-vis3 s_fdim-vis3 s_fdim-generic \
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rint-generic.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rint-generic.S
new file mode 100644
index 0000000..9709b1e
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rint-generic.S
@@ -0,0 +1,8 @@
+#include <math_ldbl_opt.h>
+
+#define __rint __rint_generic
+#undef weak_alias
+#define weak_alias(a, b)
+#undef compat_symbol
+#define compat_symbol(a, b, c, d)
+#include <sysdeps/sparc/sparc32/sparcv9/fpu/s_rint.S>
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rint.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rint.S
deleted file mode 100644
index de893fa..0000000
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rint.S
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <sparc-ifunc.h>
-#include <math_ldbl_opt.h>
-
-SPARC_ASM_VIS3_IFUNC(rint)
-
-weak_alias (__rint, rint)
-
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
-compat_symbol (libm, __rint, rintl, GLIBC_2_0)
-#endif
-
-# undef weak_alias
-# define weak_alias(a, b)
-# undef compat_symbol
-# define compat_symbol(a, b, c, d)
-
-#define __rint __rint_generic
-
-#include "../s_rint.S"
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rint.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rint.c
new file mode 100644
index 0000000..b6714e6
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rint.c
@@ -0,0 +1,35 @@
+/* rint ifunc resolver, Linux/sparc32 version.
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#define __rint __redirect_rint
+#include <math.h>
+#undef __rint
+#include <math_ldbl_opt.h>
+#include <sparc-ifunc.h>
+
+extern __typeof (__redirect_rint) __rint_vis3 attribute_hidden;
+extern __typeof (__redirect_rint) __rint_generic attribute_hidden;
+
+sparc_libm_ifunc_redirected (__redirect_rint, __rint,
+			     hwcap & HWCAP_SPARC_VIS3
+			     ? __rint_vis3 
+			     : __rint_generic);
+weak_alias (__rint, rint)
+#if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)
+compat_symbol (libm, __rint, rintl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rintf-generic.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rintf-generic.S
new file mode 100644
index 0000000..185ba6b
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rintf-generic.S
@@ -0,0 +1,4 @@
+#define __rintf __rintf_generic
+#undef weak_alias
+#define weak_alias(a, b)
+#include <sysdeps/sparc/sparc32/sparcv9/fpu/s_rintf.S>
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rintf.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rintf.S
deleted file mode 100644
index 38fd936..0000000
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rintf.S
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(rintf)
-
-weak_alias (__rintf, rintf)
-
-# undef weak_alias
-# define weak_alias(a, b)
-
-#define __rintf __rintf_generic
-
-#include "../s_rintf.S"
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rintf.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rintf.c
new file mode 100644
index 0000000..bfe35d5
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rintf.c
@@ -0,0 +1,29 @@
+/* rintf ifunc resolver, Linux/sparc32 version.
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+#include <sparc-ifunc.h>
+
+extern __typeof (rintf) __rintf_vis3 attribute_hidden;
+extern __typeof (rintf) __rintf_generic attribute_hidden;
+
+sparc_libm_ifunc (__rintf,
+		  hwcap & HWCAP_SPARC_VIS3
+		  ? __rintf_vis3 
+		  : __rintf_generic);
+weak_alias (__rintf, rintf)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ab688eca2950dd381e879d3b2a0b5fcf9f69dcfa

commit ab688eca2950dd381e879d3b2a0b5fcf9f69dcfa
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 16:00:36 2017 -0300

    sparc: refactor sparc32 llrint{f} selector to C
    
    	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
    	(libm-sysdep_routines): Add s_llrintf-generic and s_llrint-generic.
    	* sysdeps/sparc/sparcv9/fpu/multiarch/s_llrint-generic.S: New
    	file.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_llrint.c: Likewise.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_llrintf-generic.S:
    	Likewise.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_llrintf.c: Likewise.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_llrint.S: Remove file.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_llrintf.S: Likewise.

diff --git a/ChangeLog b/ChangeLog
index 2d2186e..425c978 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,17 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
 	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
+	(libm-sysdep_routines): Add s_llrintf-generic and s_llrint-generic.
+	* sysdeps/sparc/sparcv9/fpu/multiarch/s_llrint-generic.S: New
+	file.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_llrint.c: Likewise.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_llrintf-generic.S:
+	Likewise.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_llrintf.c: Likewise.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_llrint.S: Remove file.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_llrintf.S: Likewise.
+
+	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
 	(libm-sysdep_routines): Add s_fabsf-generic and s_fabs-generic.
 	* sysdeps/sparc/sparcv9/fpu/multiarch/s_fabs-generic.S: New
 	file.
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
index bd8e341..5b6e2a6 100644
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
@@ -9,6 +9,7 @@ sysdep_calls := s_copysignf-vis3 s_copysign-vis3 s_copysignf-generic \
 sysdep_routines += $(sysdep_calls)
 libm-sysdep_routines += s_fabs-vis3 s_fabsf-vis3 s_fabs-generic \
 			s_fabsf-generic s_llrintf-vis3 s_llrint-vis3 \
+			s_llrintf-generic s_llrint-generic \
 			s_rintf-vis3 s_rint-vis3 \
 			s_fmaf-vis3 s_fma-vis3 s_fma-generic s_fmaf-generic \
 			s_nearbyint-vis3 s_nearbyintf-vis3 \
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrint-generic.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrint-generic.S
new file mode 100644
index 0000000..ceb5d14
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrint-generic.S
@@ -0,0 +1,8 @@
+#include <math_ldbl_opt.h>
+
+#define __llrint __llrint_generic
+#undef weak_alias
+#define weak_alias(a, b)
+#undef compat_symbol
+#define compat_symbol(a, b, c, d)
+#include <sysdeps/sparc/sparc32/sparcv9/fpu/s_llrint.S>
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrint.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrint.S
deleted file mode 100644
index fd23041..0000000
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrint.S
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <sparc-ifunc.h>
-#include <math_ldbl_opt.h>
-
-SPARC_ASM_VIS3_IFUNC(llrint)
-
-weak_alias (__llrint, llrint)
-
-strong_alias (__llrint, __lllrint)
-weak_alias (__lllrint, lllrint)
-
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __llrint, llrintl, GLIBC_2_1)
-#endif
-
-# undef weak_alias
-# define weak_alias(a, b)
-# undef strong_alias
-# define strong_alias(a, b)
-# undef compat_symbol
-# define compat_symbol(a, b, c, d)
-
-#define __llrint __llrint_generic
-
-#include "../s_llrint.S"
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrint.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrint.c
new file mode 100644
index 0000000..b10cad4
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrint.c
@@ -0,0 +1,36 @@
+/* llrint ifunc resolver, Linux/sparc32 version.
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#define __llrint __redirect_llrint
+#include <math.h>
+#undef __llrint
+#include <math_ldbl_opt.h>
+#include <sparc-ifunc.h>
+
+extern __typeof (__redirect_llrint) __llrint_vis3 attribute_hidden;
+extern __typeof (__redirect_llrint) __llrint_generic attribute_hidden;
+
+sparc_libm_ifunc_redirected (__redirect_llrint, __llrint,
+			     hwcap & HWCAP_SPARC_VIS3
+			     ? __llrint_vis3 
+			     : __llrint_generic);
+weak_alias (__llrint, llrint)
+
+#if LONG_DOUBLE_COMPAT (libm, GLIBC_2_1)
+compat_symbol (libm, __llrint, llrintl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrintf-generic.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrintf-generic.S
new file mode 100644
index 0000000..83c462c
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrintf-generic.S
@@ -0,0 +1,4 @@
+#define __llrintf __llrintf_generic
+#undef weak_alias
+#define weak_alias(a, b)
+#include <sysdeps/sparc/sparc32/sparcv9/fpu/s_llrintf.S>
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrintf.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrintf.S
deleted file mode 100644
index 8af5244..0000000
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrintf.S
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(llrintf)
-
-weak_alias (__llrintf, llrintf)
-
-strong_alias (__llrintf, __lllrintf)
-weak_alias (__lllrintf, lllrintf)
-
-# undef weak_alias
-# define weak_alias(a, b)
-# undef strong_alias
-# define strong_alias(a, b)
-
-#define __llrintf __llrintf_generic
-
-#include "../s_llrintf.S"
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrintf.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrintf.c
new file mode 100644
index 0000000..0594a16
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrintf.c
@@ -0,0 +1,29 @@
+/* llrintf ifunc resolver, Linux/sparc32 version.
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+#include <sparc-ifunc.h>
+
+extern __typeof (llrintf) __llrintf_vis3 attribute_hidden;
+extern __typeof (llrintf) __llrintf_generic attribute_hidden;
+
+sparc_libm_ifunc (__llrintf,
+		  hwcap & HWCAP_SPARC_VIS3
+		  ? __llrintf_vis3 
+		  : __llrintf_generic);
+weak_alias (__llrintf, llrintf)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=78527cbd2aeda2744df44119ecc79cfa14b2b4f1

commit 78527cbd2aeda2744df44119ecc79cfa14b2b4f1
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 15:49:25 2017 -0300

    sparc: refactor sparc32 fabs{f} selector to C
    
    	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
    	(libm-sysdep_routines): Add s_fabsf-generic and s_fabs-generic.
    	* sysdeps/sparc/sparcv9/fpu/multiarch/s_fabs-generic.S: New
    	file.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_fabs.c: Likewise.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_fabsf-generic.S:
    	Likewise.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_fabsf.c: Likewise.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_fabs.S: Remove file.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_fabsf.S: Likewise.

diff --git a/ChangeLog b/ChangeLog
index 4ebd54b..2d2186e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,17 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
 	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
+	(libm-sysdep_routines): Add s_fabsf-generic and s_fabs-generic.
+	* sysdeps/sparc/sparcv9/fpu/multiarch/s_fabs-generic.S: New
+	file.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_fabs.c: Likewise.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_fabsf-generic.S:
+	Likewise.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_fabsf.c: Likewise.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_fabs.S: Remove file.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_fabsf.S: Likewise.
+
+	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
 	(sysdep_calls): New rule.
 	(sysdep_routines): Use sysdep_calls as base.
 	(libm-sysdep_routines): Add generic rule for symbols shared with
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
index b8d1126..bd8e341 100644
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
@@ -7,7 +7,8 @@ sysdep_calls := s_copysignf-vis3 s_copysign-vis3 s_copysignf-generic \
 		s_copysign-generic
 
 sysdep_routines += $(sysdep_calls)
-libm-sysdep_routines += s_fabs-vis3 s_fabsf-vis3 s_llrintf-vis3 s_llrint-vis3 \
+libm-sysdep_routines += s_fabs-vis3 s_fabsf-vis3 s_fabs-generic \
+			s_fabsf-generic s_llrintf-vis3 s_llrint-vis3 \
 			s_rintf-vis3 s_rint-vis3 \
 			s_fmaf-vis3 s_fma-vis3 s_fma-generic s_fmaf-generic \
 			s_nearbyint-vis3 s_nearbyintf-vis3 \
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabs-generic.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabs-generic.S
new file mode 100644
index 0000000..ddfdf4b
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabs-generic.S
@@ -0,0 +1,8 @@
+#include <math_ldbl_opt.h>
+
+#define __fabs __fabs_generic
+#undef weak_alias
+#define weak_alias(a, b)
+#undef compat_symbol
+#define compat_symbol(a, b, c, d)
+#include <sysdeps/sparc/sparc32/fpu/s_fabs.S>
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabs.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabs.S
deleted file mode 100644
index 72cc08f..0000000
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabs.S
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <sparc-ifunc.h>
-#include <math_ldbl_opt.h>
-
-SPARC_ASM_VIS3_IFUNC(fabs)
-
-weak_alias (__fabs, fabs)
-#if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)
-compat_symbol (libm, __fabs, fabsl, GLIBC_2_0);
-#endif
-
-# undef weak_alias
-# define weak_alias(a, b)
-# undef compat_symbol
-# define compat_symbol(a, b, c, d)
-
-#define __fabs __fabs_generic
-
-#include "../s_fabs.S"
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabs.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabs.c
new file mode 100644
index 0000000..58b0192
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabs.c
@@ -0,0 +1,35 @@
+/* fabs ifunc resolver, Linux/sparc32 version.
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#define __fabs __redirect_fabs
+#include <math.h>
+#undef __fabs
+#include <math_ldbl_opt.h>
+#include <sparc-ifunc.h>
+
+extern __typeof (__redirect_fabs) __fabs_vis3 attribute_hidden;
+extern __typeof (__redirect_fabs) __fabs_generic attribute_hidden;
+
+sparc_libm_ifunc_redirected (__redirect_fabs, __fabs,
+			     hwcap & HWCAP_SPARC_VIS3
+			     ? __fabs_vis3 
+			     : __fabs_generic);
+weak_alias (__fabs, fabs)
+#if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)
+compat_symbol (libm, __fabs, fabsl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabsf-generic.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabsf-generic.S
new file mode 100644
index 0000000..1d55c95
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabsf-generic.S
@@ -0,0 +1,4 @@
+#define __fabsf __fabsf_generic
+#undef weak_alias
+#define weak_alias(a, b)
+#include <sysdeps/sparc/sparc32/fpu/s_fabsf.S>
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabsf.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabsf.S
deleted file mode 100644
index 0f2e11e..0000000
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabsf.S
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(fabsf)
-
-weak_alias (__fabsf, fabsf)
-
-# undef weak_alias
-# define weak_alias(a, b)
-
-#define __fabsf __fabsf_generic
-
-#include "../../../fpu/s_fabsf.S"
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabsf.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabsf.c
new file mode 100644
index 0000000..76711b9
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabsf.c
@@ -0,0 +1,29 @@
+/* fabsf ifunc resolver, Linux/sparc32 version.
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+#include <sparc-ifunc.h>
+
+extern __typeof (fabsf) __fabsf_vis3 attribute_hidden;
+extern __typeof (fabsf) __fabsf_generic attribute_hidden;
+
+sparc_libm_ifunc (__fabsf,
+		  hwcap & HWCAP_SPARC_VIS3
+		  ? __fabsf_vis3 
+		  : __fabsf_generic);
+weak_alias (__fabsf, fabsf)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ed11b4fbeba514188b18660483bc92e804da07e7

commit ed11b4fbeba514188b18660483bc92e804da07e7
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 15:34:33 2017 -0300

    sparc: refactor sparc32 copysign selector to C
    
    	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
    	(sysdep_calls): New rule.
    	(sysdep_routines): Use sysdep_calls as base.
    	(libm-sysdep_routines): Add generic rule for symbols shared with
    	libc.  Add s_copysign-generic and s_copysign-generic objects.
    	* sysdeps/sparc/sparcv9/fpu/multiarch/s_copysign-generic.S: New
    	file.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_copysign.c: Likewise.
    	* sysdeps/sparc/sparcv9/fpu/multiarch/s_copysignf-generic.S:
    	Likewise.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_copysignf.c: Likewise.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_copysign.S: Remove file.
    	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_copysignf.S: Likewise.

diff --git a/ChangeLog b/ChangeLog
index bbaa3aa..4ebd54b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
+	(sysdep_calls): New rule.
+	(sysdep_routines): Use sysdep_calls as base.
+	(libm-sysdep_routines): Add generic rule for symbols shared with
+	libc.  Add s_copysign-generic and s_copysign-generic objects.
+	* sysdeps/sparc/sparcv9/fpu/multiarch/s_copysign-generic.S: New
+	file.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_copysign.c: Likewise.
+	* sysdeps/sparc/sparcv9/fpu/multiarch/s_copysignf-generic.S:
+	Likewise.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_copysignf.c: Likewise.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_copysign.S: Remove file.
+	* sysdeps/sparc32/sparcv9/fpu/multiarch/s_copysignf.S: Likewise.
+
 	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
 	Add add_n-generic.
 	* sysdeps/sparc/sparc64/multiarch/add_n-generic.S: New file.
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
index 62bf6f1..b8d1126 100644
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
@@ -1,12 +1,19 @@
 ifeq ($(subdir),math)
-libm-sysdep_routines += m_copysignf-vis3 m_copysign-vis3 s_fabs-vis3 \
-			s_fabsf-vis3 s_llrintf-vis3 s_llrint-vis3 \
+
+# These functions are built both for libc and libm because they're required
+# by printf.  While the libc objects have the prefix s_, the libm ones are
+# prefixed with  m_.
+sysdep_calls := s_copysignf-vis3 s_copysign-vis3 s_copysignf-generic \
+		s_copysign-generic
+
+sysdep_routines += $(sysdep_calls)
+libm-sysdep_routines += s_fabs-vis3 s_fabsf-vis3 s_llrintf-vis3 s_llrint-vis3 \
 			s_rintf-vis3 s_rint-vis3 \
 			s_fmaf-vis3 s_fma-vis3 s_fma-generic s_fmaf-generic \
 			s_nearbyint-vis3 s_nearbyintf-vis3 \
 			s_fdimf-vis3 s_fdim-vis3 s_fdim-generic \
-			s_fdimf-generic
-sysdep_routines += s_copysignf-vis3 s_copysign-vis3
+			s_fdimf-generic \
+			$(sysdep_calls:s_%=m_%)
 
 CFLAGS-s_fdimf-vis3.c += -Wa,-Av9d -mvis3
 CFLAGS-s_fdim-vis3.c += -Wa,-Av9d -mvis3
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-generic.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-generic.S
new file mode 100644
index 0000000..55fb0ed
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-generic.S
@@ -0,0 +1,8 @@
+#include <math_ldbl_opt.h>
+
+#define __copysign __copysign_generic
+#undef weak_alias
+#define weak_alias(a, b)
+#undef compat_symbol
+#define compat_symbol(a, b, c, d)
+#include <sysdeps/sparc/sparc32/fpu/s_copysign.S>
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S
deleted file mode 100644
index 5d26430..0000000
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <sparc-ifunc.h>
-#include <math_ldbl_opt.h>
-
-SPARC_ASM_VIS3_IFUNC(copysign)
-
-weak_alias (__copysign, copysign)
-#if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)
-compat_symbol (libm, __copysign, copysignl, GLIBC_2_0);
-#endif
-#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
-compat_symbol (libc, __copysign, copysignl, GLIBC_2_0);
-#endif
-
-# undef weak_alias
-# define weak_alias(a, b)
-# undef compat_symbol
-# define compat_symbol(a, b, c, d)
-
-#define __copysign __copysign_generic
-
-#include "../../../fpu/s_copysign.S"
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c
new file mode 100644
index 0000000..f11181b
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c
@@ -0,0 +1,38 @@
+/* copysign ifunc resolver, Linux/sparc32 version.
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#define __copysign __redirect_copysign
+#include <math.h>
+#include <math_ldbl_opt.h>
+#undef __copysign
+#include <sparc-ifunc.h>
+
+extern __typeof (__redirect_copysign) __copysign_vis3 attribute_hidden;
+extern __typeof (__redirect_copysign) __copysign_generic attribute_hidden;
+
+sparc_libm_ifunc_redirected (__redirect_copysign, __copysign,
+			     hwcap & HWCAP_SPARC_VIS3
+			     ? __copysign_vis3 
+			     : __copysign_generic);
+weak_alias (__copysign, copysign)
+#if LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)
+compat_symbol (libm, __copysign, copysignl, GLIBC_2_0);
+#endif
+#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
+compat_symbol (libc, __copysign, copysignl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-generic.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-generic.S
new file mode 100644
index 0000000..ebe0759
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-generic.S
@@ -0,0 +1,4 @@
+#define __copysignf __copysignf_generic
+#undef weak_alias
+#define weak_alias(a, b)
+#include <sysdeps/sparc/sparc32/fpu/s_copysignf.S>
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S
deleted file mode 100644
index cd40955..0000000
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(copysignf)
-
-weak_alias (__copysignf, copysignf)
-
-# undef weak_alias
-# define weak_alias(a, b)
-
-#define __copysignf __copysignf_generic
-
-#include "../../../fpu/s_copysignf.S"
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.c
new file mode 100644
index 0000000..573c14d
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.c
@@ -0,0 +1,11 @@
+#include <math.h>
+#include <sparc-ifunc.h>
+
+extern __typeof (copysignf) __copysignf_vis3 attribute_hidden;
+extern __typeof (copysignf) __copysignf_generic attribute_hidden;
+
+sparc_libm_ifunc (__copysignf,
+		  hwcap & HWCAP_SPARC_VIS3
+		  ? __copysignf_vis3 
+		  : __copysignf_generic);
+weak_alias (__copysignf, copysignf)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ea4c72f516b29129a89d98bcfbfe4e552372550b

commit ea4c72f516b29129a89d98bcfbfe4e552372550b
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 15:01:58 2017 -0300

    sparc: refactor sparc64 __mpn_add_n selector to C
    
    	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
    	Add add_n-generic.
    	* sysdeps/sparc/sparc64/multiarch/add_n-generic.S: New file.
    	* sysdeps/sparc/sparc64/multiarch/add_n.c: Likewise.
    	* sysdeps/sparc/sparc64/multiarch/add_n.S: Remove file.

diff --git a/ChangeLog b/ChangeLog
index d099db4..bbaa3aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
 	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
+	Add add_n-generic.
+	* sysdeps/sparc/sparc64/multiarch/add_n-generic.S: New file.
+	* sysdeps/sparc/sparc64/multiarch/add_n.c: Likewise.
+	* sysdeps/sparc/sparc64/multiarch/add_n.S: Remove file.
+
+	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
 	Add submul_1-generic.
 	* sysdeps/sparc/sparc64/multiarch/submul_1-generic.S: New file.
 	* sysdeps/sparc/sparc64/multiarch/submul_1.c: Likewise.
diff --git a/sysdeps/sparc/sparc64/multiarch/Makefile b/sysdeps/sparc/sparc64/multiarch/Makefile
index d62a509..ba8ede1 100644
--- a/sysdeps/sparc/sparc64/multiarch/Makefile
+++ b/sysdeps/sparc/sparc64/multiarch/Makefile
@@ -14,8 +14,8 @@ endif
 
 ifeq ($(subdir),stdlib)
 sysdep_routines += mul_1-vis3 mul_1-generic addmul_1-vis3 addmul_1-generic \
-		   submul_1-vis3 submul_1-generic add_n-vis3 sub_n-vis3 \
-		   sub_n-generic
+		   submul_1-vis3 submul_1-generic add_n-vis3 add_n-generic \
+		   sub_n-vis3 sub_n-generic
 endif
 
 ifeq ($(subdir),math)
diff --git a/sysdeps/sparc/sparc64/multiarch/add_n-generic.S b/sysdeps/sparc/sparc64/multiarch/add_n-generic.S
new file mode 100644
index 0000000..a16e709
--- /dev/null
+++ b/sysdeps/sparc/sparc64/multiarch/add_n-generic.S
@@ -0,0 +1,2 @@
+#define __mpn_add_n __mpn_add_n_generic
+#include <sysdeps/sparc/sparc64/add_n.S>
diff --git a/sysdeps/sparc/sparc64/multiarch/add_n.S b/sysdeps/sparc/sparc64/multiarch/add_n.S
deleted file mode 100644
index 9ffaf78..0000000
--- a/sysdeps/sparc/sparc64/multiarch/add_n.S
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Multiple versions of add_n
-
-   Copyright (C) 2013-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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-
-ENTRY(__mpn_add_n)
-	.type	__mpn_add_n, @gnu_indirect_function
-# ifdef SHARED
-	SETUP_PIC_REG_LEAF(o3, o5)
-# endif
-	set	HWCAP_SPARC_VIS3, %o1
-	andcc	%o0, %o1, %g0
-	be	1f
-	 nop
-# ifdef SHARED
-	sethi	%gdop_hix22(__mpn_add_n_vis3), %o1
-	xor	%o1, %gdop_lox10(__mpn_add_n_vis3), %o1
-# else
-	set	__mpn_add_n_vis3, %o1
-# endif
-	ba	10f
-	 nop
-1:
-# ifdef SHARED
-	sethi	%gdop_hix22(__mpn_add_n_generic), %o1
-	xor	%o1, %gdop_lox10(__mpn_add_n_generic), %o1
-# else
-	set	__mpn_add_n_generic, %o1
-# endif
-10:
-# ifdef SHARED
-	add	%o3, %o1, %o1
-# endif
-	retl
-	 mov	%o1, %o0
-END(__mpn_add_n)
-
-#define __mpn_add_n __mpn_add_n_generic
-#include "../add_n.S"
diff --git a/sysdeps/sparc/sparc64/multiarch/add_n.c b/sysdeps/sparc/sparc64/multiarch/add_n.c
new file mode 100644
index 0000000..6b509d1
--- /dev/null
+++ b/sysdeps/sparc/sparc64/multiarch/add_n.c
@@ -0,0 +1,28 @@
+/* __mpn_add_n ifunc resolver, Linux/sparc64 version.
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <gmp.h>
+#include <sparc-ifunc.h>
+
+extern __typeof (mpn_add_n) __mpn_add_n_vis3 attribute_hidden;
+extern __typeof (mpn_add_n) __mpn_add_n_generic attribute_hidden;
+
+sparc_libm_ifunc (__mpn_add_n,
+		  hwcap & HWCAP_SPARC_VIS3
+		  ? __mpn_add_n_vis3
+		  : __mpn_add_n_generic)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=cac8b49c6316e1045baa5bb124d8c00c9bed6aed

commit cac8b49c6316e1045baa5bb124d8c00c9bed6aed
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 14:59:09 2017 -0300

    sparc: refactor sparc64 __mpn_submul_1 selector to C

diff --git a/ChangeLog b/ChangeLog
index 784fe40..d099db4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
 	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
+	Add submul_1-generic.
+	* sysdeps/sparc/sparc64/multiarch/submul_1-generic.S: New file.
+	* sysdeps/sparc/sparc64/multiarch/submul_1.c: Likewise.
+	* sysdeps/sparc/sparc64/multiarch/submul_1.S: Remove file.
+
+	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
 	Add addmul_1-generic.
 	* sysdeps/sparc/sparc64/multiarch/addmul_1-generic.S: New file.
 	* sysdeps/sparc/sparc64/multiarch/addmul_1.c: Likewise.
diff --git a/sysdeps/sparc/sparc64/multiarch/Makefile b/sysdeps/sparc/sparc64/multiarch/Makefile
index fbd7e22..d62a509 100644
--- a/sysdeps/sparc/sparc64/multiarch/Makefile
+++ b/sysdeps/sparc/sparc64/multiarch/Makefile
@@ -14,7 +14,8 @@ endif
 
 ifeq ($(subdir),stdlib)
 sysdep_routines += mul_1-vis3 mul_1-generic addmul_1-vis3 addmul_1-generic \
-		   submul_1-vis3 add_n-vis3 sub_n-vis3 sub_n-generic
+		   submul_1-vis3 submul_1-generic add_n-vis3 sub_n-vis3 \
+		   sub_n-generic
 endif
 
 ifeq ($(subdir),math)
diff --git a/sysdeps/sparc/sparc64/multiarch/submul_1-generic.S b/sysdeps/sparc/sparc64/multiarch/submul_1-generic.S
new file mode 100644
index 0000000..4c15360
--- /dev/null
+++ b/sysdeps/sparc/sparc64/multiarch/submul_1-generic.S
@@ -0,0 +1,2 @@
+#define __mpn_submul_1 __mpn_submul_1_generic
+#include <sysdeps/sparc/sparc64/submul_1.S>
diff --git a/sysdeps/sparc/sparc64/multiarch/submul_1.S b/sysdeps/sparc/sparc64/multiarch/submul_1.S
deleted file mode 100644
index 3c297d9..0000000
--- a/sysdeps/sparc/sparc64/multiarch/submul_1.S
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Multiple versions of submul_1
-
-   Copyright (C) 2013-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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-
-ENTRY(__mpn_submul_1)
-	.type	__mpn_submul_1, @gnu_indirect_function
-# ifdef SHARED
-	SETUP_PIC_REG_LEAF(o3, o5)
-# endif
-	set	HWCAP_SPARC_VIS3, %o1
-	andcc	%o0, %o1, %g0
-	be	1f
-	 nop
-# ifdef SHARED
-	sethi	%gdop_hix22(__mpn_submul_1_vis3), %o1
-	xor	%o1, %gdop_lox10(__mpn_submul_1_vis3), %o1
-# else
-	set	__mpn_submul_1_vis3, %o1
-# endif
-	ba	10f
-	 nop
-1:
-# ifdef SHARED
-	sethi	%gdop_hix22(__mpn_submul_1_generic), %o1
-	xor	%o1, %gdop_lox10(__mpn_submul_1_generic), %o1
-# else
-	set	__mpn_submul_1_generic, %o1
-# endif
-10:
-# ifdef SHARED
-	add	%o3, %o1, %o1
-# endif
-	retl
-	 mov	%o1, %o0
-END(__mpn_submul_1)
-
-#define __mpn_submul_1 __mpn_submul_1_generic
-#include "../submul_1.S"
diff --git a/sysdeps/sparc/sparc64/multiarch/submul_1.c b/sysdeps/sparc/sparc64/multiarch/submul_1.c
new file mode 100644
index 0000000..ab9433f
--- /dev/null
+++ b/sysdeps/sparc/sparc64/multiarch/submul_1.c
@@ -0,0 +1,28 @@
+/* __mpn_submul_1 ifunc resolver, Linux/sparc64 version. 
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <gmp.h>
+#include <sparc-ifunc.h>
+
+extern __typeof (mpn_submul_1) __mpn_submul_1_vis3 attribute_hidden;
+extern __typeof (mpn_submul_1) __mpn_submul_1_generic attribute_hidden;
+
+sparc_libm_ifunc (__mpn_submul_1,
+		  hwcap & HWCAP_SPARC_VIS3
+		  ? __mpn_submul_1_vis3
+		  : __mpn_submul_1_generic)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=6623cbaaababaca2a87805fa447b7e4a3d0817e3

commit 6623cbaaababaca2a87805fa447b7e4a3d0817e3
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 14:56:29 2017 -0300

    sparc: refactor sparc64 __mpn_addmul_1 selector to C
    
    	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
    	Add addmul_1-generic.
    	* sysdeps/sparc/sparc64/multiarch/addmul_1-generic.S: New file.
    	* sysdeps/sparc/sparc64/multiarch/addmul_1.c: Likewise.
    	* sysdeps/sparc/sparc64/multiarch/addmul_1.S: Remove file.

diff --git a/ChangeLog b/ChangeLog
index 3c8dc05..784fe40 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
 	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
+	Add addmul_1-generic.
+	* sysdeps/sparc/sparc64/multiarch/addmul_1-generic.S: New file.
+	* sysdeps/sparc/sparc64/multiarch/addmul_1.c: Likewise.
+	* sysdeps/sparc/sparc64/multiarch/addmul_1.S: Remove file.
+
+	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
 	Add sub_n-generic.
 	* sysdeps/sparc/sparc64/multiarch/sub_n-generic.S: New file.
 	* sysdeps/sparc/sparc64/multiarch/sub_n.c: Likewise.
diff --git a/sysdeps/sparc/sparc64/multiarch/Makefile b/sysdeps/sparc/sparc64/multiarch/Makefile
index 10fe54f..fbd7e22 100644
--- a/sysdeps/sparc/sparc64/multiarch/Makefile
+++ b/sysdeps/sparc/sparc64/multiarch/Makefile
@@ -13,8 +13,8 @@ sysdep_routines += memcpy-ultra3 memcpy-niagara1 memcpy-niagara2 \
 endif
 
 ifeq ($(subdir),stdlib)
-sysdep_routines += mul_1-vis3 mul_1-generic addmul_1-vis3 submul_1-vis3 \
-		   add_n-vis3 sub_n-vis3 sub_n-generic
+sysdep_routines += mul_1-vis3 mul_1-generic addmul_1-vis3 addmul_1-generic \
+		   submul_1-vis3 add_n-vis3 sub_n-vis3 sub_n-generic
 endif
 
 ifeq ($(subdir),math)
diff --git a/sysdeps/sparc/sparc64/multiarch/addmul_1-generic.S b/sysdeps/sparc/sparc64/multiarch/addmul_1-generic.S
new file mode 100644
index 0000000..5bf1da7
--- /dev/null
+++ b/sysdeps/sparc/sparc64/multiarch/addmul_1-generic.S
@@ -0,0 +1,2 @@
+#define __mpn_addmul_1 __mpn_addmul_1_generic
+#include <sysdeps/sparc/sparc64/addmul_1.S>
diff --git a/sysdeps/sparc/sparc64/multiarch/addmul_1.S b/sysdeps/sparc/sparc64/multiarch/addmul_1.S
deleted file mode 100644
index dcb1da1..0000000
--- a/sysdeps/sparc/sparc64/multiarch/addmul_1.S
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Multiple versions of addmul_1
-
-   Copyright (C) 2013-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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-
-ENTRY(__mpn_addmul_1)
-	.type	__mpn_addmul_1, @gnu_indirect_function
-# ifdef SHARED
-	SETUP_PIC_REG_LEAF(o3, o5)
-# endif
-	set	HWCAP_SPARC_VIS3, %o1
-	andcc	%o0, %o1, %g0
-	be	1f
-	 nop
-# ifdef SHARED
-	sethi	%gdop_hix22(__mpn_addmul_1_vis3), %o1
-	xor	%o1, %gdop_lox10(__mpn_addmul_1_vis3), %o1
-# else
-	set	__mpn_addmul_1_vis3, %o1
-# endif
-	ba	10f
-	 nop
-1:
-# ifdef SHARED
-	sethi	%gdop_hix22(__mpn_addmul_1_generic), %o1
-	xor	%o1, %gdop_lox10(__mpn_addmul_1_generic), %o1
-# else
-	set	__mpn_addmul_1_generic, %o1
-# endif
-10:
-# ifdef SHARED
-	add	%o3, %o1, %o1
-# endif
-	retl
-	 mov	%o1, %o0
-END(__mpn_addmul_1)
-
-#define __mpn_addmul_1 __mpn_addmul_1_generic
-#include "../addmul_1.S"
diff --git a/sysdeps/sparc/sparc64/multiarch/addmul_1.c b/sysdeps/sparc/sparc64/multiarch/addmul_1.c
new file mode 100644
index 0000000..78bc34d
--- /dev/null
+++ b/sysdeps/sparc/sparc64/multiarch/addmul_1.c
@@ -0,0 +1,28 @@
+/* __mpn_addmul_1 ifunc resolver, Linux/sparc64 version. 
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <gmp.h>
+#include <sparc-ifunc.h>
+
+extern __typeof (mpn_addmul_1) __mpn_addmul_1_vis3 attribute_hidden;
+extern __typeof (mpn_addmul_1) __mpn_addmul_1_generic attribute_hidden;
+
+sparc_libm_ifunc (__mpn_addmul_1,
+		  hwcap & HWCAP_SPARC_VIS3
+		  ? __mpn_addmul_1_vis3
+		  : __mpn_addmul_1_generic)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=2904291126d5f7cf008905d27511b69ba8550243

commit 2904291126d5f7cf008905d27511b69ba8550243
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 14:53:13 2017 -0300

    sparc: refactor sparc64 __mpn_sub_n selector to C
    
    	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
    	Add sub_n-generic.
    	* sysdeps/sparc/sparc64/multiarch/sub_n-generic.S: New file.
    	* sysdeps/sparc/sparc64/multiarch/sub_n.c: Likewise.
    	* sysdeps/sparc/sparc64/multiarch/sub_n.S: Remove file.

diff --git a/ChangeLog b/ChangeLog
index c00fea6..3c8dc05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
 	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
+	Add sub_n-generic.
+	* sysdeps/sparc/sparc64/multiarch/sub_n-generic.S: New file.
+	* sysdeps/sparc/sparc64/multiarch/sub_n.c: Likewise.
+	* sysdeps/sparc/sparc64/multiarch/sub_n.S: Remove file.
+
+	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
 	Add mul_1-generic.
 	* sysdeps/sparc/sparc64/multiarch/mul_1-generic.S: New file.
 	* sysdeps/sparc/sparc64/multiarch/mul_1.c: Likewise.
diff --git a/sysdeps/sparc/sparc64/multiarch/Makefile b/sysdeps/sparc/sparc64/multiarch/Makefile
index 2338213..10fe54f 100644
--- a/sysdeps/sparc/sparc64/multiarch/Makefile
+++ b/sysdeps/sparc/sparc64/multiarch/Makefile
@@ -14,7 +14,7 @@ endif
 
 ifeq ($(subdir),stdlib)
 sysdep_routines += mul_1-vis3 mul_1-generic addmul_1-vis3 submul_1-vis3 \
-		   add_n-vis3 sub_n-vis3 
+		   add_n-vis3 sub_n-vis3 sub_n-generic
 endif
 
 ifeq ($(subdir),math)
diff --git a/sysdeps/sparc/sparc64/multiarch/sub_n-generic.S b/sysdeps/sparc/sparc64/multiarch/sub_n-generic.S
new file mode 100644
index 0000000..7cece93
--- /dev/null
+++ b/sysdeps/sparc/sparc64/multiarch/sub_n-generic.S
@@ -0,0 +1,2 @@
+#define __mpn_sub_n __mpn_sub_n_generic
+#include <sysdeps/sparc/sparc64/sub_n.S>
diff --git a/sysdeps/sparc/sparc64/multiarch/sub_n.S b/sysdeps/sparc/sparc64/multiarch/sub_n.S
deleted file mode 100644
index d20a286..0000000
--- a/sysdeps/sparc/sparc64/multiarch/sub_n.S
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Multiple versions of sub_n
-
-   Copyright (C) 2013-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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-
-ENTRY(__mpn_sub_n)
-	.type	__mpn_sub_n, @gnu_indirect_function
-# ifdef SHARED
-	SETUP_PIC_REG_LEAF(o3, o5)
-# endif
-	set	HWCAP_SPARC_VIS3, %o1
-	andcc	%o0, %o1, %g0
-	be	1f
-	 nop
-# ifdef SHARED
-	sethi	%gdop_hix22(__mpn_sub_n_vis3), %o1
-	xor	%o1, %gdop_lox10(__mpn_sub_n_vis3), %o1
-# else
-	set	__mpn_sub_n_vis3, %o1
-# endif
-	ba	10f
-	 nop
-1:
-# ifdef SHARED
-	sethi	%gdop_hix22(__mpn_sub_n_generic), %o1
-	xor	%o1, %gdop_lox10(__mpn_sub_n_generic), %o1
-# else
-	set	__mpn_sub_n_generic, %o1
-# endif
-10:
-# ifdef SHARED
-	add	%o3, %o1, %o1
-# endif
-	retl
-	 mov	%o1, %o0
-END(__mpn_sub_n)
-
-#define __mpn_sub_n __mpn_sub_n_generic
-#include "../sub_n.S"
diff --git a/sysdeps/sparc/sparc64/multiarch/sub_n.c b/sysdeps/sparc/sparc64/multiarch/sub_n.c
new file mode 100644
index 0000000..838d901
--- /dev/null
+++ b/sysdeps/sparc/sparc64/multiarch/sub_n.c
@@ -0,0 +1,28 @@
+/* __mpn_sub_n ifunc resolver, Linux/sparc64 version. 
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <gmp.h>
+#include <sparc-ifunc.h>
+
+extern __typeof (mpn_sub_n) __mpn_sub_n_vis3 attribute_hidden;
+extern __typeof (mpn_sub_n) __mpn_sub_n_generic attribute_hidden;
+
+sparc_libm_ifunc (__mpn_sub_n,
+		  hwcap & HWCAP_SPARC_VIS3
+		  ? __mpn_sub_n_vis3
+		  : __mpn_sub_n_generic)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c71692869e4f2734298b47c68850e111a6c551d3

commit c71692869e4f2734298b47c68850e111a6c551d3
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 14:52:51 2017 -0300

    sparc: refactor sparc64 __mpn_mul_1 selector to C
    
    	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
    	Add mul_1-generic.
    	* sysdeps/sparc/sparc64/multiarch/mul_1-generic.S: New file.
    	* sysdeps/sparc/sparc64/multiarch/mul_1.c: Likewise.
    	* sysdeps/sparc/sparc64/multiarch/mul_1.S: Remove file.

diff --git a/ChangeLog b/ChangeLog
index 99ccae5..c00fea6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
+	Add mul_1-generic.
+	* sysdeps/sparc/sparc64/multiarch/mul_1-generic.S: New file.
+	* sysdeps/sparc/sparc64/multiarch/mul_1.c: Likewise.
+	* sysdeps/sparc/sparc64/multiarch/mul_1.S: Remove file.
+
 	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile
 	(libm-sysdep_routines): Add s_rintf-generic and s_rint-generic
 	objects.
diff --git a/sysdeps/sparc/sparc64/multiarch/Makefile b/sysdeps/sparc/sparc64/multiarch/Makefile
index 6e90cba..2338213 100644
--- a/sysdeps/sparc/sparc64/multiarch/Makefile
+++ b/sysdeps/sparc/sparc64/multiarch/Makefile
@@ -13,7 +13,8 @@ sysdep_routines += memcpy-ultra3 memcpy-niagara1 memcpy-niagara2 \
 endif
 
 ifeq ($(subdir),stdlib)
-sysdep_routines += mul_1-vis3 addmul_1-vis3 submul_1-vis3 add_n-vis3 sub_n-vis3
+sysdep_routines += mul_1-vis3 mul_1-generic addmul_1-vis3 submul_1-vis3 \
+		   add_n-vis3 sub_n-vis3 
 endif
 
 ifeq ($(subdir),math)
diff --git a/sysdeps/sparc/sparc64/multiarch/mul_1-generic.S b/sysdeps/sparc/sparc64/multiarch/mul_1-generic.S
new file mode 100644
index 0000000..f1b7e60
--- /dev/null
+++ b/sysdeps/sparc/sparc64/multiarch/mul_1-generic.S
@@ -0,0 +1,2 @@
+#define __mpn_mul_1 __mpn_mul_1_generic
+#include <sysdeps/sparc/sparc64/mul_1.S>
diff --git a/sysdeps/sparc/sparc64/multiarch/mul_1.S b/sysdeps/sparc/sparc64/multiarch/mul_1.S
deleted file mode 100644
index 75fca93..0000000
--- a/sysdeps/sparc/sparc64/multiarch/mul_1.S
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Multiple versions of mul_1
-
-   Copyright (C) 2013-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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-
-ENTRY(__mpn_mul_1)
-	.type	__mpn_mul_1, @gnu_indirect_function
-# ifdef SHARED
-	SETUP_PIC_REG_LEAF(o3, o5)
-# endif
-	set	HWCAP_SPARC_VIS3, %o1
-	andcc	%o0, %o1, %g0
-	be	1f
-	 nop
-# ifdef SHARED
-	sethi	%gdop_hix22(__mpn_mul_1_vis3), %o1
-	xor	%o1, %gdop_lox10(__mpn_mul_1_vis3), %o1
-# else
-	set	__mpn_mul_1_vis3, %o1
-# endif
-	ba	10f
-	 nop
-1:
-# ifdef SHARED
-	sethi	%gdop_hix22(__mpn_mul_1_generic), %o1
-	xor	%o1, %gdop_lox10(__mpn_mul_1_generic), %o1
-# else
-	set	__mpn_mul_1_generic, %o1
-# endif
-10:
-# ifdef SHARED
-	add	%o3, %o1, %o1
-# endif
-	retl
-	 mov	%o1, %o0
-END(__mpn_mul_1)
-
-#define __mpn_mul_1 __mpn_mul_1_generic
-#include "../mul_1.S"
diff --git a/sysdeps/sparc/sparc64/multiarch/mul_1.c b/sysdeps/sparc/sparc64/multiarch/mul_1.c
new file mode 100644
index 0000000..98f0ccc
--- /dev/null
+++ b/sysdeps/sparc/sparc64/multiarch/mul_1.c
@@ -0,0 +1,28 @@
+/* __mpn_mul_1 ifunc resolver, Linux/sparc64 version. 
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <gmp.h>
+#include <sparc-ifunc.h>
+
+extern __typeof (mpn_mul_1) __mpn_mul_1_vis3 attribute_hidden;
+extern __typeof (mpn_mul_1) __mpn_mul_1_generic attribute_hidden;
+
+sparc_libm_ifunc (__mpn_mul_1,
+		  hwcap & HWCAP_SPARC_VIS3
+		  ? __mpn_mul_1_vis3
+		  : __mpn_mul_1_generic)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1ff16934a8138fd57c2f10b19fb0868213c129af

commit 1ff16934a8138fd57c2f10b19fb0868213c129af
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 13:42:07 2017 -0300

    sparc: refactor sparc64 rint{f} selector to C
    
    	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile
    	(libm-sysdep_routines): Add s_rintf-generic and s_rint-generic
    	objects.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_rint-generic.S: New file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_rint.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_rintf-generic.S: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_rintf.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_rint.S: Remove file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_rintf.S: Likewise.

diff --git a/ChangeLog b/ChangeLog
index 94d0b68..99ccae5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,16 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
 	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile
+	(libm-sysdep_routines): Add s_rintf-generic and s_rint-generic
+	objects.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_rint-generic.S: New file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_rint.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_rintf-generic.S: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_rintf.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_rint.S: Remove file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_rintf.S: Likewise.
+
+	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile
 	(libm-sysdep_routines): Add s_lrint-generic and s_lrintf-generic
 	objects.
 	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint-generic.S: New file.
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
index d0a87d1..3321e1d 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
@@ -11,6 +11,7 @@ sysdep_calls := s_signbitf-vis3 s_signbit-vis3 s_signbitf-generic \
 sysdep_routines += $(sysdep_calls)
 libm-sysdep_routines += s_lrintf-vis3 s_lrint-vis3 s_lrintf-generic \
 			s_lrint-generic s_rintf-vis3 s_rint-vis3 \
+			s_rintf-generic s_rint-generic \
 			s_fmaf-vis3 s_fma-vis3 s_fmaf-generic s_fma-generic \
 			s_nearbyint-vis3 s_nearbyintf-vis3 \
 			s_nearbyint-generic s_nearbyintf-generic \
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_rint-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_rint-generic.S
new file mode 100644
index 0000000..d927434
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_rint-generic.S
@@ -0,0 +1,4 @@
+#define __rint __rint_generic
+#undef weak_alias
+#define weak_alias(a, b)
+#include <sysdeps/sparc/sparc64/fpu/s_rint.S>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_rint.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_rint.S
deleted file mode 100644
index cc980eb..0000000
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_rint.S
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(rint)
-
-weak_alias (__rint, rint)
-
-# undef weak_alias
-# define weak_alias(a, b)
-
-#define __rint __rint_generic
-
-#include "../s_rint.S"
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_rint.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_rint.c
new file mode 100644
index 0000000..ca566c2
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_rint.c
@@ -0,0 +1,29 @@
+/* rint ifunc resolver, Linux/sparc64 version. 
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+#include <sparc-ifunc.h>
+
+extern __typeof (rint) __rint_vis3 attribute_hidden;
+extern __typeof (rint) __rint_generic attribute_hidden;
+
+sparc_libm_ifunc (__rint,
+		  hwcap & HWCAP_SPARC_VIS3
+		  ? __rint_vis3
+		  : __rint_generic);
+weak_alias (__rint, rint)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_rintf-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_rintf-generic.S
new file mode 100644
index 0000000..30da5f0
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_rintf-generic.S
@@ -0,0 +1,4 @@
+#define __rintf __rintf_generic
+#undef weak_alias
+#define weak_alias(a, b)
+#include <sysdeps/sparc/sparc64/fpu/s_rintf.S>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_rintf.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_rintf.S
deleted file mode 100644
index 38fd936..0000000
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_rintf.S
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(rintf)
-
-weak_alias (__rintf, rintf)
-
-# undef weak_alias
-# define weak_alias(a, b)
-
-#define __rintf __rintf_generic
-
-#include "../s_rintf.S"
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_rintf.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_rintf.c
new file mode 100644
index 0000000..67f166c
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_rintf.c
@@ -0,0 +1,29 @@
+/* rintf ifunc resolver, Linux/sparc64 version. 
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+#include <sparc-ifunc.h>
+
+extern __typeof (rintf) __rintf_vis3 attribute_hidden;
+extern __typeof (rintf) __rintf_generic attribute_hidden;
+
+sparc_libm_ifunc (__rintf,
+		  hwcap & HWCAP_SPARC_VIS3
+		  ? __rintf_vis3
+		  : __rintf_generic);
+weak_alias (__rintf, rintf)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8c39c6f33614633e636fec9c67e932635ae2bd9c

commit 8c39c6f33614633e636fec9c67e932635ae2bd9c
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 13:20:00 2017 -0300

    sparc: refactor sparc64 lrint{f} selector to C
    
    	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile
    	(libm-sysdep_routines): Add s_lrint-generic and s_lrint-generic
    	objects.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint-generic.S: New file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf-generic.S: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.S: Remove file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.S: Likewise.

diff --git a/ChangeLog b/ChangeLog
index 3bc3dc2..94d0b68 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,16 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
 	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile
+	(libm-sysdep_routines): Add s_lrint-generic and s_lrintf-generic
+	objects.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint-generic.S: New file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf-generic.S: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.S: Remove file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.S: Likewise.
+
+	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile
 	(libm-sysdep_routines): Add s_nearbyint-generic and
 	s_nearbyintf-generic objects.
 	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint-generic.S: New file.
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
index 6062af0..d0a87d1 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
@@ -9,7 +9,8 @@ sysdep_calls := s_signbitf-vis3 s_signbit-vis3 s_signbitf-generic \
 		s_isnanf-vis3 s_isnan-vis3 s_isnanf-generic s_isnan-generic
 
 sysdep_routines += $(sysdep_calls)
-libm-sysdep_routines += s_lrintf-vis3 s_lrint-vis3 s_rintf-vis3 s_rint-vis3 \
+libm-sysdep_routines += s_lrintf-vis3 s_lrint-vis3 s_lrintf-generic \
+			s_lrint-generic s_rintf-vis3 s_rint-vis3 \
 			s_fmaf-vis3 s_fma-vis3 s_fmaf-generic s_fma-generic \
 			s_nearbyint-vis3 s_nearbyintf-vis3 \
 			s_nearbyint-generic s_nearbyintf-generic \
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_lrint-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_lrint-generic.S
new file mode 100644
index 0000000..e6ab999
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_lrint-generic.S
@@ -0,0 +1,6 @@
+#define __lrint __lrint_generic
+#undef weak_alias
+#define weak_alias(a,b)
+#undef strong_alias
+#define strong_alias(a,b)
+#include <sysdeps/sparc/sparc64/fpu/s_lrint.S>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.S
deleted file mode 100644
index 94af8f0..0000000
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.S
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(lrint)
-
-weak_alias (__lrint, lrint)
-
-strong_alias (__lrint, __llrint)
-weak_alias (__llrint, llrint)
-
-# undef weak_alias
-# define weak_alias(a, b)
-# undef strong_alias
-# define strong_alias(a, b)
-
-#define __lrint __lrint_generic
-
-#include "../s_lrint.S"
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.c
new file mode 100644
index 0000000..8c979f6
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.c
@@ -0,0 +1,39 @@
+/* lrint/llrint ifunc resolver, Linux/sparc64 version. 
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#define lrint __redirect_lrint
+#define llrint __redirect_llrint
+#define __lrint __redirect___lrint
+#define __llrint __redirect___llrint
+#include <math.h>
+#undef lrint
+#undef llrint
+#undef __lrint
+#undef __llrint
+#include <sparc-ifunc.h>
+
+extern __typeof (__redirect_lrint) __lrint_vis3 attribute_hidden;
+extern __typeof (__redirect_lrint) __lrint_generic attribute_hidden;
+
+sparc_libm_ifunc_redirected (__redirect_lrint, __lrint, 
+			     hwcap & HWCAP_SPARC_VIS3
+			     ? __lrint_vis3
+			     : __lrint_generic);
+weak_alias (__lrint, lrint)
+strong_alias (__lrint, __llrint)
+weak_alias (__llrint, llrint)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf-generic.S
new file mode 100644
index 0000000..4cfbf4a
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf-generic.S
@@ -0,0 +1,6 @@
+#define __lrintf __lrintf_generic
+#undef weak_alias
+#define weak_alias(a,b)
+#undef strong_alias
+#define strong_alias(a,b)
+#include <sysdeps/sparc/sparc64/fpu/s_lrintf.S>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.S
deleted file mode 100644
index e6ea406..0000000
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.S
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(lrintf)
-
-weak_alias (__lrintf, lrintf)
-
-strong_alias (__lrintf, __llrintf)
-weak_alias (__llrintf, llrintf)
-
-# undef weak_alias
-# define weak_alias(a, b)
-# undef strong_alias
-# define strong_alias(a, b)
-
-#define __lrintf __lrintf_generic
-
-#include "../s_lrintf.S"
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.c
new file mode 100644
index 0000000..3d05991
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.c
@@ -0,0 +1,39 @@
+/* lrintf/llrintf ifunc resolver, Linux/sparc64 version. 
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#define lrintf __redirect_lrintf
+#define llrintf __redirect_llrintf
+#define __lrintf __redirect_lrintf
+#define __llrintf __redirect_llrintf
+#include <math.h>
+#undef lrintf
+#undef llrintf
+#undef __lrintf
+#undef __llrintf
+#include <sparc-ifunc.h>
+
+extern __typeof (__redirect_lrintf) __lrintf_vis3 attribute_hidden;
+extern __typeof (__redirect_lrintf) __lrintf_generic attribute_hidden;
+
+sparc_libm_ifunc_redirected (__redirect_lrintf, __lrintf, 
+			     hwcap & HWCAP_SPARC_VIS3
+			     ? __lrintf_vis3
+			     : __lrintf_generic);
+weak_alias (__lrintf, lrintf)
+strong_alias (__lrintf, __llrintf)
+weak_alias (__llrintf, llrintf)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=2b292bf1027afe800cff26141bbe9faebbcba6fb

commit 2b292bf1027afe800cff26141bbe9faebbcba6fb
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 12:00:28 2017 -0300

    sparc: refactor sparc64 nearbyint{f} selector to C
    
    	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile
    	(libm-sysdep_routines): Add s_nearbyint-generic and
    	s_nearbyintf-generic objects.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint-generic.S: New file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf-generic.S: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.S: Remove file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.S: Likewise.

diff --git a/ChangeLog b/ChangeLog
index 5313e0b..3bc3dc2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile
+	(libm-sysdep_routines): Add s_nearbyint-generic and
+	s_nearbyintf-generic objects.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint-generic.S: New file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf-generic.S: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.S: Remove file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.S: Likewise.
+
 	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdeps_calls):
 	Add s_finitef-generic and s_finite-generic objects.
 	* sysdeps/sparc/sparc64/fpu/multiarch/s_finite-generic.S: New file.
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
index d19a446..6062af0 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
@@ -12,6 +12,7 @@ sysdep_routines += $(sysdep_calls)
 libm-sysdep_routines += s_lrintf-vis3 s_lrint-vis3 s_rintf-vis3 s_rint-vis3 \
 			s_fmaf-vis3 s_fma-vis3 s_fmaf-generic s_fma-generic \
 			s_nearbyint-vis3 s_nearbyintf-vis3 \
+			s_nearbyint-generic s_nearbyintf-generic \
 			s_ceilf-vis3 s_ceil-vis3 s_ceilf-generic \
 			s_ceil-generic s_floorf-vis3 s_floor-vis3 \
 			s_floorf-generic s_floor-generic s_truncf-vis3 \
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint-generic.S
new file mode 100644
index 0000000..efe2383
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint-generic.S
@@ -0,0 +1,4 @@
+#define __nearbyint __nearbyint_generic
+#undef weak_alias
+#define weak_alias(a,b)
+#include <sysdeps/sparc/sparc64/fpu/s_nearbyint.S>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.S
deleted file mode 100644
index bb75ab3..0000000
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.S
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(nearbyint)
-
-weak_alias (__nearbyint, nearbyint)
-
-# undef weak_alias
-# define weak_alias(a, b)
-
-#define __nearbyint __nearbyint_generic
-
-#include "../s_nearbyint.S"
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.c
new file mode 100644
index 0000000..3ccb3be
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.c
@@ -0,0 +1,29 @@
+/* nearbyint ifunc resolver, Linux/sparc64 version. 
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+#include <sparc-ifunc.h>
+
+extern __typeof (nearbyint) __nearbyint_vis3 attribute_hidden;
+extern __typeof (nearbyint) __nearbyint_generic attribute_hidden;
+
+sparc_libm_ifunc (__nearbyint,
+		  hwcap & HWCAP_SPARC_VIS3
+		  ? __nearbyint_vis3
+		  : __nearbyint_generic);
+weak_alias (__nearbyint, nearbyint)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf-generic.S
new file mode 100644
index 0000000..a2e38e9
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf-generic.S
@@ -0,0 +1,4 @@
+#define __nearbyintf __nearbyintf_generic
+#undef weak_alias
+#define weak_alias(a,b)
+#include <sysdeps/sparc/sparc64/fpu/s_nearbyintf.S>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.S
deleted file mode 100644
index 95100c1..0000000
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.S
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(nearbyintf)
-
-weak_alias (__nearbyintf, nearbyintf)
-
-# undef weak_alias
-# define weak_alias(a, b)
-
-#define __nearbyintf __nearbyintf_generic
-
-#include "../s_nearbyintf.S"
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.c
new file mode 100644
index 0000000..23e3c13
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.c
@@ -0,0 +1,29 @@
+/* nearbyintf ifunc resolver, Linux/sparc64 version. 
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+#include <sparc-ifunc.h>
+
+extern __typeof (nearbyintf) __nearbyintf_vis3 attribute_hidden;
+extern __typeof (nearbyintf) __nearbyintf_generic attribute_hidden;
+
+sparc_libm_ifunc (__nearbyintf,
+		  hwcap & HWCAP_SPARC_VIS3
+		  ? __nearbyintf_vis3
+		  : __nearbyintf_generic);
+weak_alias (__nearbyintf, nearbyintf)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=964280db540fa5b9ca1e843c069a13f9439281c8

commit 964280db540fa5b9ca1e843c069a13f9439281c8
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 11:48:57 2017 -0300

    sparc: refactor sparc64 finite{f} selector to C
    
    	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdeps_calls):
    	Add s_finitef-generic and s_finite-generic objects.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_finite-generic.S: New file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_finite.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_finitef-generic.S: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_finitef.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_finite.S: Remove file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_finitef.S: Remove file.

diff --git a/ChangeLog b/ChangeLog
index b787182..5313e0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,15 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
 	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdeps_calls):
+	Add s_finitef-generic and s_finite-generic objects.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_finite-generic.S: New file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_finite.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_finitef-generic.S: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_finitef.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_finite.S: Remove file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_finitef.S: Remove file.
+
+	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdeps_calls):
 	Add s_isinff-generic and s_isinf-generic objects.
 	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinf-generic.S: New file.
 	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.c: Likewise.
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
index f0c8fa3..d19a446 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
@@ -4,6 +4,7 @@ ifeq ($(subdir),math)
 # prefixed with  m_.
 sysdep_calls := s_signbitf-vis3 s_signbit-vis3 s_signbitf-generic \
 		s_signbit-generic s_finitef-vis3 s_finite-vis3 \
+		s_finitef-generic s_finite-generic \
 		s_isinff-vis3 s_isinf-vis3 s_isinff-generic s_isinf-generic \
 		s_isnanf-vis3 s_isnan-vis3 s_isnanf-generic s_isnan-generic
 
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_finite-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_finite-generic.S
new file mode 100644
index 0000000..dfbf32f
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_finite-generic.S
@@ -0,0 +1,6 @@
+#define __finite __finite_generic
+#undef hidden_def
+#define hidden_def(a)
+#undef weak_alias
+#define weak_alias(a,b)
+#include <sysdeps/sparc/sparc64/fpu/s_finite.S>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_finite.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_finite.S
deleted file mode 100644
index 78406a6..0000000
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_finite.S
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(finite)
-
-hidden_def (__finite)
-weak_alias (__finite, finite)
-
-# undef weak_alias
-# define weak_alias(a, b)
-# undef hidden_def
-# define hidden_def(a)
-
-#define __finite __finite_generic
-
-#include "../s_finite.S"
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_finite.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_finite.c
new file mode 100644
index 0000000..22e46c4
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_finite.c
@@ -0,0 +1,37 @@
+/* finite ifunc resolver, Linux/sparc64 version.
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#define __finite __redirect___finite
+#define __finitef __redirect___finitef
+#define __finitel __redirect___finitel
+#include <math.h>
+#undef __finite
+#undef __finitef
+#undef __finitel
+#include <sparc-ifunc.h>
+
+extern __typeof (finite) __finite_vis3 attribute_hidden;
+extern __typeof (finite) __finite_generic attribute_hidden;
+
+sparc_libm_ifunc_redirected (__redirect___finite, __finite,
+			     hwcap & HWCAP_SPARC_VIS3
+			     ? __finite_vis3
+			     : __finite_generic);
+
+sparc_ifunc_redirected_hidden_def (__redirect___finite, __finite)
+weak_alias (__finite, finite)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_finitef-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_finitef-generic.S
new file mode 100644
index 0000000..3888076
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_finitef-generic.S
@@ -0,0 +1,6 @@
+#define __finitef __finitef_generic
+#undef hidden_def
+#define hidden_def(a)
+#undef weak_alias
+#define weak_alias(a,b)
+#include <sysdeps/sparc/sparc64/fpu/s_finitef.S>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_finitef.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_finitef.S
deleted file mode 100644
index cafd41f..0000000
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_finitef.S
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(finitef)
-
-hidden_def (__finitef)
-weak_alias (__finitef, finitef)
-
-# undef weak_alias
-# define weak_alias(a, b)
-# undef hidden_def
-# define hidden_def(a)
-
-#define __finitef __finitef_generic
-
-#include "../s_finitef.S"
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_finitef.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_finitef.c
new file mode 100644
index 0000000..273fa08
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_finitef.c
@@ -0,0 +1,33 @@
+/* finitef ifunc resolver, Linux/sparc64 version.
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#define __finitef __redirect___finitef
+#include <math.h>
+#undef __finitef
+#include <sparc-ifunc.h>
+
+extern __typeof (finitef) __finitef_vis3 attribute_hidden;
+extern __typeof (finitef) __finitef_generic attribute_hidden;
+
+sparc_libm_ifunc_redirected (__redirect___finitef, __finitef,
+		    	     hwcap & HWCAP_SPARC_VIS3
+			     ? __finitef_vis3
+			     : __finitef_generic);
+
+sparc_ifunc_redirected_hidden_def (__redirect___finitef, __finitef)
+weak_alias (__finitef, finitef)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0bbb54ce743d2bf0dd9d96a23344620a3e3d6fbc

commit 0bbb54ce743d2bf0dd9d96a23344620a3e3d6fbc
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 11:39:43 2017 -0300

    sparc: refactor sparc64 isinf{f} selector to C
    
    	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdeps_calls):
    	Add isinff-generic and s_isinf-generic objects.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinf-generic.S: New file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinff-generic.S: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.S: Remove file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.S: Likewise.

diff --git a/ChangeLog b/ChangeLog
index d41c74f..b787182 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,15 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
 	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdeps_calls):
+	Add s_isinff-generic and s_isinf-generic objects.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinf-generic.S: New file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinff-generic.S: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.S: Remove file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.S: Likewise.
+
+	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdeps_calls):
 	Add s_isnanf-generic and s_isnan-generic objects.
 	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnan-generic.S: New file.
 	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf-generic.S: Likewise.
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
index a46773b..f0c8fa3 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
@@ -3,8 +3,8 @@ ifeq ($(subdir),math)
 # by printf.  While the libc objects have the prefix s_, the libm ones are
 # prefixed with  m_.
 sysdep_calls := s_signbitf-vis3 s_signbit-vis3 s_signbitf-generic \
-		s_signbit-generic s_finitef-vis3 \
-		s_finite-vis3 s_isinff-vis3 s_isinf-vis3 \
+		s_signbit-generic s_finitef-vis3 s_finite-vis3 \
+		s_isinff-vis3 s_isinf-vis3 s_isinff-generic s_isinf-generic \
 		s_isnanf-vis3 s_isnan-vis3 s_isnanf-generic s_isnan-generic
 
 sysdep_routines += $(sysdep_calls)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf-generic.S
new file mode 100644
index 0000000..ebaf054
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf-generic.S
@@ -0,0 +1,6 @@
+#define __isinf __isinf_generic
+#undef hidden_def
+#define hidden_def(a)
+#undef weak_alias
+#define weak_alias(a,b)
+#include <./sysdeps/sparc/sparc64/fpu/s_isinf.S>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.S
deleted file mode 100644
index ed9b626..0000000
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.S
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(isinf)
-
-hidden_def (__isinf)
-weak_alias (__isinf, isinf)
-
-# undef weak_alias
-# define weak_alias(a, b)
-# undef hidden_def
-# define hidden_def(a)
-
-#define __isinf __isinf_generic
-
-#include "../s_isinf.S"
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.c
new file mode 100644
index 0000000..83342f6
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.c
@@ -0,0 +1,37 @@
+/* isinf ifunc resolver, Linux/sparc64 version. 
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#define __isinf __redirect___isinf
+#define __isinff __redirect___isinff
+#define __isinfl __redirect___isinfl
+#include <math.h>
+#undef __isinf
+#undef __isinff
+#undef __isinfl
+#include <sparc-ifunc.h>
+
+extern __typeof (isinf) __isinf_vis3 attribute_hidden;
+extern __typeof (isinf) __isinf_generic attribute_hidden;
+
+sparc_libm_ifunc_redirected (__redirect___isinf, __isinf,
+			     hwcap & HWCAP_SPARC_VIS3
+			     ? __isinf_vis3
+			     : __isinf_generic)
+
+sparc_ifunc_redirected_hidden_def (__redirect___isinf, __isinf)
+weak_alias (__isinf, isinf)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff-generic.S
new file mode 100644
index 0000000..d37243f
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff-generic.S
@@ -0,0 +1,6 @@
+#define __isinff __isinff_generic
+#undef hidden_def
+#define hidden_def(a)
+#undef weak_alias
+#define weak_alias(a,b)
+#include <sysdeps/sparc/sparc64/fpu/s_isinff.S>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.S
deleted file mode 100644
index 0451739..0000000
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.S
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(isinff)
-
-hidden_def (__isinff)
-weak_alias (__isinff, isinff)
-
-# undef weak_alias
-# define weak_alias(a, b)
-# undef hidden_def
-# define hidden_def(a)
-
-#define __isinff __isinff_generic
-
-#include "../s_isinff.S"
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.c
new file mode 100644
index 0000000..c180e8c
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.c
@@ -0,0 +1,33 @@
+/* isinff ifunc resolver, Linux/sparc64 version. 
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#define __isinff __redirect___isinff
+#include <math.h>
+#undef __isinff
+#include <sparc-ifunc.h>
+
+extern __typeof (isinff) __isinff_vis3 attribute_hidden;
+extern __typeof (isinff) __isinff_generic attribute_hidden;
+
+sparc_libm_ifunc_redirected (__redirect___isinff, __isinff,
+			     hwcap & HWCAP_SPARC_VIS3
+			     ? __isinff_vis3
+			     : __isinff_generic);
+
+sparc_ifunc_redirected_hidden_def (__redirect___isinff, __isinff)
+weak_alias (__isinff, isinff)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ee1b04fe1bad7f9395674cceceef23a41f43f859

commit ee1b04fe1bad7f9395674cceceef23a41f43f859
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 11:28:55 2017 -0300

    sparc: refactor sparc64 isnan{f} selector to C
    
    	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdeps_calls):
    	Add s_isnanf-generic and s_isnan-generic objects.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnan-generic.S: New file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf-generic.S: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnan.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnan.S: Remove file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf.S: Likewise.

diff --git a/ChangeLog b/ChangeLog
index fcd3f4b..d41c74f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdeps_calls):
+	Add s_isnanf-generic and s_isnan-generic objects.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnan-generic.S: New file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf-generic.S: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnan.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnan.S: Remove file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf.S: Likewise.
+
 	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdep_calls): New
 	rule.
 	(sysdep_routines): Use sysdep_calls as base.
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
index 702452c..a46773b 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
@@ -5,7 +5,7 @@ ifeq ($(subdir),math)
 sysdep_calls := s_signbitf-vis3 s_signbit-vis3 s_signbitf-generic \
 		s_signbit-generic s_finitef-vis3 \
 		s_finite-vis3 s_isinff-vis3 s_isinf-vis3 \
-		s_isnanf-vis3 s_isnan-vis3
+		s_isnanf-vis3 s_isnan-vis3 s_isnanf-generic s_isnan-generic
 
 sysdep_routines += $(sysdep_calls)
 libm-sysdep_routines += s_lrintf-vis3 s_lrint-vis3 s_rintf-vis3 s_rint-vis3 \
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isnan-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_isnan-generic.S
new file mode 100644
index 0000000..64d4430
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_isnan-generic.S
@@ -0,0 +1,6 @@
+#define __isnan __isnan_generic
+#undef hidden_def
+#define hidden_def(a)
+#undef weak_alias
+#define weak_alias(a,b)
+#include <sysdeps/sparc/sparc64/fpu/s_isnan.S>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isnan.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_isnan.S
deleted file mode 100644
index 40e985a..0000000
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_isnan.S
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(isnan)
-
-hidden_def (__isnan)
-weak_alias (__isnan, isnan)
-
-# undef weak_alias
-# define weak_alias(a, b)
-# undef hidden_def
-# define hidden_def(a)
-
-#define __isnan __isnan_generic
-
-#include "../s_isnan.S"
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isnan.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_isnan.c
new file mode 100644
index 0000000..3b3d700
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_isnan.c
@@ -0,0 +1,37 @@
+/* isnan ifunc resolver, Linux/sparc64 version. 
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#define __isnan __redirect___isnan
+#define __isnanf __redirect___isnanf
+#define __isnanl __redirect___isnanl
+#include <math.h>
+#undef __isnan
+#undef __isnanf
+#undef __isnanl
+#include <sparc-ifunc.h>
+
+extern __typeof (isnan) __isnan_vis3 attribute_hidden;
+extern __typeof (isnan) __isnan_generic attribute_hidden;
+
+sparc_libm_ifunc_redirected (__redirect___isnan, __isnan,
+			     hwcap & HWCAP_SPARC_VIS3
+			     ? __isnan_vis3
+			     : __isnan_generic);
+
+sparc_ifunc_redirected_hidden_def (__redirect___isnan, __isnan)
+weak_alias (__isnan, isnan)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf-generic.S
new file mode 100644
index 0000000..5c82f7d
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf-generic.S
@@ -0,0 +1,6 @@
+#define __isnanf __isnanf_generic
+#undef hidden_def
+#define hidden_def(a)
+#undef weak_alias
+#define weak_alias(a,b)
+#include <sysdeps/sparc/sparc64/fpu/s_isnanf.S>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf.S
deleted file mode 100644
index 6b53b69..0000000
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf.S
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(isnanf)
-
-hidden_def (__isnanf)
-weak_alias (__isnanf, isnanf)
-
-# undef weak_alias
-# define weak_alias(a, b)
-# undef hidden_def
-# define hidden_def(a)
-
-#define __isnanf __isnanf_generic
-
-#include "../s_isnanf.S"
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf.c
new file mode 100644
index 0000000..f6a6380
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf.c
@@ -0,0 +1,33 @@
+/* isnanf ifunc resolver, Linux/sparc64 version. 
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#define __isnanf __redirect___isnanf
+#include <math.h>
+#undef __isnanf
+#include <sparc-ifunc.h>
+
+extern __typeof (isnanf) __isnanf_vis3 attribute_hidden;
+extern __typeof (isnanf) __isnanf_generic attribute_hidden;
+
+sparc_libm_ifunc_redirected (__redirect___isnanf, __isnanf,
+			     hwcap & HWCAP_SPARC_VIS3
+			     ? __isnanf_vis3
+			     : __isnanf_generic);
+
+sparc_ifunc_redirected_hidden_def (__redirect___isnanf,__isnanf)
+weak_alias (__isnanf, isnanf)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ae8131118ba568217e7f2247179c07d25d7be0cf

commit ae8131118ba568217e7f2247179c07d25d7be0cf
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 09:57:25 2017 -0300

    sparc: refactor sparc64 signbit{f} selector to C
    
    	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdep_calls): New
    	rule.
    	(sysdep_routines): Use sysdep_calls as base.
    	(libm-sysdep_routines): Add generic rule for symbols shared with
    	libc.  Add s_signbit-generic and s_signbitf-generic objects.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.c: New file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_signbit-generic.S: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf-generic.S: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.S: Remove file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.S: Likewise.

diff --git a/ChangeLog b/ChangeLog
index 1d87dae..fcd3f4b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdep_calls): New
+	rule.
+	(sysdep_routines): Use sysdep_calls as base.
+	(libm-sysdep_routines): Add generic rule for symbols shared with
+	libc.  Add s_signbit-generic and s_signbitf-generic objects.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.c: New file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_signbit-generic.S: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf-generic.S: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.S: Remove file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.S: Likewise.
+
 	* sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.c (__trunc_vis3,
 	__trunc_generic): Use attribute_hidden.
 	* sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.c (__truncf_vis3,
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
index 2ac4496..702452c 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
@@ -1,17 +1,21 @@
 ifeq ($(subdir),math)
-libm-sysdep_routines += m_signbitf-vis3 m_signbit-vis3 m_finitef-vis3 \
-			m_finite-vis3 m_isinff-vis3 m_isinf-vis3 \
-			m_isnanf-vis3 m_isnan-vis3 s_lrintf-vis3 \
-			s_lrint-vis3 s_rintf-vis3 s_rint-vis3 \
+# These functions are built both for libc and libm because they're required
+# by printf.  While the libc objects have the prefix s_, the libm ones are
+# prefixed with  m_.
+sysdep_calls := s_signbitf-vis3 s_signbit-vis3 s_signbitf-generic \
+		s_signbit-generic s_finitef-vis3 \
+		s_finite-vis3 s_isinff-vis3 s_isinf-vis3 \
+		s_isnanf-vis3 s_isnan-vis3
+
+sysdep_routines += $(sysdep_calls)
+libm-sysdep_routines += s_lrintf-vis3 s_lrint-vis3 s_rintf-vis3 s_rint-vis3 \
 			s_fmaf-vis3 s_fma-vis3 s_fmaf-generic s_fma-generic \
 			s_nearbyint-vis3 s_nearbyintf-vis3 \
 			s_ceilf-vis3 s_ceil-vis3 s_ceilf-generic \
 			s_ceil-generic s_floorf-vis3 s_floor-vis3 \
 			s_floorf-generic s_floor-generic s_truncf-vis3 \
-			s_trunc-vis3 s_truncf-generic s_trunc-generic
-sysdep_routines += s_signbitf-vis3 s_signbit-vis3 s_finitef-vis3 \
-		   s_finite-vis3 s_isinff-vis3 s_isinf-vis3 \
-		   s_isnanf-vis3 s_isnan-vis3
+			s_trunc-vis3 s_truncf-generic s_trunc-generic \
+			$(sysdep_calls:s_%=m_%)
 
 CFLAGS-s_ceilf-vis3.c += -Wa,-Av9d -mvis3
 CFLAGS-s_ceil-vis3.c += -Wa,-Av9d -mvis3
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit-generic.S
new file mode 100644
index 0000000..dfa40ac
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit-generic.S
@@ -0,0 +1,6 @@
+#define __signbit __signbit_generic
+#undef strong_alias
+#define strong_alias(a, b)
+#undef hidden_def
+#define hidden_def(a)
+#include <sysdeps/sparc/sparc64/fpu/s_signbit.S>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.S
deleted file mode 100644
index b8ff64a..0000000
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.S
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(signbit)
-
-/* On 64-bit the double version will also always work for
-   long-double-precision since in both cases the word with the
-   sign bit in it is passed always in register %f0.  */
-strong_alias (__signbit, __signbitl)
-hidden_def (__signbitl)
-
-# undef weak_alias
-# define weak_alias(a, b)
-# undef strong_alias
-# define strong_alias(a, b)
-# undef hidden_def
-# define hidden_def(a)
-
-#define __signbit __signbit_generic
-
-#include "../s_signbit.S"
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.c
new file mode 100644
index 0000000..a6970e7
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.c
@@ -0,0 +1,37 @@
+/* signbit ifunc resolver, Linux/sparc64 version. 
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#define __signbit __redirect_signbit
+#include <math.h>
+#undef __signbit
+
+#include <sparc-ifunc.h>
+
+extern __typeof (__redirect_signbit) __signbit_vis3 attribute_hidden;
+extern __typeof (__redirect_signbit) __signbit_generic attribute_hidden;
+
+sparc_libm_ifunc_redirected (__redirect_signbit, __signbit,
+			     hwcap & HWCAP_SPARC_VIS3
+			     ? __signbit_vis3 
+			     : __signbit_generic);
+
+/* On 64-bit the double version will also always work for
+   long-double-precision since in both cases the word with the
+   sign bit in it is passed always in register %f0.  */
+strong_alias (__signbit, __signbitl)
+sparc_ifunc_redirected_hidden_def (__redirect_signbit, __signbitl)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf-generic.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf-generic.S
new file mode 100644
index 0000000..851ff35
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf-generic.S
@@ -0,0 +1,2 @@
+#define __signbitf __signbitf_generic
+#include <sysdeps/sparc/sparc64/fpu/s_signbitf.S>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.S b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.S
deleted file mode 100644
index d57e999..0000000
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.S
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <sparc-ifunc.h>
-
-SPARC_ASM_VIS3_IFUNC(signbitf)
-
-# undef weak_alias
-# define weak_alias(a, b)
-
-#define __signbitf __signbitf_generic
-
-#include "../s_signbitf.S"
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.c
new file mode 100644
index 0000000..bd163e6
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.c
@@ -0,0 +1,28 @@
+/* signbit ifunc resolver, Linux/sparc64 version. 
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+#include <sparc-ifunc.h>
+
+extern int __signbitf_vis3 (float);
+extern int __signbitf_generic (float);
+
+sparc_libm_ifunc(__signbitf,
+		 hwcap & HWCAP_SPARC_VIS3
+		 ? __signbitf_vis3 
+		 : __signbitf_generic);

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=189140ec830f79b471e5e42a6be41a085f2e9e80

commit 189140ec830f79b471e5e42a6be41a085f2e9e80
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 13:33:50 2017 -0300

    sparc: hide internal __trunc{f}_{vis3,generic}
    
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.c (__trunc_vis3,
    	__trunc_generic): Use attribute_hidden.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.c (__truncf_vis3,
    	__truncf_generic): Likewise.

diff --git a/ChangeLog b/ChangeLog
index 68f2c4b..1d87dae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.c (__trunc_vis3,
+	__trunc_generic): Use attribute_hidden.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.c (__truncf_vis3,
+	__truncf_generic): Likewise.
+
 	* sysdeps/sparc/sparc64/fpu/multiarch/s_fma.c (__fma_vis3,
 	__ceil_generic): Use attribute_hidden.
 	* sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf.c (__fmaf_vis3,
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.c
index 42cf69f..9f64d30 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.c
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.c
@@ -16,11 +16,14 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sparc-ifunc.h>
 #include <math.h>
+#include <sparc-ifunc.h>
 
-extern double __trunc_vis3 (double);
-extern double __trunc_generic (double);
+extern __typeof (trunc) __trunc_vis3 attribute_hidden;
+extern __typeof (trunc) __trunc_generic attribute_hidden;
 
-sparc_libm_ifunc(__trunc, hwcap & HWCAP_SPARC_VIS3 ? __trunc_vis3 : __trunc_generic);
+sparc_libm_ifunc (__trunc,
+		  hwcap & HWCAP_SPARC_VIS3
+		  ? __trunc_vis3
+		  : __trunc_generic);
 weak_alias (__trunc, trunc)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.c
index 9d0b369..fc45935 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.c
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.c
@@ -16,11 +16,14 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sparc-ifunc.h>
 #include <math.h>
+#include <sparc-ifunc.h>
 
-extern float __truncf_vis3 (float);
-extern float __truncf_generic (float);
+extern __typeof (truncf) __truncf_vis3 attribute_hidden;
+extern __typeof (truncf) __truncf_generic attribute_hidden;
 
-sparc_libm_ifunc(__truncf, hwcap & HWCAP_SPARC_VIS3 ? __truncf_vis3 : __truncf_generic);
+sparc_libm_ifunc (__truncf,
+		  hwcap & HWCAP_SPARC_VIS3
+		  ? __truncf_vis3
+		  : __truncf_generic);
 weak_alias (__truncf, truncf)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e7609f89e932fcfc561cc737dcc357e8818684ef

commit e7609f89e932fcfc561cc737dcc357e8818684ef
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 13:33:33 2017 -0300

    sparc: hide internal __fma{f}_{vis3,generic}
    
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_fma.c (__ceil_vis3,
    	__ceil_generic): Use attribute_hidden.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf.c (__ceilf_vis3,
    	__ceilf_generic): Likewise.

diff --git a/ChangeLog b/ChangeLog
index 8d10ddc..68f2c4b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_fma.c (__fma_vis3,
+	__ceil_generic): Use attribute_hidden.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf.c (__fmaf_vis3,
+	__ceilf_generic): Likewise.
+
 	* sysdeps/sparc/sparc64/fpu/multiarch/s_floor.c (__floor_vis3,
 	__ceil_generic): Use attribute_hidden.
 	* sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.c (__floorf_vis3,
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_fma.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_fma.c
index 78a50d5..3cd993e 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_fma.c
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_fma.c
@@ -1,8 +1,11 @@
-#include <sparc-ifunc.h>
 #include <math.h>
+#include <sparc-ifunc.h>
 
-extern double __fma_vis3 (double, double, double);
-extern double __fma_generic (double, double, double);
+extern __typeof (fma) __fma_vis3 attribute_hidden;
+extern __typeof (fma) __fma_generic attribute_hidden;
 
-sparc_libm_ifunc(__fma, hwcap & HWCAP_SPARC_FMAF ? __fma_vis3 : __fma_generic);
+sparc_libm_ifunc (__fma,
+		  hwcap & HWCAP_SPARC_FMAF
+		  ? __fma_vis3
+		  : __fma_generic);
 weak_alias (__fma, fma)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf.c
index 5357b47..bdc9ec8 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf.c
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf.c
@@ -1,8 +1,11 @@
-#include <sparc-ifunc.h>
 #include <math.h>
+#include <sparc-ifunc.h>
 
-extern float __fmaf_vis3 (float, float, float);
-extern float __fmaf_generic (float, float, float);
+extern __typeof (fmaf) __fmaf_vis3 attribute_hidden;
+extern __typeof (fmaf) __fmaf_generic attribute_hidden;
 
-sparc_libm_ifunc(__fmaf, hwcap & HWCAP_SPARC_FMAF ? __fmaf_vis3 : __fmaf_generic);
+sparc_libm_ifunc (__fmaf,
+		  hwcap & HWCAP_SPARC_FMAF
+		  ? __fmaf_vis3
+		  : __fmaf_generic);
 weak_alias (__fmaf, fmaf)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=db31bd7b832afd923d2264e7c4b47c4282e27d03

commit db31bd7b832afd923d2264e7c4b47c4282e27d03
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 13:33:03 2017 -0300

    sparc: hide internal __floor{f}_{vis3,generic}
    
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_floor.c (__floor_vis3,
    	__floor_generic): Use attribute_hidden.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.c (__floorf_vis3,
    	__floorf_generic): Likewise.

diff --git a/ChangeLog b/ChangeLog
index 8ad7ba6..8d10ddc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_floor.c (__floor_vis3,
+	__ceil_generic): Use attribute_hidden.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.c (__floorf_vis3,
+	__ceilf_generic): Likewise.
+
 	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.c (__ceil_vis3,
 	__ceil_generic): Use attribute_hidden.
 	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.c (__ceilf_vis3,
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_floor.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_floor.c
index 688eff1..9d71158 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_floor.c
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_floor.c
@@ -19,10 +19,11 @@
 #include <sparc-ifunc.h>
 #include <math.h>
 
-extern double __floor_vis3 (double);
-extern double __floor_generic (double);
+extern __typeof (floor) __floor_vis3 attribute_hidden;
+extern __typeof (floor) __floor_generic attribute_hidden;
 
-sparc_libm_ifunc(__floor, hwcap & HWCAP_SPARC_VIS3 ? __floor_vis3 : __floor_generic);
+sparc_libm_ifunc (__floor,
+		  hwcap & HWCAP_SPARC_VIS3
+		  ? __floor_vis3
+		  : __floor_generic);
 weak_alias (__floor, floor)
-
-#define __floor __floor_generic
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.c
index 5f83cbc..09d0a45 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.c
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.c
@@ -19,8 +19,11 @@
 #include <sparc-ifunc.h>
 #include <math.h>
 
-extern float __floorf_vis3 (float);
-extern float __floorf_generic (float);
+extern __typeof (floorf) __floorf_vis3 attribute_hidden;
+extern __typeof (floorf) __floorf_generic attribute_hidden;
 
-sparc_libm_ifunc(__floorf, hwcap & HWCAP_SPARC_VIS3 ? __floorf_vis3 : __floorf_generic);
+sparc_libm_ifunc (__floorf,
+		  hwcap & HWCAP_SPARC_VIS3
+		  ? __floorf_vis3
+		  : __floorf_generic);
 weak_alias (__floorf, floorf)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e250a65e12e6a723621d9fef0c1abb314a06598f

commit e250a65e12e6a723621d9fef0c1abb314a06598f
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 13:32:45 2017 -0300

    sparc: hide internal __ceil{f}_{vis3,generic}
    
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.c (__ceil_vis3,
    	__ceil_generic): Use attribute_hidden.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.c (__ceilf_vis3,
    	__ceilf_generic): Likewise.

diff --git a/ChangeLog b/ChangeLog
index a919f95..8ad7ba6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.c (__ceil_vis3,
+	__ceil_generic): Use attribute_hidden.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.c (__ceilf_vis3,
+	__ceilf_generic): Likewise.
+
 	* sysdeps/sparc/sparc-ifunc.h (sparc_libc_ifunc): New macro.
 	(sparc_libm_ifunc_redirected): Likewise.
 	(sparc_ifunc_redirected_hidden_def): Likewise.
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.c
index 706be93..2e90848 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.c
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.c
@@ -19,8 +19,8 @@
 #include <sparc-ifunc.h>
 #include <math.h>
 
-extern double __ceil_vis3 (double);
-extern double __ceil_generic (double);
+extern __typeof (ceil) __ceil_vis3 attribute_hidden;
+extern __typeof (ceil) __ceil_generic attribute_hidden;
 
 sparc_libm_ifunc(__ceil, hwcap & HWCAP_SPARC_VIS3 ? __ceil_vis3 : __ceil_generic);
 weak_alias (__ceil, ceil)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.c
index dd80998..81897b5 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.c
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.c
@@ -19,8 +19,11 @@
 #include <sparc-ifunc.h>
 #include <math.h>
 
-extern float __ceilf_vis3 (float);
-extern float __ceilf_generic (float);
+extern __typeof (ceilf) __ceilf_vis3 attribute_hidden;
+extern __typeof (ceilf) __ceilf_generic attribute_hidden;
 
-sparc_libm_ifunc(__ceilf, hwcap & HWCAP_SPARC_VIS3 ? __ceilf_vis3 : __ceilf_generic);
+sparc_libm_ifunc (__ceilf,
+		  hwcap & HWCAP_SPARC_VIS3
+		  ? __ceilf_vis3
+		  : __ceilf_generic);
 weak_alias (__ceilf, ceilf)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=5e53d20ea2e1d49bca2b1588c678003f69989795

commit 5e53d20ea2e1d49bca2b1588c678003f69989795
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 13 09:56:49 2017 -0300

    sparc: Add ifunc helper macros
    
    	* sysdeps/sparc/sparc-ifunc.h (sparc_libc_ifunc): New macro.
    	(sparc_libm_ifunc_redirected): Likewise.
    	(sparc_ifunc_redirected_hidden_def): Likewise.

diff --git a/ChangeLog b/ChangeLog
index 0971cb7..a919f95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/sparc/sparc-ifunc.h (sparc_libc_ifunc): New macro.
+	(sparc_libm_ifunc_redirected): Likewise.
+	(sparc_ifunc_redirected_hidden_def): Likewise.
+
 	* config.h.in (HAVE_AS_VIS3_SUPPORT): Remove check for VIS3 support.
 	* sysdeps/sparc/configure.ac (HAVE_AS_VIS3_SUPPORT): Likewise.
 	* sysdeps//sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c: Likewise.
diff --git a/sysdeps/sparc/sparc-ifunc.h b/sysdeps/sparc/sparc-ifunc.h
index 0364fde..4ae9742 100644
--- a/sysdeps/sparc/sparc-ifunc.h
+++ b/sysdeps/sparc/sparc-ifunc.h
@@ -152,9 +152,20 @@ END (__##name)
 # define sparc_libc_ifunc_redirected(redirected_name, name, expr)	\
   __ifunc (redirected_name, name, expr(hwcap), int hwcap, INIT_ARCH)
 
+# define sparc_libc_ifunc(name, expr) sparc_libm_ifunc (name, expr)
+
 # 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)
+# define sparc_libm_ifunc_redirected(redirected_name, name, expr)	\
+  __ifunc (redirected_name, name, expr, int hwcap, libm_ifunc_init)
+
+# 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__ */

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0b5e38c6c7127007d378ba605f4a68a6f73f55b6

commit 0b5e38c6c7127007d378ba605f4a68a6f73f55b6
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Oct 12 19:43:50 2017 -0300

    sparc: Assume VIS3 support
    
    	* config.h.in (HAVE_AS_VIS3_SUPPORT): Remove check for VIS3 support.
    	* sysdeps/sparc/configure.ac (HAVE_AS_VIS3_SUPPORT): Likewise.
    	* sysdeps//sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c: Likewise.
    	* sysdeps//sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.c: Likewise.
    	* sysdeps//sparc/sparc32/sparcv9/fpu/multiarch/s_fma.c: Likewise.
    	* sysdeps//sparc/sparc32/sparcv9/fpu/multiarch/s_fmaf.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_floor.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_fma.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.c: Likewise.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.c: Likewise.
    	* sysdeps/sparc/sparc-ifunc.h [!HAVE_AS_VIS3_SUPPORT]
    	(SPARC_ASM_VIS3_IFUNC, SPARC_ASM_VIS3_VIS2_IFUNC): Remove macros.
    	* sysdeps/sparc/sparc32/sparcv9/Makefile [$(have-as-vis3) != yes]
    	(ASFLAGS.o, ASFLAGS-.os, ASFLAGS-.op, ASFLAGS-.oS): Remove rules.
    	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
    	($(have-as-vis3) == yes): Remove conditional.
    	* sysdeps/sparc/sparc64/Makefile (($(have-as-vis3) == yes)):
    	Likewise.
    	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-generic.c: New
    	file.
    	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-generic.c: New
    	file.
    	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fma-generic.c: New
    	file.
    	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaf-generic.c: New
    	file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-generic.c: New file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-generic.c: New file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_floor-generic.c: New file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-generic.c: New file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_fma-generic.c: New file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf-generic.c: New file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_trunc-generic.c: New file.
    	* sysdeps/sparc/sparc64/fpu/multiarch/s_truncf-generic.c: New file.

diff --git a/ChangeLog b/ChangeLog
index 4b7b218..0971cb7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,44 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* config.h.in (HAVE_AS_VIS3_SUPPORT): Remove check for VIS3 support.
+	* sysdeps/sparc/configure.ac (HAVE_AS_VIS3_SUPPORT): Likewise.
+	* sysdeps//sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c: Likewise.
+	* sysdeps//sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.c: Likewise.
+	* sysdeps//sparc/sparc32/sparcv9/fpu/multiarch/s_fma.c: Likewise.
+	* sysdeps//sparc/sparc32/sparcv9/fpu/multiarch/s_fmaf.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_floor.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_fma.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.c: Likewise.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.c: Likewise.
+	* sysdeps/sparc/sparc-ifunc.h [!HAVE_AS_VIS3_SUPPORT]
+	(SPARC_ASM_VIS3_IFUNC, SPARC_ASM_VIS3_VIS2_IFUNC): Remove macros.
+	* sysdeps/sparc/sparc32/sparcv9/Makefile [$(have-as-vis3) != yes]
+	(ASFLAGS.o, ASFLAGS-.os, ASFLAGS-.op, ASFLAGS-.oS): Remove rules.
+	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
+	($(have-as-vis3) == yes): Remove conditional.
+	* sysdeps/sparc/sparc64/Makefile (($(have-as-vis3) == yes)):
+	Likewise.
+	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-generic.c: New
+	file.
+	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-generic.c: New
+	file.
+	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fma-generic.c: New
+	file.
+	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaf-generic.c: New
+	file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-generic.c: New file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-generic.c: New file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_floor-generic.c: New file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-generic.c: New file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_fma-generic.c: New file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf-generic.c: New file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_trunc-generic.c: New file.
+	* sysdeps/sparc/sparc64/fpu/multiarch/s_truncf-generic.c: New file.
+
 	* sysdeps/arm/armv7/multiarch/Makefile [$(subdir) = string]
 	(sysdeps_routines): Add memchr_noneon.
 	* sysdeps/arm/armv7/multiarch/ifunc-memchr.h: New file.
diff --git a/config.h.in b/config.h.in
index c140ff3..8d76dad 100644
--- a/config.h.in
+++ b/config.h.in
@@ -50,9 +50,6 @@
 /* Defined on SPARC if GCC emits GOTDATA relocations.  */
 #undef  HAVE_GCC_GOTDATA
 
-/* Define on SPARC if AS supports VIS3 instructions.  */
-#undef  HAVE_AS_VIS3_SUPPORT
-
 /* Define if the linker supports the -z combreloc option.  */
 #undef	HAVE_Z_COMBRELOC
 
diff --git a/sysdeps/sparc/configure b/sysdeps/sparc/configure
index 90a86f6..bc6ac14 100644
--- a/sysdeps/sparc/configure
+++ b/sysdeps/sparc/configure
@@ -1,48 +1,6 @@
 # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
  # Local configure fragment for sysdeps/sparc.
 
-# Check for support of VIS3 et al. instructions in the assembler.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sparc assembler VIS3 support" >&5
-$as_echo_n "checking for sparc assembler VIS3 support... " >&6; }
-if ${libc_cv_sparc_as_vis3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat > conftest.S <<\EOF
-	.text
-foo:	fmadds		%f1, %f2, %f3, %f5
-	fmaddd		%f2, %f4, %f8, %f10
-	fhadds		%f2, %f3, %f5
-	fhaddd		%f4, %f8, %f10
-	pdistn		%f2, %f4, %g1
-	movdtox		%f10, %o0
-	movstouw	%f9, %o1
-	movstosw	%f7, %o2
-	movxtod		%o3, %f18
-	movwtos		%o4, %f15
-	flcmps		%fcc0, %f3, %f5
-	flcmpd		%fcc1, %f4, %f6
-EOF
-if { ac_try='${CC-cc} -c $CFLAGS -Wa,-Av9d conftest.S'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then
-  libc_cv_sparc_as_vis3=yes
-else
-  libc_cv_sparc_as_vis3=no
-fi
-rm -f conftest*
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_sparc_as_vis3" >&5
-$as_echo "$libc_cv_sparc_as_vis3" >&6; }
-if test $libc_cv_sparc_as_vis3 = yes; then
-  $as_echo "#define HAVE_AS_VIS3_SUPPORT 1" >>confdefs.h
-
-fi
-config_vars="$config_vars
-have-as-vis3 = $libc_cv_sparc_as_vis3"
-
 # Check for a GCC emitting GOTDATA relocations.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sparc gcc GOTDATA reloc support" >&5
 $as_echo_n "checking for sparc gcc GOTDATA reloc support... " >&6; }
diff --git a/sysdeps/sparc/configure.ac b/sysdeps/sparc/configure.ac
index 982077c..43ad541 100644
--- a/sysdeps/sparc/configure.ac
+++ b/sysdeps/sparc/configure.ac
@@ -1,35 +1,6 @@
 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
 # Local configure fragment for sysdeps/sparc.
 
-# Check for support of VIS3 et al. instructions in the assembler.
-AC_CACHE_CHECK(for sparc assembler VIS3 support, libc_cv_sparc_as_vis3, [dnl
-cat > conftest.S <<\EOF
-	.text
-foo:	fmadds		%f1, %f2, %f3, %f5
-	fmaddd		%f2, %f4, %f8, %f10
-	fhadds		%f2, %f3, %f5
-	fhaddd		%f4, %f8, %f10
-	pdistn		%f2, %f4, %g1
-	movdtox		%f10, %o0
-	movstouw	%f9, %o1
-	movstosw	%f7, %o2
-	movxtod		%o3, %f18
-	movwtos		%o4, %f15
-	flcmps		%fcc0, %f3, %f5
-	flcmpd		%fcc1, %f4, %f6
-EOF
-dnl
-if AC_TRY_COMMAND([${CC-cc} -c $CFLAGS -Wa,-Av9d conftest.S]); then
-  libc_cv_sparc_as_vis3=yes
-else
-  libc_cv_sparc_as_vis3=no
-fi
-rm -f conftest*])
-if test $libc_cv_sparc_as_vis3 = yes; then
-  AC_DEFINE(HAVE_AS_VIS3_SUPPORT)
-fi
-LIBC_CONFIG_VAR([have-as-vis3], [$libc_cv_sparc_as_vis3])
-
 # Check for a GCC emitting GOTDATA relocations.
 AC_CACHE_CHECK(for sparc gcc GOTDATA reloc support, libc_cv_sparc_gcc_gotdata, [dnl
 changequote(,)dnl
diff --git a/sysdeps/sparc/sparc-ifunc.h b/sysdeps/sparc/sparc-ifunc.h
index 3d81b52..0364fde 100644
--- a/sysdeps/sparc/sparc-ifunc.h
+++ b/sysdeps/sparc/sparc-ifunc.h
@@ -137,8 +137,6 @@ END (__##name)
 	SPARC_ASM_IFUNC1(name, HWCAP_SPARC_VIS2,	\
 			 __##name##_vis2, __##name##_generic)
 
-# ifdef HAVE_AS_VIS3_SUPPORT
-
 #define SPARC_ASM_VIS3_IFUNC(name)			\
 	SPARC_ASM_IFUNC1(name, HWCAP_SPARC_VIS3,	\
 			 __##name##_vis3, __##name##_generic)
@@ -149,17 +147,6 @@ END (__##name)
 			 HWCAP_SPARC_VIS2,		\
 			 __##name##_vis2, __##name##_generic)
 
-# else /* HAVE_AS_VIS3_SUPPORT */
-
-#define SPARC_ASM_VIS3_IFUNC(name)			\
-	SPARC_ASM_IFUNC_DFLT(name, __##name##_generic)
-
-#define SPARC_ASM_VIS3_VIS2_IFUNC(name)			\
-	SPARC_ASM_VIS2_IFUNC(name)
-
-# endif /* HAVE_AS_VIS3_SUPPORT */
-
-
 #else	/* __ASSEMBLER__ */
 
 # define sparc_libc_ifunc_redirected(redirected_name, name, expr)	\
diff --git a/sysdeps/sparc/sparc32/sparcv9/Makefile b/sysdeps/sparc/sparc32/sparcv9/Makefile
index 526673e..45507ea 100644
--- a/sysdeps/sparc/sparc32/sparcv9/Makefile
+++ b/sysdeps/sparc/sparc32/sparcv9/Makefile
@@ -1,16 +1,9 @@
 sysdep-CFLAGS += -mcpu=ultrasparc -Wa,-Av9a -mvis
 
-ifeq ($(have-as-vis3),yes)
 ASFLAGS-.o += -Wa,-Av9d
 ASFLAGS-.os += -Wa,-Av9d
 ASFLAGS-.op += -Wa,-Av9d
 ASFLAGS-.oS += -Wa,-Av9d
-else
-ASFLAGS-.o += -Wa,-Av9a
-ASFLAGS-.os += -Wa,-Av9a
-ASFLAGS-.op += -Wa,-Av9a
-ASFLAGS-.oS += -Wa,-Av9a
-endif
 
 # nscd uses atomic_spin_nop which in turn requires cpu_relax
 ifeq ($(subdir),nscd)
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
index 2a2d374..62bf6f1 100644
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
@@ -1,13 +1,13 @@
 ifeq ($(subdir),math)
-ifeq ($(have-as-vis3),yes)
 libm-sysdep_routines += m_copysignf-vis3 m_copysign-vis3 s_fabs-vis3 \
 			s_fabsf-vis3 s_llrintf-vis3 s_llrint-vis3 \
 			s_rintf-vis3 s_rint-vis3 \
-			s_fmaf-vis3 s_fma-vis3 s_nearbyint-vis3 \
-			s_nearbyintf-vis3 s_fdimf-vis3 s_fdim-vis3
+			s_fmaf-vis3 s_fma-vis3 s_fma-generic s_fmaf-generic \
+			s_nearbyint-vis3 s_nearbyintf-vis3 \
+			s_fdimf-vis3 s_fdim-vis3 s_fdim-generic \
+			s_fdimf-generic
 sysdep_routines += s_copysignf-vis3 s_copysign-vis3
 
 CFLAGS-s_fdimf-vis3.c += -Wa,-Av9d -mvis3
 CFLAGS-s_fdim-vis3.c += -Wa,-Av9d -mvis3
 endif
-endif
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-generic.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-generic.c
new file mode 100644
index 0000000..30ee54b
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-generic.c
@@ -0,0 +1,4 @@
+#define __fdim __fdim_generic
+#define declare_mgen_alias(t, f)
+
+#include <math/s_fdim.c>
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c
index ff3acd4..fe483f6 100644
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c
@@ -16,23 +16,16 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifdef HAVE_AS_VIS3_SUPPORT
-# include <math_ldbl_opt.h>
-# include <first-versions.h>
-# include <sparc-ifunc.h>
-# include <math.h>
+#include <math_ldbl_opt.h>
+#include <first-versions.h>
+#include <sparc-ifunc.h>
+#include <math.h>
 
 extern double __fdim_vis3 (double, double);
 extern double __fdim_generic (double, double);
 
 sparc_libm_ifunc(__fdim, hwcap & HWCAP_SPARC_VIS3 ? __fdim_vis3 : __fdim_generic);
 weak_alias (__fdim, fdim)
-# if LONG_DOUBLE_COMPAT (libm, FIRST_VERSION_libm_fdiml)
+#if LONG_DOUBLE_COMPAT (libm, FIRST_VERSION_libm_fdiml)
 compat_symbol (libm, __fdim, fdiml, FIRST_VERSION_libm_fdiml);
-# endif
-
-# define __fdim __fdim_generic
-# define declare_mgen_alias(t, f)
 #endif
-
-#include <math/s_fdim.c>
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-generic.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-generic.c
new file mode 100644
index 0000000..17090b5
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-generic.c
@@ -0,0 +1,3 @@
+#define __fdimf __fdimf_generic
+#define declare_mgen_alias(t, f)
+#include <math/s_fdimf.c>
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.c
index cf1dc9e..ced4593 100644
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.c
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.c
@@ -16,19 +16,11 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifdef HAVE_AS_VIS3_SUPPORT
-# include <sparc-ifunc.h>
-# include <math.h>
+#include <sparc-ifunc.h>
+#include <math.h>
 
 extern float __fdimf_vis3 (float, float);
 extern float __fdimf_generic (float, float);
 
 sparc_libm_ifunc(__fdimf, hwcap & HWCAP_SPARC_VIS3 ? __fdimf_vis3 : __fdimf_generic);
 weak_alias (__fdimf, fdimf)
-
-# define __fdimf __fdimf_generic
-# define declare_mgen_alias(t, f)
-
-#endif
-
-#include <math/s_fdimf.c>
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fma-generic.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fma-generic.c
new file mode 100644
index 0000000..e40816f
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fma-generic.c
@@ -0,0 +1,2 @@
+#define __fma __fma_generic
+#include <sysdeps/ieee754/dbl-64/s_fma.c>
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fma.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fma.c
index 05113c3..3d0c165 100644
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fma.c
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fma.c
@@ -1,7 +1,6 @@
-#ifdef HAVE_AS_VIS3_SUPPORT
-# include <sparc-ifunc.h>
-# include <math.h>
-# include <math_ldbl_opt.h>
+#include <sparc-ifunc.h>
+#include <math.h>
+#include <math_ldbl_opt.h>
 
 extern double __fma_vis3 (double, double, double);
 extern double __fma_generic (double, double, double);
@@ -11,8 +10,3 @@ weak_alias (__fma, fma)
 #if LONG_DOUBLE_COMPAT (libm, GLIBC_2_1)
 compat_symbol (libm, __fma, fmal, GLIBC_2_1);
 #endif
-
-# define __fma __fma_generic
-#endif
-
-#include <sysdeps/ieee754/dbl-64/s_fma.c>
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaf-generic.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaf-generic.c
new file mode 100644
index 0000000..218eeb3
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaf-generic.c
@@ -0,0 +1,2 @@
+#define __fmaf __fmaf_generic
+#include <sysdeps/ieee754/dbl-64/s_fmaf.c>
diff --git a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaf.c b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaf.c
index 7a273a3..5357b47 100644
--- a/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaf.c
+++ b/sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaf.c
@@ -1,14 +1,8 @@
-#ifdef HAVE_AS_VIS3_SUPPORT
-# include <sparc-ifunc.h>
-# include <math.h>
+#include <sparc-ifunc.h>
+#include <math.h>
 
 extern float __fmaf_vis3 (float, float, float);
 extern float __fmaf_generic (float, float, float);
 
 sparc_libm_ifunc(__fmaf, hwcap & HWCAP_SPARC_FMAF ? __fmaf_vis3 : __fmaf_generic);
 weak_alias (__fmaf, fmaf)
-
-# define __fmaf __fmaf_generic
-#endif
-
-#include <sysdeps/ieee754/dbl-64/s_fmaf.c>
diff --git a/sysdeps/sparc/sparc64/Makefile b/sysdeps/sparc/sparc64/Makefile
index a5e4036..0963a55 100644
--- a/sysdeps/sparc/sparc64/Makefile
+++ b/sysdeps/sparc/sparc64/Makefile
@@ -4,12 +4,10 @@ ifeq ($(subdir),string)
 sysdep_routines += align-cpy
 endif
 
-ifeq ($(have-as-vis3),yes)
 ASFLAGS-.o += -Wa,-Av9d
 ASFLAGS-.os += -Wa,-Av9d
 ASFLAGS-.op += -Wa,-Av9d
 ASFLAGS-.oS += -Wa,-Av9d
-endif
 
 # nscd uses atomic_spin_nop which in turn requires cpu_relax
 ifeq ($(subdir),nscd)
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
index 03a271d..2ac4496 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/Makefile
@@ -1,13 +1,14 @@
 ifeq ($(subdir),math)
-ifeq ($(have-as-vis3),yes)
 libm-sysdep_routines += m_signbitf-vis3 m_signbit-vis3 m_finitef-vis3 \
 			m_finite-vis3 m_isinff-vis3 m_isinf-vis3 \
 			m_isnanf-vis3 m_isnan-vis3 s_lrintf-vis3 \
 			s_lrint-vis3 s_rintf-vis3 s_rint-vis3 \
-			s_fmaf-vis3 s_fma-vis3 \
+			s_fmaf-vis3 s_fma-vis3 s_fmaf-generic s_fma-generic \
 			s_nearbyint-vis3 s_nearbyintf-vis3 \
-			s_ceilf-vis3 s_ceil-vis3 s_floorf-vis3 \
-			s_floor-vis3 s_truncf-vis3 s_trunc-vis3
+			s_ceilf-vis3 s_ceil-vis3 s_ceilf-generic \
+			s_ceil-generic s_floorf-vis3 s_floor-vis3 \
+			s_floorf-generic s_floor-generic s_truncf-vis3 \
+			s_trunc-vis3 s_truncf-generic s_trunc-generic
 sysdep_routines += s_signbitf-vis3 s_signbit-vis3 s_finitef-vis3 \
 		   s_finite-vis3 s_isinff-vis3 s_isinf-vis3 \
 		   s_isnanf-vis3 s_isnan-vis3
@@ -19,4 +20,3 @@ CFLAGS-s_floor-vis3.c += -Wa,-Av9d -mvis3
 CFLAGS-s_truncf-vis3.c += -Wa,-Av9d -mvis3
 CFLAGS-s_trunc-vis3.c += -Wa,-Av9d -mvis3
 endif
-endif
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-generic.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-generic.c
new file mode 100644
index 0000000..febea74
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-generic.c
@@ -0,0 +1,2 @@
+#define __ceil __ceil_generic
+#include <sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.c
index efa05e9..706be93 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.c
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.c
@@ -16,17 +16,11 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifdef HAVE_AS_VIS3_SUPPORT
-# include <sparc-ifunc.h>
-# include <math.h>
+#include <sparc-ifunc.h>
+#include <math.h>
 
 extern double __ceil_vis3 (double);
 extern double __ceil_generic (double);
 
 sparc_libm_ifunc(__ceil, hwcap & HWCAP_SPARC_VIS3 ? __ceil_vis3 : __ceil_generic);
 weak_alias (__ceil, ceil)
-
-# define __ceil __ceil_generic
-#endif
-
-#include <sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-generic.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-generic.c
new file mode 100644
index 0000000..ce75035
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-generic.c
@@ -0,0 +1,2 @@
+#define __ceilf __ceilf_generic
+#include <sysdeps/ieee754/flt-32/s_ceilf.c>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.c
index 62ada7f..dd80998 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.c
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.c
@@ -16,17 +16,11 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifdef HAVE_AS_VIS3_SUPPORT
-# include <sparc-ifunc.h>
-# include <math.h>
+#include <sparc-ifunc.h>
+#include <math.h>
 
 extern float __ceilf_vis3 (float);
 extern float __ceilf_generic (float);
 
 sparc_libm_ifunc(__ceilf, hwcap & HWCAP_SPARC_VIS3 ? __ceilf_vis3 : __ceilf_generic);
 weak_alias (__ceilf, ceilf)
-
-# define __ceilf __ceilf_generic
-#endif
-
-#include <sysdeps/ieee754/flt-32/s_ceilf.c>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_floor-generic.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_floor-generic.c
new file mode 100644
index 0000000..0f3361a
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_floor-generic.c
@@ -0,0 +1,2 @@
+#define __floor __floor_generic
+#include <sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_floor.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_floor.c
index d097f68..688eff1 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_floor.c
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_floor.c
@@ -16,9 +16,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifdef HAVE_AS_VIS3_SUPPORT
-# include <sparc-ifunc.h>
-# include <math.h>
+#include <sparc-ifunc.h>
+#include <math.h>
 
 extern double __floor_vis3 (double);
 extern double __floor_generic (double);
@@ -26,7 +25,4 @@ extern double __floor_generic (double);
 sparc_libm_ifunc(__floor, hwcap & HWCAP_SPARC_VIS3 ? __floor_vis3 : __floor_generic);
 weak_alias (__floor, floor)
 
-# define __floor __floor_generic
-#endif
-
-#include <sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c>
+#define __floor __floor_generic
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-generic.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-generic.c
new file mode 100644
index 0000000..28c377b
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-generic.c
@@ -0,0 +1,2 @@
+#define __floorf __floorf_generic
+#include <sysdeps/ieee754/flt-32/s_floorf.c>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.c
index 2a6c710..5f83cbc 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.c
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.c
@@ -16,17 +16,11 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifdef HAVE_AS_VIS3_SUPPORT
-# include <sparc-ifunc.h>
-# include <math.h>
+#include <sparc-ifunc.h>
+#include <math.h>
 
 extern float __floorf_vis3 (float);
 extern float __floorf_generic (float);
 
 sparc_libm_ifunc(__floorf, hwcap & HWCAP_SPARC_VIS3 ? __floorf_vis3 : __floorf_generic);
 weak_alias (__floorf, floorf)
-
-# define __floorf __floorf_generic
-#endif
-
-#include <sysdeps/ieee754/flt-32/s_floorf.c>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_fma-generic.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_fma-generic.c
new file mode 100644
index 0000000..e40816f
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_fma-generic.c
@@ -0,0 +1,2 @@
+#define __fma __fma_generic
+#include <sysdeps/ieee754/dbl-64/s_fma.c>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_fma.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_fma.c
index 3f2f162..78a50d5 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_fma.c
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_fma.c
@@ -1,14 +1,8 @@
-#ifdef HAVE_AS_VIS3_SUPPORT
-# include <sparc-ifunc.h>
-# include <math.h>
+#include <sparc-ifunc.h>
+#include <math.h>
 
 extern double __fma_vis3 (double, double, double);
 extern double __fma_generic (double, double, double);
 
 sparc_libm_ifunc(__fma, hwcap & HWCAP_SPARC_FMAF ? __fma_vis3 : __fma_generic);
 weak_alias (__fma, fma)
-
-# define __fma __fma_generic
-#endif
-
-#include <sysdeps/ieee754/dbl-64/s_fma.c>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf-generic.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf-generic.c
new file mode 100644
index 0000000..218eeb3
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf-generic.c
@@ -0,0 +1,2 @@
+#define __fmaf __fmaf_generic
+#include <sysdeps/ieee754/dbl-64/s_fmaf.c>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf.c
index 7a273a3..5357b47 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf.c
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf.c
@@ -1,14 +1,8 @@
-#ifdef HAVE_AS_VIS3_SUPPORT
-# include <sparc-ifunc.h>
-# include <math.h>
+#include <sparc-ifunc.h>
+#include <math.h>
 
 extern float __fmaf_vis3 (float, float, float);
 extern float __fmaf_generic (float, float, float);
 
 sparc_libm_ifunc(__fmaf, hwcap & HWCAP_SPARC_FMAF ? __fmaf_vis3 : __fmaf_generic);
 weak_alias (__fmaf, fmaf)
-
-# define __fmaf __fmaf_generic
-#endif
-
-#include <sysdeps/ieee754/dbl-64/s_fmaf.c>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_trunc-generic.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_trunc-generic.c
new file mode 100644
index 0000000..00abd2a
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_trunc-generic.c
@@ -0,0 +1,2 @@
+#define __trunc __trunc_generic
+#include <sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.c
index dc67f42..42cf69f 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.c
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.c
@@ -16,17 +16,11 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifdef HAVE_AS_VIS3_SUPPORT
-# include <sparc-ifunc.h>
-# include <math.h>
+#include <sparc-ifunc.h>
+#include <math.h>
 
 extern double __trunc_vis3 (double);
 extern double __trunc_generic (double);
 
 sparc_libm_ifunc(__trunc, hwcap & HWCAP_SPARC_VIS3 ? __trunc_vis3 : __trunc_generic);
 weak_alias (__trunc, trunc)
-
-# define __trunc __trunc_generic
-#endif
-
-#include <sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_truncf-generic.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_truncf-generic.c
new file mode 100644
index 0000000..7e5d91e
--- /dev/null
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_truncf-generic.c
@@ -0,0 +1,2 @@
+#define __truncf __truncf_generic
+#include <sysdeps/ieee754/flt-32/s_truncf.c>
diff --git a/sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.c b/sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.c
index 980a313..9d0b369 100644
--- a/sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.c
+++ b/sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.c
@@ -16,17 +16,11 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifdef HAVE_AS_VIS3_SUPPORT
-# include <sparc-ifunc.h>
-# include <math.h>
+#include <sparc-ifunc.h>
+#include <math.h>
 
 extern float __truncf_vis3 (float);
 extern float __truncf_generic (float);
 
 sparc_libm_ifunc(__truncf, hwcap & HWCAP_SPARC_VIS3 ? __truncf_vis3 : __truncf_generic);
 weak_alias (__truncf, truncf)
-
-# define __truncf __truncf_generic
-#endif
-
-#include <sysdeps/ieee754/flt-32/s_truncf.c>

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=67be807d63e8053c1549f31687df6db60b50f960

commit 67be807d63e8053c1549f31687df6db60b50f960
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 6 12:59:32 2017 -0300

    arm: Implement memchr ifunc selection in C
    
    This patch refactor ARM memchr ifunc selector to a C implementation.
    No functional change is expected, including ifunc resolution rules.
    
    It also reorganize the ifunc options code:
    
      1. The memchr_impl.S is renamed to memchr_neon.S and multiple
         compilation options (which route to armv6t2/memchr one) is
         removed.  The code to build if __ARM_NEON__ is defined is
         also simplified.
    
      2. A memchr_noneon is added (which as build along previous ifunc
         resolution) and includes the armv6t2 direct.
    
      3. Same as 2. for loader object.
    
    Checked on armv7-linux-gnueabihf and with a build for arm-linux-gnueabi,
    arm-linux-gnueabihf with and without multiarch support and with both
    GCC 7.1 and GCC mainline.
    
    	* sysdeps/arm/armv7/multiarch/Makefile [$(subdir) = string]
    	(sysdeps_routines): Add memchr_noneon.
    	* sysdeps/arm/armv7/multiarch/ifunc-memchr.h: New file.
    	* sysdeps/arm/armv7/multiarch/memchr_noneon.S: Likewise.
    	* sysdeps/arm/armv7/multiarch/rtld-memchr.S: Likewise.
    	* sysdeps/arm/armv7/multiarch/memchr.S: Remove file.
    	* sysdeps/arm/armv7/multiarch/memchr.c: New file.
    	* sysdeps/arm/armv7/multiarch/memchr_impl.S: Move to ...
    	* sysdeps/arm/armv7/multiarch/memchr_neon.S: ... here.

diff --git a/ChangeLog b/ChangeLog
index 6ac20cf..4b7b218 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/arm/armv7/multiarch/Makefile [$(subdir) = string]
+	(sysdeps_routines): Add memchr_noneon.
+	* sysdeps/arm/armv7/multiarch/ifunc-memchr.h: New file.
+	* sysdeps/arm/armv7/multiarch/memchr_noneon.S: Likewise.
+	* sysdeps/arm/armv7/multiarch/rtld-memchr.S: Likewise.
+	* sysdeps/arm/armv7/multiarch/memchr.S: Remove file.
+	* sysdeps/arm/armv7/multiarch/memchr.c: New file.
+	* sysdeps/arm/armv7/multiarch/memchr_impl.S: Move to ...
+	* sysdeps/arm/armv7/multiarch/memchr_neon.S: ... here.
+
 	* sysdeps/arm/arm-ifunc.h: New file.
 	* sysdeps/arm/armv7/multiarch/ifunc-memcpy.h: Likewise.
 	* sysdeps/arm/armv7/multiarch/memcpy.c: Likewise.
diff --git a/sysdeps/arm/armv7/multiarch/Makefile b/sysdeps/arm/armv7/multiarch/Makefile
index 1e62ef9..6e5851f 100644
--- a/sysdeps/arm/armv7/multiarch/Makefile
+++ b/sysdeps/arm/armv7/multiarch/Makefile
@@ -1,3 +1,4 @@
 ifeq ($(subdir),string)
-sysdep_routines += memcpy_neon memcpy_vfp memchr_neon memcpy_arm
+sysdep_routines += memcpy_neon memcpy_vfp memchr_neon memcpy_arm \
+		   memchr_noneon
 endif
diff --git a/sysdeps/arm/armv7/multiarch/ifunc-memchr.h b/sysdeps/arm/armv7/multiarch/ifunc-memchr.h
new file mode 100644
index 0000000..42f89fa
--- /dev/null
+++ b/sysdeps/arm/armv7/multiarch/ifunc-memchr.h
@@ -0,0 +1,28 @@
+/* Common definition for memchr resolver.
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+__typeof (REDIRECT_NAME) OPTIMIZE (neon) attribute_hidden;
+__typeof (REDIRECT_NAME) OPTIMIZE (noneon) attribute_hidden;
+
+static inline void *
+IFUNC_SELECTOR (int hwcap)
+{
+  if (hwcap & HWCAP_ARM_NEON)
+    return OPTIMIZE (neon);
+  return OPTIMIZE (noneon);
+}
diff --git a/sysdeps/arm/armv7/multiarch/memchr.S b/sysdeps/arm/armv7/multiarch/memchr.S
deleted file mode 100644
index 8e8097a..0000000
--- a/sysdeps/arm/armv7/multiarch/memchr.S
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Multiple versions of memchr
-   All versions must be listed in ifunc-impl-list.c.
-   Copyright (C) 2013-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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-#include <rtld-global-offsets.h>
-
-#if IS_IN (libc)
-/* Under __ARM_NEON__, memchr_neon.S defines the name memchr.  */
-# ifndef __ARM_NEON__
-	.text
-	.arm
-ENTRY(memchr)
-	.type	memchr, %gnu_indirect_function
-	ldr	r1, .Lmemchr_noneon
-	tst	r0, #HWCAP_ARM_NEON
-	ldrne	r1, .Lmemchr_neon
-1:
-	add	r0, r1, pc
-	DO_RET(lr)
-
-.Lmemchr_noneon:
-	.long	C_SYMBOL_NAME(__memchr_noneon) - 1b - 8
-.Lmemchr_neon:
-	.long	C_SYMBOL_NAME(__memchr_neon) - 1b - 8
-
-END(memchr)
-
-libc_hidden_builtin_def (memchr)
-# endif  /* Not __ARM_NEON__.  */
-libc_hidden_def (__memchr_noneon)
-
-# 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 memchr __memchr_noneon
-
-#endif
-
-#include "memchr_impl.S"
diff --git a/sysdeps/arm/armv7/multiarch/memchr.c b/sysdeps/arm/armv7/multiarch/memchr.c
new file mode 100644
index 0000000..906bcd5
--- /dev/null
+++ b/sysdeps/arm/armv7/multiarch/memchr.c
@@ -0,0 +1,35 @@
+/* Multiple versions of memchr.
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+/* For __ARM_NEON__ memchr_neon.S defines memchr directly and ifunc
+   is not used.  */
+#if IS_IN (libc) && !defined (__ARM_NEON__)
+# define memchr __redirect_memchr
+# include <string.h>
+# undef memchr
+
+# include <arm-ifunc.h>
+
+# define SYMBOL_NAME memchr
+# include "ifunc-memchr.h"
+
+arm_libc_ifunc_redirected (__redirect_memchr, memchr, IFUNC_SELECTOR);
+
+arm_libc_ifunc_hidden_def (__redirect_memchr, memchr);
+#endif
diff --git a/sysdeps/arm/armv7/multiarch/memchr_impl.S b/sysdeps/arm/armv7/multiarch/memchr_impl.S
deleted file mode 100644
index e8cbb97..0000000
--- a/sysdeps/arm/armv7/multiarch/memchr_impl.S
+++ /dev/null
@@ -1,219 +0,0 @@
-/* memchr implemented using NEON.
-   Copyright (C) 2011-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
-   <http://www.gnu.org/licenses/>.  */
-
-#ifdef MEMCHR_NEON
-
-#include <sysdep.h>
-
-	.arch	armv7-a
-	.fpu	neon
-
-
-/* Arguments */
-#define srcin		r0
-#define chrin		r1
-#define cntin		r2
-
-/* Retval */
-#define result		r0	/* Live range does not overlap with srcin */
-
-/* Working registers */
-#define src		r1	/* Live range does not overlap with chrin */
-#define tmp		r3
-#define synd		r0	/* No overlap with srcin or result */
-#define soff		r12
-
-/* Working NEON registers */
-#define vrepchr		q0
-#define vdata0		q1
-#define vdata0_0	d2	/* Lower half of vdata0 */
-#define vdata0_1	d3	/* Upper half of vdata0 */
-#define vdata1		q2
-#define vdata1_0	d4	/* Lower half of vhas_chr0 */
-#define vdata1_1	d5	/* Upper half of vhas_chr0 */
-#define vrepmask	q3
-#define vrepmask0	d6
-#define vrepmask1	d7
-#define vend		q4
-#define vend0		d8
-#define vend1		d9
-
-/*
- * Core algorithm:
- *
- * For each 32-byte chunk we calculate a 32-bit syndrome value, with one bit per
- * byte. Each bit is set if the relevant byte matched the requested character
- * and cleared otherwise. Since the bits in the syndrome reflect exactly the
- * order in which things occur in the original string, counting trailing zeros
- * allows to identify exactly which byte has matched.
- */
-
-#ifndef NO_THUMB
-	.thumb_func
-#else
-	.arm
-#endif
-	.p2align 4,,15
-
-ENTRY(memchr)
-	/* Use a simple loop if there are less than 8 bytes to search.  */
-	cmp	cntin, #7
-	bhi	.Llargestr
-	and	chrin, chrin, #0xff
-
-.Lsmallstr:
-	subs	cntin, cntin, #1
-	blo	.Lnotfound	/* Return not found if reached end.  */
-	ldrb	tmp, [srcin], #1
-	cmp	tmp, chrin
-	bne	.Lsmallstr	/* Loop again if not found.  */
-	/* Otherwise fixup address and return.  */
-	sub	result, srcin, #1
-	bx	lr
-
-
-.Llargestr:
-	vdup.8	vrepchr, chrin	/* Duplicate char across all lanes. */
-	/*
-	 * Magic constant 0x8040201008040201 allows us to identify which lane
-	 * matches the requested byte.
-	 */
-	movw	tmp, #0x0201
-	movt	tmp, #0x0804
-	lsl	soff, tmp, #4
-	vmov	vrepmask0, tmp, soff
-	vmov	vrepmask1, tmp, soff
-	/* Work with aligned 32-byte chunks */
-	bic	src, srcin, #31
-	ands	soff, srcin, #31
-	beq	.Lloopintro	/* Go straight to main loop if it's aligned. */
-
-	/*
-	 * Input string is not 32-byte aligned. We calculate the syndrome
-	 * value for the aligned 32 bytes block containing the first bytes
-	 * and mask the irrelevant part.
-	 */
-	vld1.8		{vdata0, vdata1}, [src:256]!
-	sub		tmp, soff, #32
-	adds		cntin, cntin, tmp
-	vceq.i8		vdata0, vdata0, vrepchr
-	vceq.i8		vdata1, vdata1, vrepchr
-	vand		vdata0, vdata0, vrepmask
-	vand		vdata1, vdata1, vrepmask
-	vpadd.i8	vdata0_0, vdata0_0, vdata0_1
-	vpadd.i8	vdata1_0, vdata1_0, vdata1_1
-	vpadd.i8	vdata0_0, vdata0_0, vdata1_0
-	vpadd.i8	vdata0_0, vdata0_0, vdata0_0
-	vmov		synd, vdata0_0[0]
-
-	/* Clear the soff lower bits */
-	lsr		synd, synd, soff
-	lsl		synd, synd, soff
-	/* The first block can also be the last */
-	bls		.Lmasklast
-	/* Have we found something already? */
-#ifndef NO_THUMB
-	cbnz		synd, .Ltail
-#else
-	cmp		synd, #0
-	bne		.Ltail
-#endif
-
-
-.Lloopintro:
-	vpush	{vend}
-	/* 264/265 correspond to d8/d9 for q4 */
-	cfi_adjust_cfa_offset (16)
-	cfi_rel_offset (264, 0)
-	cfi_rel_offset (265, 8)
-	.p2align 3,,7
-.Lloop:
-	vld1.8		{vdata0, vdata1}, [src:256]!
-	subs		cntin, cntin, #32
-	vceq.i8		vdata0, vdata0, vrepchr
-	vceq.i8		vdata1, vdata1, vrepchr
-	/* If we're out of data we finish regardless of the result. */
-	bls		.Lend
-	/* Use a fast check for the termination condition. */
-	vorr		vend, vdata0, vdata1
-	vorr		vend0, vend0, vend1
-	vmov		synd, tmp, vend0
-	orrs		synd, synd, tmp
-	/* We're not out of data, loop if we haven't found the character. */
-	beq		.Lloop
-
-.Lend:
-	vpop		{vend}
-	cfi_adjust_cfa_offset (-16)
-	cfi_restore (264)
-	cfi_restore (265)
-
-	/* Termination condition found, let's calculate the syndrome value. */
-	vand		vdata0, vdata0, vrepmask
-	vand		vdata1, vdata1, vrepmask
-	vpadd.i8	vdata0_0, vdata0_0, vdata0_1
-	vpadd.i8	vdata1_0, vdata1_0, vdata1_1
-	vpadd.i8	vdata0_0, vdata0_0, vdata1_0
-	vpadd.i8	vdata0_0, vdata0_0, vdata0_0
-	vmov		synd, vdata0_0[0]
-#ifndef NO_THUMB
-	cbz		synd, .Lnotfound
-	bhi		.Ltail	/* Uses the condition code from
-				   subs cntin, cntin, #32 above.  */
-#else
-	cmp		synd, #0
-	beq		.Lnotfound
-	cmp		cntin, #0
-	bhi		.Ltail
-#endif
-
-
-.Lmasklast:
-	/* Clear the (-cntin) upper bits to avoid out-of-bounds matches. */
-	neg	cntin, cntin
-	lsl	synd, synd, cntin
-	lsrs	synd, synd, cntin
-	it	eq
-	moveq	src, #0	/* If no match, set src to 0 so the retval is 0. */
-
-
-.Ltail:
-	/* Count the trailing zeros using bit reversing */
-	rbit	synd, synd
-	/* Compensate the last post-increment */
-	sub	src, src, #32
-	/* Count the leading zeros */
-	clz	synd, synd
-	/* Compute the potential result and return */
-	add	result, src, synd
-	bx	lr
-
-
-.Lnotfound:
-	/* Set result to NULL if not found and return */
-	mov	result, #0
-	bx	lr
-
-END(memchr)
-libc_hidden_builtin_def (memchr)
-
-#else
-
-#include "../../armv6t2/memchr.S"
-
-#endif
diff --git a/sysdeps/arm/armv7/multiarch/memchr_neon.S b/sysdeps/arm/armv7/multiarch/memchr_neon.S
index ee21818..a400033 100644
--- a/sysdeps/arm/armv7/multiarch/memchr_neon.S
+++ b/sysdeps/arm/armv7/multiarch/memchr_neon.S
@@ -1,9 +1,218 @@
-#ifdef __ARM_NEON__
-/* Under __ARM_NEON__, this file defines memchr directly.  */
-libc_hidden_builtin_def (memchr)
-#else
+/* memchr implemented using NEON.
+   Copyright (C) 2011-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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+
+/* For __ARM_NEON__ this file defines memchr.  */
+#ifndef __ARM_NEON__
 # define memchr __memchr_neon
+# undef libc_hidden_builtin_def
+# define libc_hidden_builtin_def(a)
+#endif
+
+	.arch	armv7-a
+	.fpu	neon
+
+
+/* Arguments */
+#define srcin		r0
+#define chrin		r1
+#define cntin		r2
+
+/* Retval */
+#define result		r0	/* Live range does not overlap with srcin */
+
+/* Working registers */
+#define src		r1	/* Live range does not overlap with chrin */
+#define tmp		r3
+#define synd		r0	/* No overlap with srcin or result */
+#define soff		r12
+
+/* Working NEON registers */
+#define vrepchr		q0
+#define vdata0		q1
+#define vdata0_0	d2	/* Lower half of vdata0 */
+#define vdata0_1	d3	/* Upper half of vdata0 */
+#define vdata1		q2
+#define vdata1_0	d4	/* Lower half of vhas_chr0 */
+#define vdata1_1	d5	/* Upper half of vhas_chr0 */
+#define vrepmask	q3
+#define vrepmask0	d6
+#define vrepmask1	d7
+#define vend		q4
+#define vend0		d8
+#define vend1		d9
+
+/*
+ * Core algorithm:
+ *
+ * For each 32-byte chunk we calculate a 32-bit syndrome value, with one bit per
+ * byte. Each bit is set if the relevant byte matched the requested character
+ * and cleared otherwise. Since the bits in the syndrome reflect exactly the
+ * order in which things occur in the original string, counting trailing zeros
+ * allows to identify exactly which byte has matched.
+ */
+
+#ifndef NO_THUMB
+	.thumb_func
+#else
+	.arm
+#endif
+	.p2align 4,,15
+
+ENTRY(memchr)
+	/* Use a simple loop if there are less than 8 bytes to search.  */
+	cmp	cntin, #7
+	bhi	.Llargestr
+	and	chrin, chrin, #0xff
+
+.Lsmallstr:
+	subs	cntin, cntin, #1
+	blo	.Lnotfound	/* Return not found if reached end.  */
+	ldrb	tmp, [srcin], #1
+	cmp	tmp, chrin
+	bne	.Lsmallstr	/* Loop again if not found.  */
+	/* Otherwise fixup address and return.  */
+	sub	result, srcin, #1
+	bx	lr
+
+
+.Llargestr:
+	vdup.8	vrepchr, chrin	/* Duplicate char across all lanes. */
+	/*
+	 * Magic constant 0x8040201008040201 allows us to identify which lane
+	 * matches the requested byte.
+	 */
+	movw	tmp, #0x0201
+	movt	tmp, #0x0804
+	lsl	soff, tmp, #4
+	vmov	vrepmask0, tmp, soff
+	vmov	vrepmask1, tmp, soff
+	/* Work with aligned 32-byte chunks */
+	bic	src, srcin, #31
+	ands	soff, srcin, #31
+	beq	.Lloopintro	/* Go straight to main loop if it's aligned. */
+
+	/*
+	 * Input string is not 32-byte aligned. We calculate the syndrome
+	 * value for the aligned 32 bytes block containing the first bytes
+	 * and mask the irrelevant part.
+	 */
+	vld1.8		{vdata0, vdata1}, [src:256]!
+	sub		tmp, soff, #32
+	adds		cntin, cntin, tmp
+	vceq.i8		vdata0, vdata0, vrepchr
+	vceq.i8		vdata1, vdata1, vrepchr
+	vand		vdata0, vdata0, vrepmask
+	vand		vdata1, vdata1, vrepmask
+	vpadd.i8	vdata0_0, vdata0_0, vdata0_1
+	vpadd.i8	vdata1_0, vdata1_0, vdata1_1
+	vpadd.i8	vdata0_0, vdata0_0, vdata1_0
+	vpadd.i8	vdata0_0, vdata0_0, vdata0_0
+	vmov		synd, vdata0_0[0]
+
+	/* Clear the soff lower bits */
+	lsr		synd, synd, soff
+	lsl		synd, synd, soff
+	/* The first block can also be the last */
+	bls		.Lmasklast
+	/* Have we found something already? */
+#ifndef NO_THUMB
+	cbnz		synd, .Ltail
+#else
+	cmp		synd, #0
+	bne		.Ltail
 #endif
 
-#define MEMCHR_NEON
-#include "memchr_impl.S"
+
+.Lloopintro:
+	vpush	{vend}
+	/* 264/265 correspond to d8/d9 for q4 */
+	cfi_adjust_cfa_offset (16)
+	cfi_rel_offset (264, 0)
+	cfi_rel_offset (265, 8)
+	.p2align 3,,7
+.Lloop:
+	vld1.8		{vdata0, vdata1}, [src:256]!
+	subs		cntin, cntin, #32
+	vceq.i8		vdata0, vdata0, vrepchr
+	vceq.i8		vdata1, vdata1, vrepchr
+	/* If we're out of data we finish regardless of the result. */
+	bls		.Lend
+	/* Use a fast check for the termination condition. */
+	vorr		vend, vdata0, vdata1
+	vorr		vend0, vend0, vend1
+	vmov		synd, tmp, vend0
+	orrs		synd, synd, tmp
+	/* We're not out of data, loop if we haven't found the character. */
+	beq		.Lloop
+
+.Lend:
+	vpop		{vend}
+	cfi_adjust_cfa_offset (-16)
+	cfi_restore (264)
+	cfi_restore (265)
+
+	/* Termination condition found, let's calculate the syndrome value. */
+	vand		vdata0, vdata0, vrepmask
+	vand		vdata1, vdata1, vrepmask
+	vpadd.i8	vdata0_0, vdata0_0, vdata0_1
+	vpadd.i8	vdata1_0, vdata1_0, vdata1_1
+	vpadd.i8	vdata0_0, vdata0_0, vdata1_0
+	vpadd.i8	vdata0_0, vdata0_0, vdata0_0
+	vmov		synd, vdata0_0[0]
+#ifndef NO_THUMB
+	cbz		synd, .Lnotfound
+	bhi		.Ltail	/* Uses the condition code from
+				   subs cntin, cntin, #32 above.  */
+#else
+	cmp		synd, #0
+	beq		.Lnotfound
+	cmp		cntin, #0
+	bhi		.Ltail
+#endif
+
+
+.Lmasklast:
+	/* Clear the (-cntin) upper bits to avoid out-of-bounds matches. */
+	neg	cntin, cntin
+	lsl	synd, synd, cntin
+	lsrs	synd, synd, cntin
+	it	eq
+	moveq	src, #0	/* If no match, set src to 0 so the retval is 0. */
+
+
+.Ltail:
+	/* Count the trailing zeros using bit reversing */
+	rbit	synd, synd
+	/* Compensate the last post-increment */
+	sub	src, src, #32
+	/* Count the leading zeros */
+	clz	synd, synd
+	/* Compute the potential result and return */
+	add	result, src, synd
+	bx	lr
+
+
+.Lnotfound:
+	/* Set result to NULL if not found and return */
+	mov	result, #0
+	bx	lr
+
+END(memchr)
+libc_hidden_builtin_def (memchr)
diff --git a/sysdeps/arm/armv7/multiarch/memchr_noneon.S b/sysdeps/arm/armv7/multiarch/memchr_noneon.S
new file mode 100644
index 0000000..e13be13
--- /dev/null
+++ b/sysdeps/arm/armv7/multiarch/memchr_noneon.S
@@ -0,0 +1,8 @@
+/* For __ARM_NEON__ memchr_neon defines memchr.  */
+#ifndef __ARM_NEON__
+# define memchr __memchr_noneon
+# undef libc_hidden_builtin_def
+# define libc_hidden_builtin_def(name)
+
+# include <sysdeps/arm/armv6t2/memchr.S>
+#endif
diff --git a/sysdeps/arm/armv7/multiarch/rtld-memchr.S b/sysdeps/arm/armv7/multiarch/rtld-memchr.S
new file mode 100644
index 0000000..ae8e5f0
--- /dev/null
+++ b/sysdeps/arm/armv7/multiarch/rtld-memchr.S
@@ -0,0 +1 @@
+#include <sysdeps/arm/armv6t2/memchr.S>

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=aa24ec5af4a6ba83916c7e9da468e3929c0586d2

commit aa24ec5af4a6ba83916c7e9da468e3929c0586d2
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Oct 4 17:44:08 2017 -0300

    arm: Implement memcpy ifunc selection in C
    
    This patch refactor ARM memcpy ifunc selector to a C implementation.
    No functional change is expected, including ifunc resolution rules.
    
    To avoid build issues with mainline GCC which set no default gnu
    indirect function support for ARM (--enable-gnu-indirect-function)
    two fixes are added:
    
      1. The new macro arm_libc_ifunc_hidden_def is redefined using
         direct asm assembly directives instead of function attributes.
         This avoid the incompatbile types for a symbol and its alias.
    
      2. A new macro NO_MEM_INTERAL_SYM_HACKS is added on symbol-hacks
         and defined on arm ifunc objects.  It avoids the symbol
         definition loop because compiler might emit the hacks for first
         fix before the ifunc function definition itself.
    
    Checked on armv7-linux-gnueabihf and with a build for arm-linux-gnueabi,
    arm-linux-gnueabihf with and without multiarch support and with both
    GCC 7.1 and GCC mainline.
    
    	* sysdeps/arm/arm-ifunc.h: New file.
    	* sysdeps/arm/armv7/multiarch/ifunc-memcpy.h: Likewise.
    	* sysdeps/arm/armv7/multiarch/memcpy.c: Likewise.
    	* sysdeps/arm/armv7/multiarch/memcpy_arm.S: Likewise.
    	* sysdeps/arm/armv7/multiarch/rtld-memcpy.S: Likewise.
    	* sysdeps/arm/armv7/multiarch/Makefile [$(subdir) = string]
    	(sysdep_routines): Add memcpy_arm.
    	* sysdeps/arm/armv7/multiarch/memcpy.S: Remove file.

diff --git a/ChangeLog b/ChangeLog
index 968b1e5..6ac20cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/arm/arm-ifunc.h: New file.
+	* sysdeps/arm/armv7/multiarch/ifunc-memcpy.h: Likewise.
+	* sysdeps/arm/armv7/multiarch/memcpy.c: Likewise.
+	* sysdeps/arm/armv7/multiarch/memcpy_arm.S: Likewise.
+	* sysdeps/arm/armv7/multiarch/rtld-memcpy.S: Likewise.
+	* sysdeps/arm/armv7/multiarch/Makefile [$(subdir) = string]
+	(sysdep_routines): Add memcpy_arm.
+	* sysdeps/arm/armv7/multiarch/memcpy.S: Remove file.
+
 	* sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile
 	[$(subdir) = string] (sysdep_routines): Add memset-ultra1.
 	* sysdeps/sparc/sparc64/multiarch/Makefile [$(subdir) = string]
diff --git a/sysdeps/arm/arm-ifunc.h b/sysdeps/arm/arm-ifunc.h
new file mode 100644
index 0000000..52cb533
--- /dev/null
+++ b/sysdeps/arm/arm-ifunc.h
@@ -0,0 +1,33 @@
+/* Common definition for ifunc resolvers.  Linux/ARM version.
+   This file is part of the GNU C Library.
+   Copyright (C) 2017 Free Software Foundation, Inc.
+
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+#include <ifunc-init.h>
+
+#define INIT_ARCH()
+
+#define arm_libc_ifunc_redirected(redirected_name, name, expr)	\
+  __ifunc (redirected_name, name, expr(hwcap), int hwcap, INIT_ARCH)
+
+#if defined SHARED
+# define arm_libc_ifunc_hidden_def(redirect_name, name) \
+  __hidden_ver1 (name, __GI_##name, redirect_name) \
+    __attribute__ ((visibility ("hidden")))
+#else
+# define arm_libc_ifunc_hidden_def(redirect_name, name)
+#endif
diff --git a/sysdeps/arm/armv7/multiarch/Makefile b/sysdeps/arm/armv7/multiarch/Makefile
index 9e1e61c..1e62ef9 100644
--- a/sysdeps/arm/armv7/multiarch/Makefile
+++ b/sysdeps/arm/armv7/multiarch/Makefile
@@ -1,3 +1,3 @@
 ifeq ($(subdir),string)
-sysdep_routines += memcpy_neon memcpy_vfp memchr_neon
+sysdep_routines += memcpy_neon memcpy_vfp memchr_neon memcpy_arm
 endif
diff --git a/sysdeps/arm/armv7/multiarch/ifunc-memcpy.h b/sysdeps/arm/armv7/multiarch/ifunc-memcpy.h
new file mode 100644
index 0000000..78cef2a
--- /dev/null
+++ b/sysdeps/arm/armv7/multiarch/ifunc-memcpy.h
@@ -0,0 +1,37 @@
+/* Common definition for memcpy resolver.
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#ifdef __SOFTFP__
+__typeof (REDIRECT_NAME) OPTIMIZE (arm) attribute_hidden;
+#endif
+__typeof (REDIRECT_NAME) OPTIMIZE (vfp) attribute_hidden;
+__typeof (REDIRECT_NAME) OPTIMIZE (neon) attribute_hidden;
+
+static inline void *
+IFUNC_SELECTOR (int hwcap)
+{
+  if (hwcap & HWCAP_ARM_NEON)
+    return OPTIMIZE (neon);
+#ifdef __SOFTFP__
+  if (hwcap & HWCAP_ARM_VFP)
+    return OPTIMIZE (vfp);
+  return OPTIMIZE (arm);
+#else
+  return OPTIMIZE (vfp);
+#endif
+}
diff --git a/sysdeps/arm/armv7/multiarch/memcpy.S b/sysdeps/arm/armv7/multiarch/memcpy.S
deleted file mode 100644
index 8a53bda..0000000
--- a/sysdeps/arm/armv7/multiarch/memcpy.S
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Multiple versions of memcpy
-   All versions must be listed in ifunc-impl-list.c.
-   Copyright (C) 2013-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
-   <http://www.gnu.org/licenses/>.  */
-
-/* Thumb requires excess IT instructions here.  */
-#define NO_THUMB
-#include <sysdep.h>
-#include <rtld-global-offsets.h>
-
-#if IS_IN (libc)
-/* Under __ARM_NEON__, memcpy_neon.S defines the name memcpy.  */
-# ifndef __ARM_NEON__
-	.text
-ENTRY(memcpy)
-	.type	memcpy, %gnu_indirect_function
-# ifdef __SOFTFP__
-	ldr	r1, .Lmemcpy_arm
-	tst	r0, #HWCAP_ARM_VFP
-	ldrne	r1, .Lmemcpy_vfp
-# else
-	ldr	r1, .Lmemcpy_vfp
-# endif
-	tst	r0, #HWCAP_ARM_NEON
-	ldrne	r1, .Lmemcpy_neon
-1:
-	add	r0, r1, pc
-	DO_RET(lr)
-
-# ifdef __SOFTFP__
-.Lmemcpy_arm:
-	.long	C_SYMBOL_NAME(__memcpy_arm) - 1b - PC_OFS
-# endif
-.Lmemcpy_neon:
-	.long	C_SYMBOL_NAME(__memcpy_neon) - 1b - PC_OFS
-.Lmemcpy_vfp:
-	.long	C_SYMBOL_NAME(__memcpy_vfp) - 1b - PC_OFS
-
-END(memcpy)
-
-libc_hidden_builtin_def (memcpy)
-#endif  /* Not __ARM_NEON__.  */
-
-/* These versions of memcpy are defined not to clobber any VFP or NEON
-   registers so they must always call the ARM variant of the memcpy code.  */
-strong_alias (__memcpy_arm, __aeabi_memcpy)
-strong_alias (__memcpy_arm, __aeabi_memcpy4)
-strong_alias (__memcpy_arm, __aeabi_memcpy8)
-libc_hidden_def (__memcpy_arm)
-
-#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_arm
-
-#endif
-
-#include "memcpy_impl.S"
diff --git a/sysdeps/arm/armv7/multiarch/memcpy.c b/sysdeps/arm/armv7/multiarch/memcpy.c
new file mode 100644
index 0000000..7ef6714
--- /dev/null
+++ b/sysdeps/arm/armv7/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
+   <http://www.gnu.org/licenses/>.  */
+
+#if IS_IN (libc)
+# define memcpy __redirect_memcpy
+# include <string.h>
+# undef memcpy
+
+# include <arm-ifunc.h>
+
+# define SYMBOL_NAME memcpy
+# include "ifunc-memcpy.h"
+
+arm_libc_ifunc_redirected (__redirect_memcpy, memcpy, IFUNC_SELECTOR);
+
+arm_libc_ifunc_hidden_def (__redirect_memcpy, memcpy);
+#endif
diff --git a/sysdeps/arm/armv7/multiarch/memcpy_arm.S b/sysdeps/arm/armv7/multiarch/memcpy_arm.S
new file mode 100644
index 0000000..37565cd
--- /dev/null
+++ b/sysdeps/arm/armv7/multiarch/memcpy_arm.S
@@ -0,0 +1,6 @@
+#define memcpy __memcpy_arm
+#include "memcpy_impl.S"
+
+strong_alias (__memcpy_arm, __aeabi_memcpy)
+strong_alias (__memcpy_arm, __aeabi_memcpy4)
+strong_alias (__memcpy_arm, __aeabi_memcpy8)
diff --git a/sysdeps/arm/armv7/multiarch/rtld-memcpy.S b/sysdeps/arm/armv7/multiarch/rtld-memcpy.S
new file mode 100644
index 0000000..0190edc
--- /dev/null
+++ b/sysdeps/arm/armv7/multiarch/rtld-memcpy.S
@@ -0,0 +1 @@
+#include <./sysdeps/arm/armv7/multiarch/memcpy_impl.S>

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e8af757052c4474561761ae796d1ca93730a2661

commit e8af757052c4474561761ae796d1ca93730a2661
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Oct 3 10:58:29 2017 -0300

    sparc: Implement memset/bzero ifunc selection in C
    
    This patch refactor the SPARC64 ifunc selector to a C implementation.
    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/Makefile
    	[$(subdir) = string] (sysdep_routines): Add memset-ultra1.
    	* sysdeps/sparc/sparc64/multiarch/Makefile [$(subdir) = string]
    	(sysdep_routines): Add memset-ultra1.
    	* sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S: New
    	file.
    	* sysdeps/sparc/sparc32/sparcv9/multiarch/memset.c: Likewise.
    	* sysdeps/sparc/sparc64/multiarch/ifunc-memset.h: Likewise.
    	* sysdeps/sparc/sparc64/multiarch/memset-ultra1.S: Likewise.
    	* sysdeps/sparc/sparc64/multiarch/memset.c: Likewise.
    	* sysdeps/sparc/sparc32/sparcv9/multiarch/memset.S: Remove file.
    	* sysdeps/sparc/sparc64/multiarch/memset.S: Likewise.

diff --git a/ChangeLog b/ChangeLog
index 96d8b66..968b1e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile
+	[$(subdir) = string] (sysdep_routines): Add memset-ultra1.
+	* sysdeps/sparc/sparc64/multiarch/Makefile [$(subdir) = string]
+	(sysdep_routines): Add memset-ultra1.
+	* sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S: New
+	file.
+	* sysdeps/sparc/sparc32/sparcv9/multiarch/memset.c: Likewise.
+	* sysdeps/sparc/sparc64/multiarch/ifunc-memset.h: Likewise.
+	* sysdeps/sparc/sparc64/multiarch/memset-ultra1.S: Likewise.
+	* sysdeps/sparc/sparc64/multiarch/memset.c: Likewise.
+	* sysdeps/sparc/sparc32/sparcv9/multiarch/memset.S: Remove file.
+	* sysdeps/sparc/sparc64/multiarch/memset.S: Likewise.
+
 	* sysdeps/sparc/init-arch.h: Likewise.
 	* sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy-ultra1.S: New
 	file.
diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile b/sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile
index ca44798..e12636b 100644
--- a/sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile
+++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile
@@ -9,5 +9,5 @@ endif
 ifeq ($(subdir),string)
 sysdep_routines += memcpy-ultra3 memcpy-niagara1 memcpy-niagara2 \
 		   memset-niagara1 memcpy-niagara4 memset-niagara4 \
-		   memcpy-ultra1
+		   memcpy-ultra1 memset-ultra1
 endif
diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
new file mode 100644
index 0000000..4a5508d
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
@@ -0,0 +1,33 @@
+/* Default SPARC64 memset 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
+   <http://www.gnu.org/licenses/>.  */
+
+#if IS_IN (libc)
+
+# include <sysdep.h>
+
+# undef libc_hidden_builtin_def
+# define libc_hidden_builtin_def(name)
+# undef weak_alias
+# define weak_alias(x, y)
+
+# define memset __memset_ultra1
+# define __bzero __bzero_ultra1
+
+#endif
+
+#include <sysdeps/sparc/sparc32/sparcv9/memset.S>
diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset.S b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset.S
deleted file mode 100644
index 8f82643..0000000
--- a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset.S
+++ /dev/null
@@ -1,4 +0,0 @@
-#define ASI_PNF     0x82
-#define ASI_BLK_P   0xf0
-#define XCC icc
-#include <sparc64/multiarch/memset.S>
diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset.c b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset.c
new file mode 100644
index 0000000..a6c5734
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset.c
@@ -0,0 +1 @@
+#include <sysdeps/sparc/sparc64/multiarch/memset.c>
diff --git a/sysdeps/sparc/sparc64/multiarch/Makefile b/sysdeps/sparc/sparc64/multiarch/Makefile
index 4e52526..6e90cba 100644
--- a/sysdeps/sparc/sparc64/multiarch/Makefile
+++ b/sysdeps/sparc/sparc64/multiarch/Makefile
@@ -9,7 +9,7 @@ endif
 ifeq ($(subdir),string)
 sysdep_routines += memcpy-ultra3 memcpy-niagara1 memcpy-niagara2 \
 		   memset-niagara1 memcpy-niagara4 memset-niagara4 \
-		   memcpy-ultra1
+		   memcpy-ultra1 memset-ultra1
 endif
 
 ifeq ($(subdir),stdlib)
diff --git a/sysdeps/sparc/sparc64/multiarch/ifunc-memset.h b/sysdeps/sparc/sparc64/multiarch/ifunc-memset.h
new file mode 100644
index 0000000..eaf0fb8
--- /dev/null
+++ b/sysdeps/sparc/sparc64/multiarch/ifunc-memset.h
@@ -0,0 +1,34 @@
+/* Common definition for memset/bzero 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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <init-arch.h>
+
+extern __typeof (REDIRECT_NAME) OPTIMIZE (niagara4) attribute_hidden;
+extern __typeof (REDIRECT_NAME) OPTIMIZE (niagara1) 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_BLKINIT)
+    return OPTIMIZE (niagara1);
+  return OPTIMIZE (ultra1);
+}
diff --git a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
new file mode 100644
index 0000000..728c179
--- /dev/null
+++ b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
@@ -0,0 +1,33 @@
+/* Default SPARC64 memset 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
+   <http://www.gnu.org/licenses/>.  */
+
+#if IS_IN (libc)
+
+# include <sysdep.h>
+
+# undef libc_hidden_builtin_def
+# define libc_hidden_builtin_def(name)
+# undef weak_alias
+# define weak_alias(x, y)
+
+# define memset __memset_ultra1
+# define __bzero __bzero_ultra1
+
+#endif
+
+#include <sysdeps/sparc/sparc64/memset.S>
diff --git a/sysdeps/sparc/sparc64/multiarch/memset.S b/sysdeps/sparc/sparc64/multiarch/memset.S
deleted file mode 100644
index 9469d5e..0000000
--- a/sysdeps/sparc/sparc64/multiarch/memset.S
+++ /dev/null
@@ -1,124 +0,0 @@
-/* Multiple versions of memset and bzero
-   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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-
-#if IS_IN (libc)
-	.text
-ENTRY(memset)
-	.type	memset, @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_BLKINIT, %g0
-# ifdef SHARED
-	sethi	%gdop_hix22(__memset_niagara4), %o1
-	xor	%o1, %gdop_lox10(__memset_niagara4), %o1
-# else
-	set	__memset_niagara4, %o1
-# endif
-	ba	10f
-	 nop
-1:	be	9f
-	 nop
-# ifdef SHARED
-	sethi	%gdop_hix22(__memset_niagara1), %o1
-	xor	%o1, %gdop_lox10(__memset_niagara1), %o1
-# else
-	set	__memset_niagara1, %o1
-# endif
-	ba	10f
-	 nop
-9:
-# ifdef SHARED
-	sethi	%gdop_hix22(__memset_ultra1), %o1
-	xor	%o1, %gdop_lox10(__memset_ultra1), %o1
-# else
-	set	__memset_ultra1, %o1
-# endif
-10:
-# ifdef SHARED
-	add	%o3, %o1, %o1
-# endif
-	retl
-	 mov	%o1, %o0
-END(memset)
-
-ENTRY(__bzero)
-	.type	bzero, @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_BLKINIT, %g0
-# ifdef SHARED
-	sethi	%gdop_hix22(__bzero_niagara4), %o1
-	xor	%o1, %gdop_lox10(__bzero_niagara4), %o1
-# else
-	set	__bzero_niagara4, %o1
-# endif
-	ba	10f
-	 nop
-1:	be	9f
-	 nop
-# ifdef SHARED
-	sethi	%gdop_hix22(__bzero_niagara1), %o1
-	xor	%o1, %gdop_lox10(__bzero_niagara1), %o1
-# else
-	set	__bzero_niagara1, %o1
-# endif
-	ba	10f
-	 nop
-9:
-# ifdef SHARED
-	sethi	%gdop_hix22(__bzero_ultra1), %o1
-	xor	%o1, %gdop_lox10(__bzero_ultra1), %o1
-# else
-	set	__bzero_ultra1, %o1
-# endif
-10:
-# ifdef SHARED
-	add	%o3, %o1, %o1
-# endif
-	retl
-	 mov	%o1, %o0
-END(__bzero)
-
-weak_alias (__bzero, bzero)
-
-# undef weak_alias
-# define weak_alias(a, b)
-
-libc_hidden_builtin_def (memset)
-
-#undef libc_hidden_builtin_def
-#define libc_hidden_builtin_def(name)
-
-#define memset __memset_ultra1
-#define __bzero __bzero_ultra1
-
-#endif
-
-#include "../memset.S"
diff --git a/sysdeps/sparc/sparc64/multiarch/memset.c b/sysdeps/sparc/sparc64/multiarch/memset.c
new file mode 100644
index 0000000..7f1d499
--- /dev/null
+++ b/sysdeps/sparc/sparc64/multiarch/memset.c
@@ -0,0 +1,49 @@
+/* Multiple versions of memset.
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#if IS_IN (libc)
+# define memset __redirect_memset
+# define bzero __redirect_bzero
+# include <string.h>
+# undef memset
+# undef bzero
+
+# include <sparc-ifunc.h>
+
+# define SYMBOL_NAME memset
+# include "ifunc-memset.h"
+
+sparc_libc_ifunc_redirected (__redirect_memset, memset, IFUNC_SELECTOR);
+
+/* It essentially does libc_hidden_builtin_def (memset) and redirect
+   the internal symbol to ifunc implementation.  */
+# ifdef SHARED
+__hidden_ver1 (memset, __GI_memset, __redirect_memset)
+  __attribute__ ((visibility ("hidden")));
+# endif
+# undef SYMBOL_NAME
+
+
+# define SYMBOL_NAME bzero
+# include "ifunc-memset.h"
+
+sparc_libc_ifunc_redirected (__redirect_bzero, __bzero, IFUNC_SELECTOR);
+weak_alias (__bzero, bzero)
+
+#endif

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=4d1e6713940a7367dd6400bfdd43783da649dfef

commit 4d1e6713940a7367dd6400bfdd43783da649dfef
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Oct 3 00:48:27 2017 -0300

    sparc: Implement memcpy/mempcpy ifunc selection in C
    
    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/init-arch.h: Likewise.
    	* 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.

diff --git a/ChangeLog b/ChangeLog
index 8beae99..96d8b66 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,25 @@
 2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* sysdeps/sparc/init-arch.h: Likewise.
+	* 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.
+
 	* configure.ac (multi_arch): Use 'yes' as default value.
 	(libc_cv_gcc_incompatbile_alias): New define: indicates whether
 	compiler emits an warning for alias for functions with
diff --git a/sysdeps/sparc/init-arch.h b/sysdeps/sparc/init-arch.h
new file mode 100644
index 0000000..30972cd
--- /dev/null
+++ b/sysdeps/sparc/init-arch.h
@@ -0,0 +1,23 @@
+/* IFUNC common definition for SPARC64.
+   This file is part of the GNU C Library.
+   Copyright (C) 2017 Free Software Foundation, Inc.
+
+   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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sys/auxv.h>
+#include <ldsodefs.h>
+
+#define INIT_ARCH()
+#include <ifunc-init.h>
diff --git a/sysdeps/sparc/sparc-ifunc.h b/sysdeps/sparc/sparc-ifunc.h
index 4b1ea00..3d81b52 100644
--- a/sysdeps/sparc/sparc-ifunc.h
+++ b/sysdeps/sparc/sparc-ifunc.h
@@ -162,6 +162,9 @@ END (__##name)
 
 #else	/* __ASSEMBLER__ */
 
+# 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)
 
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..b56438d
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy-ultra1.S
@@ -0,0 +1,35 @@
+/* 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
+   <http://www.gnu.org/licenses/>.  */
+
+#if IS_IN (libc)
+
+# include <sysdep.h>
+
+# 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 <sysdeps/sparc/sparc32/sparcv9/memcpy.S>
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 <sparc64/multiarch/memcpy.S>
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 <sysdeps/sparc/sparc64/multiarch/memcpy.c>
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 <sysdeps/sparc/sparc64/multiarch/mempcpy.c>
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..f497108
--- /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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <init-arch.h>
+
+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..1a0aaf3
--- /dev/null
+++ b/sysdeps/sparc/sparc64/multiarch/memcpy-ultra1.S
@@ -0,0 +1,35 @@
+/* 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
+   <http://www.gnu.org/licenses/>.  */
+
+#if IS_IN (libc)
+
+# include <sysdep.h>
+
+# 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 <sysdeps/sparc/sparc64/memcpy.S>
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
-   <http://www.gnu.org/licenses/>.  */
-
-#include <sysdep.h>
-
-#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..2c3d3f3
--- /dev/null
+++ b/sysdeps/sparc/sparc64/multiarch/memcpy.c
@@ -0,0 +1,38 @@
+/* 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
+   <http://www.gnu.org/licenses/>.  */
+
+#if IS_IN (libc)
+# define memcpy __redirect_memcpy
+# include <string.h>
+# undef memcpy
+
+# include <sparc-ifunc.h>
+
+# define SYMBOL_NAME memcpy
+# include "ifunc-memcpy.h"
+
+sparc_libc_ifunc_redirected (__redirect_memcpy, memcpy, IFUNC_SELECTOR);
+
+/* It essentially does libc_hidden_builtin_def (memcpy) and redirect
+   the internal symbol to ifunc implementation.  */
+# ifdef SHARED
+__hidden_ver1 (memcpy, __GI_memcpy, __redirect_memcpy)
+  __attribute__ ((visibility ("hidden")));
+# endif
+#endif
diff --git a/sysdeps/sparc/sparc64/multiarch/mempcpy.c b/sysdeps/sparc/sparc64/multiarch/mempcpy.c
new file mode 100644
index 0000000..f52dca6
--- /dev/null
+++ b/sysdeps/sparc/sparc64/multiarch/mempcpy.c
@@ -0,0 +1,47 @@
+/* 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
+   <http://www.gnu.org/licenses/>.  */
+
+#if IS_IN (libc)
+# define mempcpy __redirect_mempcpy
+# define __mempcpy __redirect___mempcpy
+# define NO_MEMPCPY_STPCPY_REDIRECT
+# define __NO_STRING_INLINES
+# include <string.h>
+# undef mempcpy
+# undef __mempcpy
+
+# include <sparc-ifunc.h>
+
+# define SYMBOL_NAME mempcpy
+# include "ifunc-memcpy.h"
+
+sparc_libc_ifunc_redirected (__redirect_mempcpy, __mempcpy, IFUNC_SELECTOR);
+
+weak_alias (__mempcpy, mempcpy)
+
+/* It essentially does libc_hidden_builtin_def (mempcpy) and
+   and libc_hidden_def (__mempcpy) and redirects the internal symbol to
+   ifunc implementation.  */
+# ifdef SHARED
+__hidden_ver1 (__mempcpy, __GI___mempcpy, __redirect___mempcpy)
+  __attribute__ ((visibility ("hidden")));
+__hidden_ver1 (mempcpy, __GI_mempcpy, __redirect_mempcpy)
+  __attribute__ ((visibility ("hidden")));
+# endif
+#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.  */

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=90fb6eaf6da14a6cf5987798ad3c30df07942c7f

commit 90fb6eaf6da14a6cf5987798ad3c30df07942c7f
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Oct 10 11:12:50 2017 -0300

    Avoid build multiarch if compiler warns about mismatched alias
    
    GCC 8 emits an warning for alias for functions with incompatible types
    and it is used extensivelly for ifunc resolvers implementations in C
    (for instance on weak_alias with the internal symbol name to the
    external one or with the libc_hidden_def to set ifunc for internal
    usage).
    
    This breaks the build when the ifunc resolver is not defined using
    gcc attribute extensions (HAVE_GCC_IFUNC being 0).  Although for
    all currently architectures that have multiarch support this compiler
    options is enabled for default, there is still the option where the
    user might try build glibc with a compiler without support for such
    extension.  In this case this patch just disable the multiarch folder
    in sysdeps selections.
    
    GCC 7 and before still builds IFUNCs regardless of compiler support
    (although for the lack of attribute support debug information would
    be optimal).
    
    The patch also fixes the default value of the multiarch support in
    configure.ac (the correct value which is tested later in the script
    assumer 'yes' instead of 'default').
    
    Checked with a build on multiarch support architectures (aarch64,a
    arm, sparc, s390, powerpc, x86_64, i386) with multiarch enable
    and disable and with GCC 7 and GCC 8.
    
    	* configure.ac (multi_arch): Use 'yes' as default value.
    	(libc_cv_gcc_incompatbile_alias): New define: indicates whether
    	compiler emits an warning for alias for functions with
    	incompatible types.

diff --git a/ChangeLog b/ChangeLog
index e3f0faa..8beae99 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-10-17  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
+
+	* configure.ac (multi_arch): Use 'yes' as default value.
+	(libc_cv_gcc_incompatbile_alias): New define: indicates whether
+	compiler emits an warning for alias for functions with
+	incompatible types.
+
 2017-10-17  Romain Naour  <romain.naour@gmail.com>  (tiny change)
 
 	[BZ #22296]
diff --git a/configure b/configure
index c2c9c72..04d4ecf 100755
--- a/configure
+++ b/configure
@@ -3508,7 +3508,7 @@ fi
 if test "${enable_multi_arch+set}" = set; then :
   enableval=$enable_multi_arch; multi_arch=$enableval
 else
-  multi_arch=default
+  multi_arch=yes
 fi
 
 
@@ -3996,6 +3996,32 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_gcc_indirect_function" >&5
 $as_echo "$libc_cv_gcc_indirect_function" >&6; }
 
+# Check if gcc warns about alias for function with incompatible types.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler warns about alias for function with incompatible types" >&5
+$as_echo_n "checking if compiler warns about alias for function with incompatible types... " >&6; }
+if ${libc_cv_gcc_incompatible_alias+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.c <<EOF
+int __redirect_foo (const void *s, int c);
+
+__typeof (__redirect_foo) *foo_impl (void) __asm__ ("foo");
+__typeof (__redirect_foo) *foo_impl (void)
+{
+  return 0;
+}
+
+extern __typeof (__redirect_foo) foo_alias __attribute__ ((alias ("foo")));
+EOF
+libc_cv_gcc_incompatible_alias=yes
+if ${CC-cc} -Werror -c conftest.c -o conftest.o 1>&5 2>&5 ; then
+  libc_cv_gcc_incompatible_alias=no
+fi
+rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_gcc_incompatible_alias" >&5
+$as_echo "$libc_cv_gcc_incompatible_alias" >&6; }
+
 if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
   if test x"$multi_arch" = xyes; then
     as_fn_error $? "--enable-multi-arch support requires assembler and linker support" "$LINENO" 5
@@ -4009,6 +4035,16 @@ if test x"$libc_cv_gcc_indirect_function" != xyes &&
 Please use a gcc which supports it by default or configure gcc with --enable-gnu-indirect-function" >&5
 $as_echo "$as_me: WARNING: --enable-multi-arch support recommends a gcc with gnu-indirect-function support.
 Please use a gcc which supports it by default or configure gcc with --enable-gnu-indirect-function" >&2;}
+  # GCC 8+ emits and warning for alias with incompatible types and it might
+  # fail to to build ifunc resolvers aliases to either weak or internal
+  # symbols.  Disables multiarch build in this case.
+  if test x"$libc_cv_gcc_incompatible_alias" == xyes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: gcc emits a warning for alias between functions of incompatible types.
+Multi-arch is disabled. " >&5
+$as_echo "$as_me: WARNING: gcc emits a warning for alias between functions of incompatible types.
+Multi-arch is disabled. " >&2;}
+    multi_arch=no
+  fi
 fi
 multi_arch_d=
 if test x"$multi_arch" != xno; then
diff --git a/configure.ac b/configure.ac
index 195e81a..a1387ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -304,7 +304,7 @@ AC_ARG_ENABLE([multi-arch],
 	      AC_HELP_STRING([--enable-multi-arch],
 			     [enable single DSO with optimizations for multiple architectures]),
 	      [multi_arch=$enableval],
-	      [multi_arch=default])
+	      [multi_arch=yes])
 
 AC_ARG_ENABLE([experimental-malloc],
 	      AC_HELP_STRING([--disable-experimental-malloc],
@@ -634,6 +634,26 @@ if ${CC-cc} -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD \
 fi
 rm -f conftest*])
 
+# Check if gcc warns about alias for function with incompatible types.
+AC_CACHE_CHECK([if compiler warns about alias for function with incompatible types],
+	       libc_cv_gcc_incompatible_alias, [dnl
+cat > conftest.c <<EOF
+int __redirect_foo (const void *s, int c);
+
+__typeof (__redirect_foo) *foo_impl (void) __asm__ ("foo");
+__typeof (__redirect_foo) *foo_impl (void)
+{
+  return 0;
+}
+
+extern __typeof (__redirect_foo) foo_alias __attribute__ ((alias ("foo")));
+EOF
+libc_cv_gcc_incompatible_alias=yes
+if ${CC-cc} -Werror -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
+  libc_cv_gcc_incompatible_alias=no
+fi
+rm -f conftest*])
+
 if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
   if test x"$multi_arch" = xyes; then
     AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
@@ -645,6 +665,14 @@ if test x"$libc_cv_gcc_indirect_function" != xyes &&
    test x"$multi_arch" = xyes; then
   AC_MSG_WARN([--enable-multi-arch support recommends a gcc with gnu-indirect-function support.
 Please use a gcc which supports it by default or configure gcc with --enable-gnu-indirect-function])
+  # GCC 8+ emits and warning for alias with incompatible types and it might
+  # fail to to build ifunc resolvers aliases to either weak or internal
+  # symbols.  Disables multiarch build in this case.
+  if test x"$libc_cv_gcc_incompatible_alias" == xyes; then
+    AC_MSG_WARN([gcc emits a warning for alias between functions of incompatible types.
+Multi-arch is disabled. ])
+    multi_arch=no
+  fi
 fi
 multi_arch_d=
 if test x"$multi_arch" != xno; then

-----------------------------------------------------------------------


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]