Patchwork [5/6] PowerPC64 ENTRY_TOCLESS

login
register
mail settings
Submitter Alan Modra
Date June 1, 2017, 1:10 p.m.
Message ID <20170601131055.GK8842@bubble.grove.modra.org>
Download mbox | patch
Permalink /patch/20668/
State Committed
Delegated to: Tulio Magno Quites Machado Filho
Headers show

Comments

Alan Modra - June 1, 2017, 1:10 p.m.
A number of functions in the sysdeps/powerpc/powerpc64/ tree don't use
or change r2, yet declare a global entry that sets up r2.  This patch
fixes that problem, and consolidates the ENTRY and EALIGN macros.

	* sysdeps/powerpc/powerpc64/sysdep.h: Formatting.
	(NOPS, ENTRY_3): New macros.
	(ENTRY): Rewrite.
	(ENTRY_TOCLESS): Define.
	(EALIGN, EALIGN_W_0, EALIGN_W_1, EALIGN_W_2, EALIGN_W_4, EALIGN_W_5,
	EALIGN_W_6, EALIGN_W_7, EALIGN_W_8): Delete.
	* sysdeps/powerpc/powerpc64/a2/memcpy.S: Replace EALIGN with ENTRY.
	* sysdeps/powerpc/powerpc64/dl-trampoline.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_floor.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_rint.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_round.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Likewise.
	* sysdeps/powerpc/powerpc64/memset.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strstr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_cosf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_sinf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strcasestr.S: Likewise.
	* sysdeps/powerpc/powerpc64/addmul_1.S: Use ENTRY_TOCLESS.
	* sysdeps/powerpc/powerpc64/cell/memcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_copysignl.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_fabsl.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_llrintf.S: Likewise.
	* sysdeps/powerpc/powerpc64/lshift.S: Likewise.
	* sysdeps/powerpc/powerpc64/memcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/mul_1.S: Likewise.
	* sysdeps/powerpc/powerpc64/power4/memcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power4/memcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power4/memset.S: Likewise.
	* sysdeps/powerpc/powerpc64/power4/strncmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6/memcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6/memset.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/add_n.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memmove.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/mempcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memrchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memset.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/rawmemchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strcasecmp.S (strcasecmp_l):
	Likewise.
	* sysdeps/powerpc/powerpc64/power7/strchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strchrnul.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strlen.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strncpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strnlen.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strrchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/memcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/memset.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strlen.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strncmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strncpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strnlen.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strrchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strspn.S: Likewise.
	* sysdeps/powerpc/powerpc64/power9/strcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power9/strncmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/strchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/strcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/strlen.S: Likewise.
	* sysdeps/powerpc/powerpc64/strncmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/ppc-mcount.S: Store LR earlier.  Don't
	add nop when SHARED.
	* sysdeps/powerpc/powerpc64/start.S: Fix comment.
	* sysdeps/powerpc/powerpc64/multiarch/strrchr-power8.S (ENTRY): Don't
	define.
	(ENTRY_TOCLESS): Define.
Tulio Magno Quites Machado Filho - June 13, 2017, 12:23 p.m.
Alan Modra <amodra@gmail.com> writes:

> A number of functions in the sysdeps/powerpc/powerpc64/ tree don't use
> or change r2, yet declare a global entry that sets up r2.  This patch
> fixes that problem, and consolidates the ENTRY and EALIGN macros.
>
> 	* sysdeps/powerpc/powerpc64/sysdep.h: Formatting.
> 	(NOPS, ENTRY_3): New macros.
> 	(ENTRY): Rewrite.
> 	(ENTRY_TOCLESS): Define.
> 	(EALIGN, EALIGN_W_0, EALIGN_W_1, EALIGN_W_2, EALIGN_W_4, EALIGN_W_5,
> 	EALIGN_W_6, EALIGN_W_7, EALIGN_W_8): Delete.
> 	* sysdeps/powerpc/powerpc64/a2/memcpy.S: Replace EALIGN with ENTRY.
> 	* sysdeps/powerpc/powerpc64/dl-trampoline.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/fpu/s_floor.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/fpu/s_rint.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/fpu/s_round.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/memset.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/strstr.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power8/fpu/s_cosf.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power8/fpu/s_sinf.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power8/strcasestr.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/addmul_1.S: Use ENTRY_TOCLESS.
> 	* sysdeps/powerpc/powerpc64/cell/memcpy.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/fpu/s_copysignl.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/fpu/s_fabsl.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/fpu/s_isnan.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/fpu/s_llrintf.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/lshift.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/memcpy.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/mul_1.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power4/memcmp.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power4/memcpy.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power4/memset.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power4/strncmp.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power6/memcpy.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power6/memset.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/add_n.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/memchr.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/memcmp.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/memcpy.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/memmove.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/mempcpy.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/memrchr.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/memset.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/rawmemchr.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/strcasecmp.S (strcasecmp_l):
> 	Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/strchr.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/strchrnul.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/strcmp.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/strlen.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/strncpy.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/strnlen.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power7/strrchr.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power8/memcmp.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power8/memset.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power8/strchr.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power8/strcmp.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power8/strcpy.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power8/strlen.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power8/strncmp.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power8/strncpy.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power8/strnlen.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power8/strrchr.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power8/strspn.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power9/strcmp.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/power9/strncmp.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/strchr.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/strcmp.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/strlen.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/strncmp.S: Likewise.
> 	* sysdeps/powerpc/powerpc64/ppc-mcount.S: Store LR earlier.  Don't
> 	add nop when SHARED.
> 	* sysdeps/powerpc/powerpc64/start.S: Fix comment.
> 	* sysdeps/powerpc/powerpc64/multiarch/strrchr-power8.S (ENTRY): Don't
> 	define.
> 	(ENTRY_TOCLESS): Define.

There are 2 more functions that could benefit from this optimization as well:
 - sysdeps/powerpc/fpu/s_fmaf.S
 - sysdeps/powerpc/fpu/s_fma.S

Notice they're reused in powerpc32.

> diff --git a/sysdeps/powerpc/powerpc64/power8/strcasestr.S b/sysdeps/powerpc/powerpc64/power8/strcasestr.S
> index 6ac6572..3f59cb0 100644
> --- a/sysdeps/powerpc/powerpc64/power8/strcasestr.S
> +++ b/sysdeps/powerpc/powerpc64/power8/strcasestr.S
> @@ -85,7 +85,7 @@
>  /* TODO: change this to .machine power8 when the minimum required binutils
>     allows it.  */
>  	.machine  power7
> -EALIGN (STRCASESTR, 4, 0)
> +ENTRY (STRCASESTR, 4)
>  	CALL_MCOUNT 2
>  	mflr	r0			/* Load link register LR to r0.  */
>  	std	r31, -8(r1)		/* Save callers register r31.  */


Isn't it safe to use ENTRY_TOCLESS here too?
Alan Modra - June 13, 2017, 2:46 p.m.
On Tue, Jun 13, 2017 at 09:23:12AM -0300, Tulio Magno Quites Machado Filho wrote:
> Alan Modra <amodra@gmail.com> writes:
> 
> > A number of functions in the sysdeps/powerpc/powerpc64/ tree don't use
> > or change r2, yet declare a global entry that sets up r2.  This patch
> > fixes that problem, and consolidates the ENTRY and EALIGN macros.
> >
> > 	* sysdeps/powerpc/powerpc64/sysdep.h: Formatting.
> > 	(NOPS, ENTRY_3): New macros.
> > 	(ENTRY): Rewrite.
> > 	(ENTRY_TOCLESS): Define.
> > 	(EALIGN, EALIGN_W_0, EALIGN_W_1, EALIGN_W_2, EALIGN_W_4, EALIGN_W_5,
> > 	EALIGN_W_6, EALIGN_W_7, EALIGN_W_8): Delete.
> > 	* sysdeps/powerpc/powerpc64/a2/memcpy.S: Replace EALIGN with ENTRY.
> > 	* sysdeps/powerpc/powerpc64/dl-trampoline.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/fpu/s_floor.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/fpu/s_rint.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/fpu/s_round.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/memset.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/strstr.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power8/fpu/s_cosf.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power8/fpu/s_sinf.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power8/strcasestr.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/addmul_1.S: Use ENTRY_TOCLESS.
> > 	* sysdeps/powerpc/powerpc64/cell/memcpy.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/fpu/s_copysignl.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/fpu/s_fabsl.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/fpu/s_isnan.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/fpu/s_llrintf.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/lshift.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/memcpy.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/mul_1.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power4/memcmp.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power4/memcpy.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power4/memset.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power4/strncmp.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power6/memcpy.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power6/memset.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/add_n.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/memchr.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/memcmp.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/memcpy.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/memmove.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/mempcpy.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/memrchr.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/memset.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/rawmemchr.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/strcasecmp.S (strcasecmp_l):
> > 	Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/strchr.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/strchrnul.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/strcmp.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/strlen.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/strncpy.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/strnlen.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power7/strrchr.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power8/memcmp.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power8/memset.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power8/strchr.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power8/strcmp.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power8/strcpy.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power8/strlen.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power8/strncmp.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power8/strncpy.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power8/strnlen.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power8/strrchr.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power8/strspn.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power9/strcmp.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/power9/strncmp.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/strchr.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/strcmp.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/strlen.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/strncmp.S: Likewise.
> > 	* sysdeps/powerpc/powerpc64/ppc-mcount.S: Store LR earlier.  Don't
> > 	add nop when SHARED.
> > 	* sysdeps/powerpc/powerpc64/start.S: Fix comment.
> > 	* sysdeps/powerpc/powerpc64/multiarch/strrchr-power8.S (ENTRY): Don't
> > 	define.
> > 	(ENTRY_TOCLESS): Define.
> 
> There are 2 more functions that could benefit from this optimization as well:
>  - sysdeps/powerpc/fpu/s_fmaf.S
>  - sysdeps/powerpc/fpu/s_fma.S
> 
> Notice they're reused in powerpc32.

I see.  I hadn't looked for included files.  This will mean modifying
powerpc32/sysdep.h to add

#define ENTRY_TOCLESS(name) ENTRY(name)

> 
> > diff --git a/sysdeps/powerpc/powerpc64/power8/strcasestr.S b/sysdeps/powerpc/powerpc64/power8/strcasestr.S
> > index 6ac6572..3f59cb0 100644
> > --- a/sysdeps/powerpc/powerpc64/power8/strcasestr.S
> > +++ b/sysdeps/powerpc/powerpc64/power8/strcasestr.S
> > @@ -85,7 +85,7 @@
> >  /* TODO: change this to .machine power8 when the minimum required binutils
> >     allows it.  */
> >  	.machine  power7
> > -EALIGN (STRCASESTR, 4, 0)
> > +ENTRY (STRCASESTR, 4)
> >  	CALL_MCOUNT 2
> >  	mflr	r0			/* Load link register LR to r0.  */
> >  	std	r31, -8(r1)		/* Save callers register r31.  */
> 
> 
> Isn't it safe to use ENTRY_TOCLESS here too?

No, the code uses @got@tprel(r2).
Tulio Magno Quites Machado Filho - June 13, 2017, 5:07 p.m.
Alan Modra <amodra@gmail.com> writes:

> On Tue, Jun 13, 2017 at 09:23:12AM -0300, Tulio Magno Quites Machado Filho wrote:
>> Alan Modra <amodra@gmail.com> writes:
>> 
>> There are 2 more functions that could benefit from this optimization as well:
>>  - sysdeps/powerpc/fpu/s_fmaf.S
>>  - sysdeps/powerpc/fpu/s_fma.S
>> 
>> Notice they're reused in powerpc32.
>
> I see.  I hadn't looked for included files.  This will mean modifying
> powerpc32/sysdep.h to add
>
> #define ENTRY_TOCLESS(name) ENTRY(name)

Looks good to me.

>> > diff --git a/sysdeps/powerpc/powerpc64/power8/strcasestr.S b/sysdeps/powerpc/powerpc64/power8/strcasestr.S
>> > index 6ac6572..3f59cb0 100644
>> > --- a/sysdeps/powerpc/powerpc64/power8/strcasestr.S
>> > +++ b/sysdeps/powerpc/powerpc64/power8/strcasestr.S
>> > @@ -85,7 +85,7 @@
>> >  /* TODO: change this to .machine power8 when the minimum required binutils
>> >     allows it.  */
>> >  	.machine  power7
>> > -EALIGN (STRCASESTR, 4, 0)
>> > +ENTRY (STRCASESTR, 4)
>> >  	CALL_MCOUNT 2
>> >  	mflr	r0			/* Load link register LR to r0.  */
>> >  	std	r31, -8(r1)		/* Save callers register r31.  */
>> 
>> 
>> Isn't it safe to use ENTRY_TOCLESS here too?
>
> No, the code uses @got@tprel(r2).

Ack.

Thanks!

Patch

diff --git a/sysdeps/powerpc/powerpc64/a2/memcpy.S b/sysdeps/powerpc/powerpc64/a2/memcpy.S
index ff30898..26846dc 100644
--- a/sysdeps/powerpc/powerpc64/a2/memcpy.S
+++ b/sysdeps/powerpc/powerpc64/a2/memcpy.S
@@ -34,7 +34,7 @@ 
 
 
 	.machine  a2
-EALIGN (MEMCPY, 5, 0)
+ENTRY (MEMCPY, 5)
 	CALL_MCOUNT 3
 
 	dcbt    0,r4            /* Prefetch ONE SRC cacheline  */
diff --git a/sysdeps/powerpc/powerpc64/addmul_1.S b/sysdeps/powerpc/powerpc64/addmul_1.S
index b4b0521..f463765 100644
--- a/sysdeps/powerpc/powerpc64/addmul_1.S
+++ b/sysdeps/powerpc/powerpc64/addmul_1.S
@@ -34,7 +34,7 @@ 
 #define N   r5
 #define VL  r6
 
-EALIGN(FUNC, 5, 0)
+ENTRY_TOCLESS (FUNC, 5)
 	std	r31, -8(r1)
 	rldicl.	r0, N, 0, 62
 	std	r30, -16(r1)
diff --git a/sysdeps/powerpc/powerpc64/cell/memcpy.S b/sysdeps/powerpc/powerpc64/cell/memcpy.S
index 1cc6645..6e7f2b1 100644
--- a/sysdeps/powerpc/powerpc64/cell/memcpy.S
+++ b/sysdeps/powerpc/powerpc64/cell/memcpy.S
@@ -43,7 +43,7 @@ 
 
 .align  7
 
-EALIGN (MEMCPY, 5, 0)
+ENTRY_TOCLESS (MEMCPY, 5)
 	CALL_MCOUNT 3
 
 	dcbt	0,r4		/* Prefetch ONE SRC cacheline  */
diff --git a/sysdeps/powerpc/powerpc64/dl-trampoline.S b/sysdeps/powerpc/powerpc64/dl-trampoline.S
index 5ec729d..7ceb62b 100644
--- a/sysdeps/powerpc/powerpc64/dl-trampoline.S
+++ b/sysdeps/powerpc/powerpc64/dl-trampoline.S
@@ -33,7 +33,7 @@ 
    a function that makes no calls except for __tls_get_addr and we
    might be here resolving the __tls_get_addr call.  */
 #define INT_PARMS FRAME_MIN_SIZE
-EALIGN(_dl_runtime_resolve, 4, 0)
+ENTRY (_dl_runtime_resolve, 4)
 	stdu	r1,-FRAME_SIZE(r1)
 	cfi_adjust_cfa_offset (FRAME_SIZE)
 	std	r3,INT_PARMS+0(r1)
@@ -195,7 +195,7 @@  END(_dl_runtime_resolve)
    parm1 (r3) and the index (r0) needs to be converted to an offset
    (index * 24) in parm2 (r4).  */
 #ifndef PROF
-EALIGN(_dl_profile_resolve, 4, 0)
+ENTRY (_dl_profile_resolve, 4)
 /* Spill r30, r31 to preserve the link_map* and reloc_addr, in case we
    need to call _dl_call_pltexit.  */
 	std	r31,-8(r1)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_ceil.S b/sysdeps/powerpc/powerpc64/fpu/s_ceil.S
index 78d7fee..ce673e5 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_ceil.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_ceil.S
@@ -24,7 +24,7 @@ 
 	.tc FD_43300000_0[TC],0x4330000000000000
 	.section	".text"
 
-EALIGN (__ceil, 4, 0)
+ENTRY (__ceil, 4)
 	CALL_MCOUNT 0
 	lfd	fp13,.LC0@toc(2)
 	fabs	fp0,fp1
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S
index bc5ab02..ee62d8a 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S
@@ -25,7 +25,7 @@ 
 	.long 0x0
 	.section	".text"
 
-EALIGN (__ceilf, 4, 0)
+ENTRY (__ceilf, 4)
 	CALL_MCOUNT 0
 	lfs	fp13,.LC0@toc(2)
 	fabs	fp0,fp1
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_copysign.S b/sysdeps/powerpc/powerpc64/fpu/s_copysign.S
index 5947281..0dd9ce0 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_copysign.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_copysign.S
@@ -22,7 +22,7 @@ 
 #include <sysdep.h>
 #include <math_ldbl_opt.h>
 
-ENTRY(__copysign)
+ENTRY_TOCLESS (__copysign)
 	CALL_MCOUNT 0
 /* double [f1] copysign (double [f1] x, double [f2] y);
    copysign(x,y) returns a value with the magnitude of x and
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_copysignl.S b/sysdeps/powerpc/powerpc64/fpu/s_copysignl.S
index b33ea6e..ea0c248 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_copysignl.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_copysignl.S
@@ -20,7 +20,7 @@ 
 #include <sysdep.h>
 #include <math_ldbl_opt.h>
 
-ENTRY(__copysignl)
+ENTRY_TOCLESS (__copysignl)
 /* long double [f1,f2] copysign (long double [f1,f2] x, long double [f3,f4] y);
    copysign(x,y) returns a value with the magnitude of x and
    with the sign bit of y.  */
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_fabsl.S b/sysdeps/powerpc/powerpc64/fpu/s_fabsl.S
index 7603abb..b712e62 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_fabsl.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_fabsl.S
@@ -20,7 +20,7 @@ 
 #include <sysdep.h>
 #include <math_ldbl_opt.h>
 
-ENTRY(__fabsl)
+ENTRY_TOCLESS (__fabsl)
 /* long double [f1,f2] fabs (long double [f1,f2] x);
    fabs(x,y) returns a value with the magnitude of x and
    with the sign bit of y.  */
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_floor.S b/sysdeps/powerpc/powerpc64/fpu/s_floor.S
index 4a6cc0e..23cea2a 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_floor.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_floor.S
@@ -24,7 +24,7 @@ 
 	.tc FD_43300000_0[TC],0x4330000000000000
 	.section	".text"
 
-EALIGN (__floor, 4, 0)
+ENTRY (__floor, 4)
 	CALL_MCOUNT 0
 	lfd	fp13,.LC0@toc(2)
 	fabs	fp0,fp1
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_floorf.S b/sysdeps/powerpc/powerpc64/fpu/s_floorf.S
index d8b5e21..defcab4 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_floorf.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_floorf.S
@@ -25,7 +25,7 @@ 
 	.long 0x0
 	.section	".text"
 
-EALIGN (__floorf, 4, 0)
+ENTRY (__floorf, 4)
 	CALL_MCOUNT 0
 	lfs	fp13,.LC0@toc(2)
 	fabs	fp0,fp1
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_isnan.S b/sysdeps/powerpc/powerpc64/fpu/s_isnan.S
index 6cba2d4..0ea05a0 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_isnan.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_isnan.S
@@ -21,7 +21,7 @@ 
 
 /* int __isnan(x)  */
 	.machine power4
-EALIGN (__isnan, 4, 0)
+ENTRY_TOCLESS (__isnan, 4)
 	CALL_MCOUNT 0
 	mffs	fp0
 	mtfsb0	4*cr6+lt /* reset_fpscr_bit (FPSCR_VE) */
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llrint.S b/sysdeps/powerpc/powerpc64/fpu/s_llrint.S
index 39e7654..6893285 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_llrint.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_llrint.S
@@ -20,7 +20,7 @@ 
 #include <math_ldbl_opt.h>
 
 /* long long int[r3] __llrint (double x[fp1])  */
-ENTRY (__llrint)
+ENTRY_TOCLESS (__llrint)
 	CALL_MCOUNT 0
 	fctid	fp13,fp1
 	stfd	fp13,-16(r1)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S b/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S
index 4050be6..95d437e 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_llrintf.S
@@ -19,7 +19,7 @@ 
 #include <sysdep.h>
 
 /* long long int[r3] __llrintf (float x[fp1])  */
-ENTRY (__llrintf)
+ENTRY_TOCLESS (__llrintf)
 	CALL_MCOUNT 0
 	fctid	fp13,fp1
 	stfd	fp13,-16(r1)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S b/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S
index 3dcd04b..88ec253 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S
@@ -31,7 +31,7 @@ 
 	.tc FD_43300000_0[TC],0x4330000000000000
 	.section	".text"
 
-EALIGN (__nearbyint, 4, 0)
+ENTRY (__nearbyint, 4)
 	CALL_MCOUNT 0
 	fabs	fp0,fp1
 	lfd	fp13,.LC0@toc(2)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S b/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S
index 11be35f..36212e1 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S
@@ -32,7 +32,7 @@ 
 	.long 0x0
 	.section	".text"
 
-EALIGN (__nearbyintf, 4, 0)
+ENTRY (__nearbyintf, 4)
 	CALL_MCOUNT 0
 	fabs	fp0,fp1
 	lfs	fp13,.LC0@toc(2)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_rint.S b/sysdeps/powerpc/powerpc64/fpu/s_rint.S
index 7ba0adf..3543279 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_rint.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_rint.S
@@ -27,7 +27,7 @@ 
 	.tc FD_43300000_0[TC],0x4330000000000000
 	.section	".text"
 
-EALIGN (__rint, 4, 0)
+ENTRY (__rint, 4)
 	CALL_MCOUNT 0
 	lfd	fp13,.LC0@toc(2)
 	fabs	fp0,fp1
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_rintf.S b/sysdeps/powerpc/powerpc64/fpu/s_rintf.S
index b1d1e15..193cf81 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_rintf.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_rintf.S
@@ -25,7 +25,7 @@ 
 	.long 0x0
 	.section	".text"
 
-EALIGN (__rintf, 4, 0)
+ENTRY (__rintf, 4)
 	CALL_MCOUNT 0
 	lfs	fp13,.LC0@toc(2)
 	fabs	fp0,fp1
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_round.S b/sysdeps/powerpc/powerpc64/fpu/s_round.S
index fe315af..d10c74d 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_round.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_round.S
@@ -36,7 +36,7 @@ 
    "Round toward Zero" mode and round by adding +-0.5 before rounding
    to the integer value.  */
 
-EALIGN (__round, 4, 0)
+ENTRY (__round, 4)
 	CALL_MCOUNT 0
 	lfd	fp13,.LC0@toc(2)
 	fabs	fp0,fp1
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_roundf.S b/sysdeps/powerpc/powerpc64/fpu/s_roundf.S
index d213f43..18c39d5 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_roundf.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_roundf.S
@@ -37,7 +37,7 @@ 
    "Round toward Zero" mode and round by adding +-0.5 before rounding
    to the integer value.  */
 
-EALIGN (__roundf, 4, 0)
+ENTRY (__roundf, 4)
 	CALL_MCOUNT 0
 	lfs	fp13,.LC0@toc(2)
 	fabs	fp0,fp1
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_trunc.S b/sysdeps/powerpc/powerpc64/fpu/s_trunc.S
index 890eb21..1e356de 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_trunc.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_trunc.S
@@ -31,7 +31,7 @@ 
    We set "round toward Zero" mode and trunc by adding +-2**52 then
    subtracting +-2**52.  */
 
-EALIGN (__trunc, 4, 0)
+ENTRY (__trunc, 4)
 	CALL_MCOUNT 0
 	lfd	fp13,.LC0@toc(2)
 	fabs	fp0,fp1
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_truncf.S b/sysdeps/powerpc/powerpc64/fpu/s_truncf.S
index cfcff80..7d974f9 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_truncf.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_truncf.S
@@ -32,7 +32,7 @@ 
    We set "round toward Zero" mode and trunc by adding +-2**23 then
    subtracting +-2**23.  */
 
-EALIGN (__truncf, 4, 0)
+ENTRY (__truncf, 4)
 	CALL_MCOUNT 0
 	lfs	fp13,.LC0@toc(2)
 	fabs	fp0,fp1
diff --git a/sysdeps/powerpc/powerpc64/lshift.S b/sysdeps/powerpc/powerpc64/lshift.S
index 480e386..e11b85d 100644
--- a/sysdeps/powerpc/powerpc64/lshift.S
+++ b/sysdeps/powerpc/powerpc64/lshift.S
@@ -28,7 +28,7 @@ 
 #define U1      r31
 #define RETVAL   r5
 
-EALIGN(__mpn_lshift, 5, 0)
+ENTRY_TOCLESS (__mpn_lshift, 5)
 	std	U1, -8(r1)
 	std	U0, -16(r1)
 	subfic	TNC, CNT, 64
diff --git a/sysdeps/powerpc/powerpc64/memcpy.S b/sysdeps/powerpc/powerpc64/memcpy.S
index a4c82c3..b6a1105 100644
--- a/sysdeps/powerpc/powerpc64/memcpy.S
+++ b/sysdeps/powerpc/powerpc64/memcpy.S
@@ -37,7 +37,7 @@ 
 # define MEMCPY memcpy
 #endif
 
-EALIGN (MEMCPY, 5, 0)
+ENTRY_TOCLESS (MEMCPY, 5)
 	CALL_MCOUNT 3
 
     cmpldi cr1,5,31
diff --git a/sysdeps/powerpc/powerpc64/memset.S b/sysdeps/powerpc/powerpc64/memset.S
index f6581b5..34db4d7 100644
--- a/sysdeps/powerpc/powerpc64/memset.S
+++ b/sysdeps/powerpc/powerpc64/memset.S
@@ -35,7 +35,7 @@ 
 # define MEMSET memset
 #endif
 
-EALIGN (MEMSET, 5, 0)
+ENTRY (MEMSET, 5)
 	CALL_MCOUNT 3
 
 #define rTMP	r0
diff --git a/sysdeps/powerpc/powerpc64/mul_1.S b/sysdeps/powerpc/powerpc64/mul_1.S
index 68e85cb..f379180 100644
--- a/sysdeps/powerpc/powerpc64/mul_1.S
+++ b/sysdeps/powerpc/powerpc64/mul_1.S
@@ -24,7 +24,7 @@ 
 #define N   r5
 #define VL  r6
 
-EALIGN(__mpn_mul_1, 5, 0)
+ENTRY_TOCLESS (__mpn_mul_1, 5)
 	std	r27, -40(r1)
 	std	r26, -48(r1)
 	li	r12, 0
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strrchr-power8.S b/sysdeps/powerpc/powerpc64/multiarch/strrchr-power8.S
index a895dc6..2b2b1de 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strrchr-power8.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/strrchr-power8.S
@@ -18,14 +18,17 @@ 
 
 #include <sysdep.h>
 
-#undef ENTRY
-#define ENTRY(name)						\
-  .section ".text";						\
-  ENTRY_2(__strrchr_power8);					\
-  .align ALIGNARG(2);						\
-  BODY_LABEL(__strrchr_power8):					\
-  cfi_startproc;						\
-  LOCALENTRY(__strrchr_power8)
+#undef ENTRY_TOCLESS
+#ifndef PROF
+#define ENTRY_TOCLESS(name, ...)				\
+	ENTRY_3 __strrchr_power8, ## __VA_ARGS__;		\
+	cfi_startproc
+#else
+#define ENTRY_TOCLESS(name, ...)				\
+	ENTRY_3 __strrchr_power8, ## __VA_ARGS__;		\
+	cfi_startproc;						\
+	LOCALENTRY(__strrchr_power8)
+#endif
 
 #undef END
 #define END(name)						\
diff --git a/sysdeps/powerpc/powerpc64/power4/memcmp.S b/sysdeps/powerpc/powerpc64/power4/memcmp.S
index 6ca98e9..c366801 100644
--- a/sysdeps/powerpc/powerpc64/power4/memcmp.S
+++ b/sysdeps/powerpc/powerpc64/power4/memcmp.S
@@ -27,7 +27,7 @@ 
 #endif
 
 	.machine power4
-EALIGN (MEMCMP, 4, 0)
+ENTRY_TOCLESS (MEMCMP, 4)
 	CALL_MCOUNT 3
 
 #define rRTN	r3
diff --git a/sysdeps/powerpc/powerpc64/power4/memcpy.S b/sysdeps/powerpc/powerpc64/power4/memcpy.S
index 2e96376..4bec39c 100644
--- a/sysdeps/powerpc/powerpc64/power4/memcpy.S
+++ b/sysdeps/powerpc/powerpc64/power4/memcpy.S
@@ -37,7 +37,7 @@ 
 # define MEMCPY memcpy
 #endif
 	.machine power4
-EALIGN (MEMCPY, 5, 0)
+ENTRY_TOCLESS (MEMCPY, 5)
 	CALL_MCOUNT 3
 
     cmpldi cr1,5,31
diff --git a/sysdeps/powerpc/powerpc64/power4/memset.S b/sysdeps/powerpc/powerpc64/power4/memset.S
index a57214e..0aafce7 100644
--- a/sysdeps/powerpc/powerpc64/power4/memset.S
+++ b/sysdeps/powerpc/powerpc64/power4/memset.S
@@ -29,7 +29,7 @@ 
 # define MEMSET memset
 #endif
 	.machine power4
-EALIGN (MEMSET, 5, 0)
+ENTRY_TOCLESS (MEMSET, 5)
 	CALL_MCOUNT 3
 
 #define rTMP	r0
@@ -240,7 +240,7 @@  libc_hidden_builtin_def (memset)
 
 /* Copied from bzero.S to prevent the linker from inserting a stub
    between bzero and memset.  */
-ENTRY (__bzero)
+ENTRY_TOCLESS (__bzero)
 	CALL_MCOUNT 3
 	mr	r5,r4
 	li	r4,0
diff --git a/sysdeps/powerpc/powerpc64/power4/strncmp.S b/sysdeps/powerpc/powerpc64/power4/strncmp.S
index 2b0c00d..2f978f6 100644
--- a/sysdeps/powerpc/powerpc64/power4/strncmp.S
+++ b/sysdeps/powerpc/powerpc64/power4/strncmp.S
@@ -26,7 +26,7 @@ 
 
 /* int [r3] strncmp (const char *s1 [r3], const char *s2 [r4], size_t size [r5])  */
 
-EALIGN (STRNCMP, 4, 0)
+ENTRY_TOCLESS (STRNCMP, 4)
 	CALL_MCOUNT 3
 
 #define rTMP2	r0
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S
index 39b7ee7..0d09e56 100644
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S
+++ b/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S
@@ -20,7 +20,7 @@ 
 #include <math_ldbl_opt.h>
 
 	.machine	"power5"
-EALIGN (__ceil, 4, 0)
+ENTRY_TOCLESS (__ceil, 4)
 	CALL_MCOUNT 0
 	frip	fp1, fp1
 	blr
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S
index d1c6f26..3649660 100644
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S
+++ b/sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S
@@ -19,7 +19,7 @@ 
 #include <sysdep.h>
 
 	.machine	"power5"
-EALIGN (__ceilf, 4, 0)
+ENTRY_TOCLESS (__ceilf, 4)
 	CALL_MCOUNT 0
 	frip	fp1, fp1	/* The rounding instructions are double.  */
 	frsp	fp1, fp1	/* But we need to set ooverflow for float.  */
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S
index 6411f15..f8bfb27 100644
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S
+++ b/sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S
@@ -20,7 +20,7 @@ 
 #include <math_ldbl_opt.h>
 
 	.machine	"power5"
-EALIGN (__floor, 4, 0)
+ENTRY_TOCLESS (__floor, 4)
 	CALL_MCOUNT 0
 	frim	fp1, fp1
 	blr
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S
index 26c3b25..fa8a13d 100644
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S
+++ b/sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S
@@ -19,7 +19,7 @@ 
 #include <sysdep.h>
 
 	.machine	"power5"
-EALIGN (__floorf, 4, 0)
+ENTRY_TOCLESS (__floorf, 4)
 	CALL_MCOUNT 0
 	frim	fp1, fp1	/* The rounding instructions are double.  */
 	frsp	fp1, fp1	/* But we need to set ooverflow for float.  */
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S
index 909714b..4f9f850 100644
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S
+++ b/sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S
@@ -30,7 +30,7 @@ 
    round to zero instruction.  */
 
 	.machine	"power5"
-EALIGN (__llround, 4, 0)
+ENTRY_TOCLESS (__llround, 4)
 	CALL_MCOUNT 0
 	frin	fp2, fp1	/* Round to nearest +-0.5.  */
 	fctidz	fp3, fp2	/* Convert To Integer DW round toward 0.  */
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S
index dc46d20..0a124c8 100644
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S
+++ b/sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S
@@ -20,7 +20,7 @@ 
 #include <math_ldbl_opt.h>
 
 	.machine	"power5"
-EALIGN (__round, 4, 0)
+ENTRY_TOCLESS (__round, 4)
 	CALL_MCOUNT 0
 	frin	fp1, fp1
 	blr
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S
index 0a58784..39e28b4 100644
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S
+++ b/sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S
@@ -19,7 +19,7 @@ 
 #include <sysdep.h>
 
 	.machine	"power5"
-EALIGN (__roundf, 4, 0)
+ENTRY_TOCLESS (__roundf, 4)
 	CALL_MCOUNT 0
 	frin	fp1, fp1	/* The rounding instructions are double.  */
 	frsp	fp1, fp1	/* But we need to set ooverflow for float.  */
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S
index 7f8290e..5fca9f3 100644
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S
+++ b/sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S
@@ -20,7 +20,7 @@ 
 #include <math_ldbl_opt.h>
 
 	.machine	"power5"
-EALIGN (__trunc, 4, 0)
+ENTRY_TOCLESS (__trunc, 4)
 	CALL_MCOUNT 0
 	friz	fp1, fp1
 	blr
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S
index 07f5d33..ced4b61 100644
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S
+++ b/sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S
@@ -19,7 +19,7 @@ 
 #include <sysdep.h>
 
 	.machine	"power5"
-EALIGN (__truncf, 4, 0)
+ENTRY_TOCLESS (__truncf, 4)
 	CALL_MCOUNT 0
 	friz	fp1, fp1	/* The rounding instructions are double.  */
 	frsp	fp1, fp1	/* But we need to set ooverflow for float.  */
diff --git a/sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S b/sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S
index d6a829e..a4725f7 100644
--- a/sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S
+++ b/sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S
@@ -21,7 +21,7 @@ 
 
 /* int __isnan(x)  */
 	.machine power5
-EALIGN (__isnan, 4, 0)
+ENTRY_TOCLESS (__isnan, 4)
 	CALL_MCOUNT 0
 	stfd	fp1,-8(r1)	/* copy FPR to GPR */
 	lis	r0,0x7ff0
diff --git a/sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S b/sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S
index ec36d1b..a64f1b8 100644
--- a/sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S
+++ b/sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S
@@ -27,7 +27,7 @@ 
 	.section    ".text"
 	.type	    __copysign, @function
 	.machine    power6
-EALIGN (__copysign, 4, 0)
+ENTRY_TOCLESS (__copysign, 4)
 	CALL_MCOUNT 0
 	fcpsgn	fp1,fp2,fp1
 	blr
diff --git a/sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S b/sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S
index 85187b4..c95e4ae 100644
--- a/sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S
+++ b/sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S
@@ -21,7 +21,7 @@ 
 
 /* int __isnan(x)  */
 	.machine power6
-EALIGN (__isnan, 4, 0)
+ENTRY_TOCLESS (__isnan, 4)
 	CALL_MCOUNT 0
 	stfd	fp1,-8(r1)	/* copy FPR to GPR */
 	ori	r1,r1,0
diff --git a/sysdeps/powerpc/powerpc64/power6/memcpy.S b/sysdeps/powerpc/powerpc64/power6/memcpy.S
index 1f7294b..ac177ca 100644
--- a/sysdeps/powerpc/powerpc64/power6/memcpy.S
+++ b/sysdeps/powerpc/powerpc64/power6/memcpy.S
@@ -44,7 +44,7 @@ 
 # define MEMCPY memcpy
 #endif
 	.machine	"power6"
-EALIGN (MEMCPY, 7, 0)
+ENTRY_TOCLESS (MEMCPY, 7)
 	CALL_MCOUNT 3
 
     cmpldi cr1,5,31
diff --git a/sysdeps/powerpc/powerpc64/power6/memset.S b/sysdeps/powerpc/powerpc64/power6/memset.S
index aee1c8e..8bbb8c4 100644
--- a/sysdeps/powerpc/powerpc64/power6/memset.S
+++ b/sysdeps/powerpc/powerpc64/power6/memset.S
@@ -29,7 +29,7 @@ 
 # define MEMSET memset
 #endif
 	.machine power6
-EALIGN (MEMSET, 7, 0)
+ENTRY_TOCLESS (MEMSET, 7)
 	CALL_MCOUNT 3
 
 #define rTMP	r0
@@ -384,7 +384,7 @@  libc_hidden_builtin_def (memset)
 
 /* Copied from bzero.S to prevent the linker from inserting a stub
    between bzero and memset.  */
-ENTRY (__bzero)
+ENTRY_TOCLESS (__bzero)
 	CALL_MCOUNT 3
 	mr	r5,r4
 	li	r4,0
diff --git a/sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S b/sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S
index b6e11ba..d4b011d 100644
--- a/sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S
+++ b/sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S
@@ -21,7 +21,7 @@ 
 
 /* int __isnan(x)  */
 	.machine power6
-EALIGN (__isnan, 4, 0)
+ENTRY_TOCLESS (__isnan, 4)
 	CALL_MCOUNT 0
 	mftgpr	r4,fp1		/* copy FPR to GPR */
 	lis	r0,0x7ff0
diff --git a/sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S b/sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S
index 37aa690..f60d62f 100644
--- a/sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S
+++ b/sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S
@@ -21,7 +21,7 @@ 
 
 	.machine	"power6"
 /* long long int[r3] __llrint (double x[fp1])  */
-ENTRY (__llrint)
+ENTRY_TOCLESS (__llrint)
 	CALL_MCOUNT 0
 	fctid	fp13,fp1
 	mftgpr  r3,fp13
diff --git a/sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S b/sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S
index 62e1798..6d1db55 100644
--- a/sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S
+++ b/sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S
@@ -30,7 +30,7 @@ 
    round to zero instruction.  */
 
 	.machine	"power6"
-ENTRY (__llround)
+ENTRY_TOCLESS (__llround)
 	CALL_MCOUNT 0
 	frin	fp2,fp1	/* Round to nearest +-0.5.  */
 	fctidz	fp3,fp2	/* Convert To Integer DW round toward 0.  */
diff --git a/sysdeps/powerpc/powerpc64/power7/add_n.S b/sysdeps/powerpc/powerpc64/power7/add_n.S
index 6425afb..02335c1 100644
--- a/sysdeps/powerpc/powerpc64/power7/add_n.S
+++ b/sysdeps/powerpc/powerpc64/power7/add_n.S
@@ -36,7 +36,7 @@ 
 #define VP  r5
 #define N   r6
 
-EALIGN(FUNC, 5, 0)
+ENTRY_TOCLESS (FUNC, 5)
 #ifdef USE_AS_SUB
 	addic	r0, r0, 0
 #else
diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S b/sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S
index 9ccc758..1360289 100644
--- a/sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S
+++ b/sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S
@@ -27,7 +27,7 @@ 
 	.section    ".text"
 	.type	    __finite, @function
 	.machine    power7
-EALIGN (__finite, 4, 0)
+ENTRY (__finite, 4)
 	CALL_MCOUNT 0
 	lfd     fp0,.LC0@toc(r2)
 	ftdiv   cr7,fp1,fp0
diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S b/sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S
index 4482cdd..7c21c78 100644
--- a/sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S
+++ b/sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S
@@ -27,7 +27,7 @@ 
 	.section    ".text"
 	.type	    __isinf, @function
 	.machine    power7
-EALIGN (__isinf, 4, 0)
+ENTRY (__isinf, 4)
 	CALL_MCOUNT 0
 	lfd	fp0,.LC0@toc(r2)
 	ftdiv	cr7,fp1,fp0
diff --git a/sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S b/sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S
index 46b08a0..8a925a2 100644
--- a/sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S
+++ b/sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S
@@ -27,7 +27,7 @@ 
 	.section    ".text"
 	.type	    __isnan, @function
 	.machine    power7
-EALIGN (__isnan, 4, 0)
+ENTRY (__isnan, 4)
 	CALL_MCOUNT 0
 	lfd	fp0,.LC0@toc(r2)
 	ftdiv	cr7,fp1,fp0
diff --git a/sysdeps/powerpc/powerpc64/power7/memchr.S b/sysdeps/powerpc/powerpc64/power7/memchr.S
index 5e9707a..ec3ea62 100644
--- a/sysdeps/powerpc/powerpc64/power7/memchr.S
+++ b/sysdeps/powerpc/powerpc64/power7/memchr.S
@@ -25,7 +25,7 @@ 
 # define MEMCHR __memchr
 #endif
 	.machine  power7
-ENTRY (MEMCHR)
+ENTRY_TOCLESS (MEMCHR)
 	CALL_MCOUNT 3
 	dcbt	0,r3
 	clrrdi  r8,r3,3
diff --git a/sysdeps/powerpc/powerpc64/power7/memcmp.S b/sysdeps/powerpc/powerpc64/power7/memcmp.S
index 96ce8ce..bee0424 100644
--- a/sysdeps/powerpc/powerpc64/power7/memcmp.S
+++ b/sysdeps/powerpc/powerpc64/power7/memcmp.S
@@ -25,7 +25,7 @@ 
 # define MEMCMP memcmp
 #endif
 	.machine power7
-EALIGN (MEMCMP, 4, 0)
+ENTRY_TOCLESS (MEMCMP, 4)
 	CALL_MCOUNT 3
 
 #define rRTN		r3
diff --git a/sysdeps/powerpc/powerpc64/power7/memcpy.S b/sysdeps/powerpc/powerpc64/power7/memcpy.S
index e08993c..641c7e2 100644
--- a/sysdeps/powerpc/powerpc64/power7/memcpy.S
+++ b/sysdeps/powerpc/powerpc64/power7/memcpy.S
@@ -32,7 +32,7 @@ 
 #define cnt 5
 
 	.machine power7
-EALIGN (MEMCPY, 5, 0)
+ENTRY_TOCLESS (MEMCPY, 5)
 	CALL_MCOUNT 3
 
 	cmpldi	cr1,cnt,31
diff --git a/sysdeps/powerpc/powerpc64/power7/memmove.S b/sysdeps/powerpc/powerpc64/power7/memmove.S
index 4c0f7c3..93baa69 100644
--- a/sysdeps/powerpc/powerpc64/power7/memmove.S
+++ b/sysdeps/powerpc/powerpc64/power7/memmove.S
@@ -31,7 +31,7 @@ 
 # define MEMMOVE memmove
 #endif
 	.machine power7
-EALIGN (MEMMOVE, 5, 0)
+ENTRY_TOCLESS (MEMMOVE, 5)
 	CALL_MCOUNT 3
 
 L(_memmove):
@@ -826,7 +826,7 @@  libc_hidden_builtin_def (memmove)
 /* void bcopy(const void *src [r3], void *dest [r4], size_t n [r5])
    Implemented in this file to avoid linker create a stub function call
    in the branch to '_memmove'.  */
-ENTRY (__bcopy)
+ENTRY_TOCLESS (__bcopy)
 	mr	r6,r3
 	mr	r3,r4
 	mr	r4,r6
diff --git a/sysdeps/powerpc/powerpc64/power7/mempcpy.S b/sysdeps/powerpc/powerpc64/power7/mempcpy.S
index 4e15d1e..904fac5 100644
--- a/sysdeps/powerpc/powerpc64/power7/mempcpy.S
+++ b/sysdeps/powerpc/powerpc64/power7/mempcpy.S
@@ -27,7 +27,7 @@ 
 # define MEMPCPY __mempcpy
 #endif
 	.machine  power7
-EALIGN (MEMPCPY, 5, 0)
+ENTRY_TOCLESS (MEMPCPY, 5)
 	CALL_MCOUNT 3
 
 	cmpldi	cr1,5,31
diff --git a/sysdeps/powerpc/powerpc64/power7/memrchr.S b/sysdeps/powerpc/powerpc64/power7/memrchr.S
index 4276768..92b9d19 100644
--- a/sysdeps/powerpc/powerpc64/power7/memrchr.S
+++ b/sysdeps/powerpc/powerpc64/power7/memrchr.S
@@ -25,7 +25,7 @@ 
 # define MEMRCHR __memrchr
 #endif
 	.machine  power7
-ENTRY (MEMRCHR)
+ENTRY_TOCLESS (MEMRCHR)
 	CALL_MCOUNT 3
 	add	r7,r3,r5      /* Calculate the last acceptable address.  */
 	neg	r0,r7
diff --git a/sysdeps/powerpc/powerpc64/power7/memset.S b/sysdeps/powerpc/powerpc64/power7/memset.S
index 21933c0..f2e2fa1 100644
--- a/sysdeps/powerpc/powerpc64/power7/memset.S
+++ b/sysdeps/powerpc/powerpc64/power7/memset.S
@@ -26,7 +26,7 @@ 
 # define MEMSET memset
 #endif
 	.machine power7
-EALIGN (MEMSET, 5, 0)
+ENTRY_TOCLESS (MEMSET, 5)
 	CALL_MCOUNT 3
 
 L(_memset):
@@ -388,7 +388,7 @@  libc_hidden_builtin_def (memset)
 
 /* Copied from bzero.S to prevent the linker from inserting a stub
    between bzero and memset.  */
-ENTRY (__bzero)
+ENTRY_TOCLESS (__bzero)
 	CALL_MCOUNT 3
 	mr	r5,r4
 	li	r4,0
diff --git a/sysdeps/powerpc/powerpc64/power7/rawmemchr.S b/sysdeps/powerpc/powerpc64/power7/rawmemchr.S
index 48afb75..86ea4a6 100644
--- a/sysdeps/powerpc/powerpc64/power7/rawmemchr.S
+++ b/sysdeps/powerpc/powerpc64/power7/rawmemchr.S
@@ -25,7 +25,7 @@ 
 # define RAWMEMCHR __rawmemchr
 #endif
 	.machine  power7
-ENTRY (RAWMEMCHR)
+ENTRY_TOCLESS (RAWMEMCHR)
 	CALL_MCOUNT 2
 	dcbt	0,r3
 	clrrdi	r8,r3,3	      /* Align the address to doubleword boundary.  */
diff --git a/sysdeps/powerpc/powerpc64/power7/strcasecmp.S b/sysdeps/powerpc/powerpc64/power7/strcasecmp.S
index e856b8a..2243187 100644
--- a/sysdeps/powerpc/powerpc64/power7/strcasecmp.S
+++ b/sysdeps/powerpc/powerpc64/power7/strcasecmp.S
@@ -31,10 +31,11 @@ 
 # define STRCMP   strcasecmp
 #endif
 
-ENTRY (__STRCMP)
 #ifndef USE_IN_EXTENDED_LOCALE_MODEL
+ENTRY (__STRCMP)
 	CALL_MCOUNT 2
 #else
+ENTRY_TOCLESS (__STRCMP)
 	CALL_MCOUNT 3
 #endif
 
diff --git a/sysdeps/powerpc/powerpc64/power7/strchr.S b/sysdeps/powerpc/powerpc64/power7/strchr.S
index a18e2e1..1d53dbe 100644
--- a/sysdeps/powerpc/powerpc64/power7/strchr.S
+++ b/sysdeps/powerpc/powerpc64/power7/strchr.S
@@ -25,7 +25,7 @@ 
 
 /* int [r3] strchr (char *s [r3], int c [r4])  */
 	.machine  power7
-ENTRY (STRCHR)
+ENTRY_TOCLESS (STRCHR)
 	CALL_MCOUNT 2
 	dcbt	0,r3
 	clrrdi	r8,r3,3	      /* Align the address to doubleword boundary.  */
diff --git a/sysdeps/powerpc/powerpc64/power7/strchrnul.S b/sysdeps/powerpc/powerpc64/power7/strchrnul.S
index 27bc1f0..eb69953 100644
--- a/sysdeps/powerpc/powerpc64/power7/strchrnul.S
+++ b/sysdeps/powerpc/powerpc64/power7/strchrnul.S
@@ -24,7 +24,7 @@ 
 #endif
 /* int [r3] strchrnul (char *s [r3], int c [r4])  */
 	.machine  power7
-ENTRY (STRCHRNUL)
+ENTRY_TOCLESS (STRCHRNUL)
 	CALL_MCOUNT 2
 	dcbt	0,r3
 	clrrdi	r8,r3,3	      /* Align the address to doubleword boundary.  */
diff --git a/sysdeps/powerpc/powerpc64/power7/strcmp.S b/sysdeps/powerpc/powerpc64/power7/strcmp.S
index 14e14f4..69b1ff9 100644
--- a/sysdeps/powerpc/powerpc64/power7/strcmp.S
+++ b/sysdeps/powerpc/powerpc64/power7/strcmp.S
@@ -30,7 +30,7 @@ 
 /* int [r3] strcmp (const char *s1 [r3], const char *s2 [r4])  */
 
 	.machine	power7
-EALIGN (STRCMP, 4, 0)
+ENTRY_TOCLESS (STRCMP, 4)
 	CALL_MCOUNT 2
 
 	or r9, r3, r4
diff --git a/sysdeps/powerpc/powerpc64/power7/strlen.S b/sysdeps/powerpc/powerpc64/power7/strlen.S
index 63848c4..317dad5 100644
--- a/sysdeps/powerpc/powerpc64/power7/strlen.S
+++ b/sysdeps/powerpc/powerpc64/power7/strlen.S
@@ -25,7 +25,7 @@ 
 # define STRLEN strlen
 #endif
 	.machine  power7
-ENTRY (STRLEN)
+ENTRY_TOCLESS (STRLEN)
 	CALL_MCOUNT 1
 	dcbt	0,r3
 	clrrdi	r4,r3,3	      /* Align the address to doubleword boundary.  */
diff --git a/sysdeps/powerpc/powerpc64/power7/strncmp.S b/sysdeps/powerpc/powerpc64/power7/strncmp.S
index d53b31b..ffe7e8e 100644
--- a/sysdeps/powerpc/powerpc64/power7/strncmp.S
+++ b/sysdeps/powerpc/powerpc64/power7/strncmp.S
@@ -28,7 +28,7 @@ 
 		     const char *s2 [r4],
 		     size_t size [r5])  */
 
-EALIGN (STRNCMP,5,0)
+ENTRY_TOCLESS (STRNCMP, 5)
 	CALL_MCOUNT 3
 
 #define rTMP2	r0
diff --git a/sysdeps/powerpc/powerpc64/power7/strncpy.S b/sysdeps/powerpc/powerpc64/power7/strncpy.S
index 88d7979..b2833b8 100644
--- a/sysdeps/powerpc/powerpc64/power7/strncpy.S
+++ b/sysdeps/powerpc/powerpc64/power7/strncpy.S
@@ -67,7 +67,11 @@ 
 #endif
 
 	.machine  power7
-EALIGN(FUNC_NAME, 4, 0)
+#ifdef MEMSET_is_local
+ENTRY_TOCLESS (FUNC_NAME, 4)
+#else
+ENTRY (FUNC_NAME, 4)
+#endif
 	CALL_MCOUNT 3
 
 	mflr r0			/* load link register LR to r0  */
diff --git a/sysdeps/powerpc/powerpc64/power7/strnlen.S b/sysdeps/powerpc/powerpc64/power7/strnlen.S
index a970b6c..0ee659f 100644
--- a/sysdeps/powerpc/powerpc64/power7/strnlen.S
+++ b/sysdeps/powerpc/powerpc64/power7/strnlen.S
@@ -25,7 +25,7 @@ 
 
 /* int [r3] strnlen (char *s [r3], int size [r4])  */
 	.machine  power7
-ENTRY (STRNLEN)
+ENTRY_TOCLESS (STRNLEN)
 	CALL_MCOUNT 2
 	dcbt	0,r3
 	clrrdi	r8,r3,3
diff --git a/sysdeps/powerpc/powerpc64/power7/strrchr.S b/sysdeps/powerpc/powerpc64/power7/strrchr.S
index c22393d..98310e4 100644
--- a/sysdeps/powerpc/powerpc64/power7/strrchr.S
+++ b/sysdeps/powerpc/powerpc64/power7/strrchr.S
@@ -25,7 +25,7 @@ 
 #endif
 
 	.machine  power7
-ENTRY (STRRCHR)
+ENTRY_TOCLESS (STRRCHR)
 	CALL_MCOUNT 2
 	dcbt	0,r3
 	clrrdi	r8,r3,3	      /* Align the address to doubleword boundary.  */
diff --git a/sysdeps/powerpc/powerpc64/power7/strstr.S b/sysdeps/powerpc/powerpc64/power7/strstr.S
index 1c43253..c2d727d 100644
--- a/sysdeps/powerpc/powerpc64/power7/strstr.S
+++ b/sysdeps/powerpc/powerpc64/power7/strstr.S
@@ -62,7 +62,8 @@ 
 
 #define	FRAMESIZE	(FRAME_MIN_SIZE+32)
 	.machine  power7
-EALIGN (STRSTR, 4, 0)
+/* Can't be ENTRY_TOCLESS due to calling __strstr_ppc which uses r2.  */
+ENTRY (STRSTR, 4)
 	CALL_MCOUNT 2
 	mflr	r0			/* Load link register LR to r0.  */
 	std	r31, -8(r1)		/* Save callers register r31.  */
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S b/sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S
index 4c42926..d9433d8 100644
--- a/sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S
+++ b/sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S
@@ -55,7 +55,7 @@ 
    float [fp1] expf (float [fp1] x)  */
 
 	.machine power8
-EALIGN(__ieee754_expf, 4, 0)
+ENTRY (__ieee754_expf, 4)
 	addis	DATA_OFFSET,r2,.Lanchor@toc@ha
 	addi	DATA_OFFSET,DATA_OFFSET,.Lanchor@toc@l
 
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_cosf.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_cosf.S
index 8dfa007..d45496d 100644
--- a/sysdeps/powerpc/powerpc64/power8/fpu/s_cosf.S
+++ b/sysdeps/powerpc/powerpc64/power8/fpu/s_cosf.S
@@ -39,7 +39,7 @@ 
 	   float [fp1] cosf (float [fp1] x)  */
 
 	.machine power8
-EALIGN(__cosf, 4, 0)
+ENTRY (__cosf, 4)
 	addis	r9,r2,L(anchor)@toc@ha
 	addi	r9,r9,L(anchor)@toc@l
 
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S
index fcdcb60..80181b7 100644
--- a/sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S
+++ b/sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S
@@ -23,7 +23,7 @@ 
 
 /* int [r3] __finite ([fp1] x)  */
 
-EALIGN (__finite, 4, 0)
+ENTRY_TOCLESS (__finite, 4)
 	CALL_MCOUNT 0
 	MFVSRD_R3_V1
 	lis     r9,0x8010
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S
index 32814e4..01f57a8 100644
--- a/sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S
+++ b/sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S
@@ -23,7 +23,7 @@ 
 
 /* int [r3] __isinf([fp1] x)  */
 
-EALIGN (__isinf, 4, 0)
+ENTRY_TOCLESS (__isinf, 4)
 	CALL_MCOUNT 0
 	MFVSRD_R3_V1
 	lis     r9,0x7ff0     /* r9 = 0x7ff0  */
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S
index af52e50..87be552 100644
--- a/sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S
+++ b/sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S
@@ -23,7 +23,7 @@ 
 
 /* int [r3] __isnan([f1] x)  */
 
-EALIGN (__isnan, 4, 0)
+ENTRY_TOCLESS (__isnan, 4)
 	CALL_MCOUNT 0
 	MFVSRD_R3_V1
 	lis     r9,0x7ff0
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S
index aa180b6..6980abc 100644
--- a/sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S
+++ b/sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S
@@ -22,7 +22,7 @@ 
 #define MFVSRD_R3_V1  .long 0x7c230066     /* mfvsrd  r3,vs1  */
 
 /* long long int[r3] __llrint (double x[fp1])  */
-ENTRY (__llrint)
+ENTRY_TOCLESS (__llrint)
 	CALL_MCOUNT 0
 	fctid	fp1,fp1
 	MFVSRD_R3_V1
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S
index 043fc6a..8bdc162 100644
--- a/sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S
+++ b/sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S
@@ -24,7 +24,7 @@ 
 
 /* long long [r3] llround (float x [fp1])  */
 
-ENTRY (__llround)
+ENTRY_TOCLESS (__llround)
 	CALL_MCOUNT 0
 	frin	fp1,fp1	/* Round to nearest +-0.5.  */
 	fctidz	fp1,fp1	/* Convert To Integer DW round toward 0.  */
diff --git a/sysdeps/powerpc/powerpc64/power8/fpu/s_sinf.S b/sysdeps/powerpc/powerpc64/power8/fpu/s_sinf.S
index fb0add3..d5335d8 100644
--- a/sysdeps/powerpc/powerpc64/power8/fpu/s_sinf.S
+++ b/sysdeps/powerpc/powerpc64/power8/fpu/s_sinf.S
@@ -39,7 +39,7 @@ 
 	   float [fp1] sinf (float [fp1] x)  */
 
 	.machine power8
-EALIGN(__sinf, 4, 0)
+ENTRY (__sinf, 4)
 	addis	r9,r2,L(anchor)@toc@ha
 	addi	r9,r9,L(anchor)@toc@l
 
diff --git a/sysdeps/powerpc/powerpc64/power8/memcmp.S b/sysdeps/powerpc/powerpc64/power8/memcmp.S
index 46b9c00..ba8cd13 100644
--- a/sysdeps/powerpc/powerpc64/power8/memcmp.S
+++ b/sysdeps/powerpc/powerpc64/power8/memcmp.S
@@ -29,7 +29,7 @@ 
 # define MEMCMP memcmp
 #endif
 	.machine power7
-EALIGN (MEMCMP, 4, 0)
+ENTRY_TOCLESS (MEMCMP, 4)
 	CALL_MCOUNT 3
 
 #define rRTN		r3
diff --git a/sysdeps/powerpc/powerpc64/power8/memset.S b/sysdeps/powerpc/powerpc64/power8/memset.S
index bc734c9..7ad3bb1 100644
--- a/sysdeps/powerpc/powerpc64/power8/memset.S
+++ b/sysdeps/powerpc/powerpc64/power8/memset.S
@@ -31,7 +31,7 @@ 
 	   handled by the define.  It avoid breakage on binutils
 	   that does not support this machine specifier.  */
 	.machine power7
-EALIGN (MEMSET, 5, 0)
+ENTRY_TOCLESS (MEMSET, 5)
 	CALL_MCOUNT 3
 
 L(_memset):
@@ -447,7 +447,7 @@  libc_hidden_builtin_def (memset)
 
 /* Copied from bzero.S to prevent the linker from inserting a stub
    between bzero and memset.  */
-ENTRY (__bzero)
+ENTRY_TOCLESS (__bzero)
 	CALL_MCOUNT 3
 	mr	r5,r4
 	li	r4,0
diff --git a/sysdeps/powerpc/powerpc64/power8/strcasestr.S b/sysdeps/powerpc/powerpc64/power8/strcasestr.S
index 6ac6572..3f59cb0 100644
--- a/sysdeps/powerpc/powerpc64/power8/strcasestr.S
+++ b/sysdeps/powerpc/powerpc64/power8/strcasestr.S
@@ -85,7 +85,7 @@ 
 /* TODO: change this to .machine power8 when the minimum required binutils
    allows it.  */
 	.machine  power7
-EALIGN (STRCASESTR, 4, 0)
+ENTRY (STRCASESTR, 4)
 	CALL_MCOUNT 2
 	mflr	r0			/* Load link register LR to r0.  */
 	std	r31, -8(r1)		/* Save callers register r31.  */
diff --git a/sysdeps/powerpc/powerpc64/power8/strchr.S b/sysdeps/powerpc/powerpc64/power8/strchr.S
index e0c185c..63f7533 100644
--- a/sysdeps/powerpc/powerpc64/power8/strchr.S
+++ b/sysdeps/powerpc/powerpc64/power8/strchr.S
@@ -44,7 +44,7 @@ 
 /* TODO: change this to .machine power8 when the minimum required binutils
    allows it.  */
 	.machine  power7
-ENTRY (FUNC_NAME)
+ENTRY_TOCLESS (FUNC_NAME)
 	CALL_MCOUNT 2
 	dcbt	0,r3
 	clrrdi	r8,r3,3	      /* Align the address to doubleword boundary.  */
diff --git a/sysdeps/powerpc/powerpc64/power8/strcmp.S b/sysdeps/powerpc/powerpc64/power8/strcmp.S
index 770484f..ff19f7f 100644
--- a/sysdeps/powerpc/powerpc64/power8/strcmp.S
+++ b/sysdeps/powerpc/powerpc64/power8/strcmp.S
@@ -31,7 +31,7 @@ 
    64K as default, the page cross handling assumes minimum page size of
    4k.  */
 
-EALIGN (STRCMP, 4, 0)
+ENTRY_TOCLESS (STRCMP, 4)
 	li	r0,0
 
 	/* Check if [s1]+16 or [s2]+16 will cross a 4K page boundary using
diff --git a/sysdeps/powerpc/powerpc64/power8/strcpy.S b/sysdeps/powerpc/powerpc64/power8/strcpy.S
index 7f2cee4..13e7a0f 100644
--- a/sysdeps/powerpc/powerpc64/power8/strcpy.S
+++ b/sysdeps/powerpc/powerpc64/power8/strcpy.S
@@ -48,7 +48,7 @@ 
    4k.  */
 
 	.machine  power7
-EALIGN (FUNC_NAME, 4, 0)
+ENTRY_TOCLESS (FUNC_NAME, 4)
         li      r0,0          /* Doubleword with null chars to use
                                  with cmpb.  */
 
diff --git a/sysdeps/powerpc/powerpc64/power8/strlen.S b/sysdeps/powerpc/powerpc64/power8/strlen.S
index 8f4a1fc..8fdb6f5 100644
--- a/sysdeps/powerpc/powerpc64/power8/strlen.S
+++ b/sysdeps/powerpc/powerpc64/power8/strlen.S
@@ -36,7 +36,7 @@ 
 /* TODO: change this to .machine power8 when the minimum required binutils
    allows it.  */
 	.machine  power7
-EALIGN (STRLEN, 4, 0)
+ENTRY_TOCLESS (STRLEN, 4)
 	CALL_MCOUNT 1
 	dcbt	0,r3
 	clrrdi	r4,r3,3	      /* Align the address to doubleword boundary.  */
diff --git a/sysdeps/powerpc/powerpc64/power8/strncmp.S b/sysdeps/powerpc/powerpc64/power8/strncmp.S
index 3d8df90..84bfcb1 100644
--- a/sysdeps/powerpc/powerpc64/power8/strncmp.S
+++ b/sysdeps/powerpc/powerpc64/power8/strncmp.S
@@ -32,7 +32,7 @@ 
    4k.  */
 
 	.machine  power7
-EALIGN (STRNCMP, 4, 0)
+ENTRY_TOCLESS (STRNCMP, 4)
 	/* Check if size is 0.  */
 	mr.	r10,r5
 	beq	cr0,L(ret0)
diff --git a/sysdeps/powerpc/powerpc64/power8/strncpy.S b/sysdeps/powerpc/powerpc64/power8/strncpy.S
index 552c5cc..150290a 100644
--- a/sysdeps/powerpc/powerpc64/power8/strncpy.S
+++ b/sysdeps/powerpc/powerpc64/power8/strncpy.S
@@ -61,7 +61,11 @@ 
    4k.  */
 
 	.machine  power7
-EALIGN (FUNC_NAME, 4, 0)
+#ifdef MEMSET_is_local
+ENTRY_TOCLESS (FUNC_NAME, 4)
+#else
+ENTRY (FUNC_NAME, 4)
+#endif
 	CALL_MCOUNT 3
 
         /* Check if the [src]+15 will cross a 4K page by checking if the bit
diff --git a/sysdeps/powerpc/powerpc64/power8/strnlen.S b/sysdeps/powerpc/powerpc64/power8/strnlen.S
index 3eadbfb..07608ff 100644
--- a/sysdeps/powerpc/powerpc64/power8/strnlen.S
+++ b/sysdeps/powerpc/powerpc64/power8/strnlen.S
@@ -59,7 +59,7 @@ 
 /* int [r3] strnlen (char *s [r3], size_t maxlen [r4])  */
 /* TODO: change to power8 when minimum required binutils allows it.  */
 	.machine  power7
-ENTRY (__strnlen)
+ENTRY_TOCLESS (__strnlen)
 	CALL_MCOUNT 2
 	dcbt	0,r3
 
diff --git a/sysdeps/powerpc/powerpc64/power8/strrchr.S b/sysdeps/powerpc/powerpc64/power8/strrchr.S
index 8eb7485..0ba6138 100644
--- a/sysdeps/powerpc/powerpc64/power8/strrchr.S
+++ b/sysdeps/powerpc/powerpc64/power8/strrchr.S
@@ -77,7 +77,7 @@ 
 	vsumsws	v2, v2, v0;
 #endif	/* !__LITTLE_ENDIAN__  */
 	.machine  power7
-ENTRY (strrchr)
+ENTRY_TOCLESS (strrchr)
 	CALL_MCOUNT 2
 	dcbt	0,r3
 	clrrdi	r8,r3,3	      /* Align the address to doubleword boundary.  */
diff --git a/sysdeps/powerpc/powerpc64/power8/strspn.S b/sysdeps/powerpc/powerpc64/power8/strspn.S
index e927189..dcd1df4 100644
--- a/sysdeps/powerpc/powerpc64/power8/strspn.S
+++ b/sysdeps/powerpc/powerpc64/power8/strspn.S
@@ -68,7 +68,7 @@ 
 	/* This can be updated to power8 once the minimum version of
 	   binutils supports power8 and the above instructions.  */
 	.machine power7
-EALIGN(STRSPN, 4, 0)
+ENTRY_TOCLESS (STRSPN, 4)
 	CALL_MCOUNT 2
 
 	/* Generate useful constants for later on.  */
diff --git a/sysdeps/powerpc/powerpc64/power9/strcmp.S b/sysdeps/powerpc/powerpc64/power9/strcmp.S
index 2dc4f6c..87883ef 100644
--- a/sysdeps/powerpc/powerpc64/power9/strcmp.S
+++ b/sysdeps/powerpc/powerpc64/power9/strcmp.S
@@ -66,7 +66,7 @@ 
    allows it.  */
 
 	.machine  power7
-EALIGN (STRCMP, 4, 0)
+ENTRY_TOCLESS (STRCMP, 4)
 	li	r0, 0
 
 	/* Check if [s1]+16 or [s2]+16 will cross a 4K page boundary using
diff --git a/sysdeps/powerpc/powerpc64/power9/strncmp.S b/sysdeps/powerpc/powerpc64/power9/strncmp.S
index c946a5c..ff6f8ac 100644
--- a/sysdeps/powerpc/powerpc64/power9/strncmp.S
+++ b/sysdeps/powerpc/powerpc64/power9/strncmp.S
@@ -68,7 +68,7 @@ 
 /* TODO: change this to .machine power9 when minimum binutils
    is upgraded to 2.27.  */
 	.machine  power7
-EALIGN (STRNCMP, 4, 0)
+ENTRY_TOCLESS (STRNCMP, 4)
 	/* Check if size is 0.  */
 	cmpdi	cr0, r5, 0
 	beq	cr0, L(ret0)
diff --git a/sysdeps/powerpc/powerpc64/ppc-mcount.S b/sysdeps/powerpc/powerpc64/ppc-mcount.S
index 8312f46..6936211 100644
--- a/sysdeps/powerpc/powerpc64/ppc-mcount.S
+++ b/sysdeps/powerpc/powerpc64/ppc-mcount.S
@@ -24,13 +24,15 @@ 
 ENTRY(_mcount)
 	mflr		 r4
 	ld		 r11, 0(r1)
+	std		 r4, FRAME_LR_SAVE(r1)
 	stdu		 r1,-FRAME_MIN_SIZE(r1)
 	cfi_adjust_cfa_offset (FRAME_MIN_SIZE)
-	std		 r4, FRAME_MIN_SIZE+FRAME_LR_SAVE(r1)
 	cfi_offset (lr, FRAME_LR_SAVE)
 	ld		 r3, FRAME_LR_SAVE(r11)
 	bl		 JUMPTARGET(__mcount_internal)
+#ifndef SHARED
 	nop
+#endif
 	ld		 r0, FRAME_MIN_SIZE+FRAME_LR_SAVE(r1)
 	mtlr		 r0
 	addi		 r1,r1,FRAME_MIN_SIZE
diff --git a/sysdeps/powerpc/powerpc64/start.S b/sysdeps/powerpc/powerpc64/start.S
index 937c39a..05ed67e 100644
--- a/sysdeps/powerpc/powerpc64/start.S
+++ b/sysdeps/powerpc/powerpc64/start.S
@@ -62,7 +62,7 @@  L(start_addresses):
 .L01:
 	.tc	L(start_addresses)[TC],L(start_addresses)
 	.section ".text"
-ENTRY(_start)
+ENTRY (_start)
  /* Save the stack pointer, in case we're statically linked under Linux.  */
 	mr	r9,r1
  /* Set up an initial stack frame, and clear the LR.  */
@@ -78,7 +78,7 @@  ENTRY(_start)
 
  /* and continue in libc-start, in glibc.  */
 	b	JUMPTARGET(__libc_start_main)
-/* The linker needs this nop to recognize that it's OK to call via a
+/* Older versions of ld need this nop to recognize that it's OK to call via a
    TOC adjusting stub.  */
 	nop
 
diff --git a/sysdeps/powerpc/powerpc64/strchr.S b/sysdeps/powerpc/powerpc64/strchr.S
index cbfcc14..c0ddb00 100644
--- a/sysdeps/powerpc/powerpc64/strchr.S
+++ b/sysdeps/powerpc/powerpc64/strchr.S
@@ -26,7 +26,7 @@ 
 # define STRCHR strchr
 #endif
 
-ENTRY (STRCHR)
+ENTRY_TOCLESS (STRCHR)
 	CALL_MCOUNT 2
 
 #define rTMP1	r0
diff --git a/sysdeps/powerpc/powerpc64/strcmp.S b/sysdeps/powerpc/powerpc64/strcmp.S
index ab5f8c2..69b953f 100644
--- a/sysdeps/powerpc/powerpc64/strcmp.S
+++ b/sysdeps/powerpc/powerpc64/strcmp.S
@@ -26,7 +26,7 @@ 
 # define STRCMP strcmp
 #endif
 
-EALIGN (STRCMP, 4, 0)
+ENTRY_TOCLESS (STRCMP, 4)
 	CALL_MCOUNT 2
 
 #define rTMP2	r0
diff --git a/sysdeps/powerpc/powerpc64/strlen.S b/sysdeps/powerpc/powerpc64/strlen.S
index 1466624..0d8a38b 100644
--- a/sysdeps/powerpc/powerpc64/strlen.S
+++ b/sysdeps/powerpc/powerpc64/strlen.S
@@ -84,7 +84,7 @@ 
 # define STRLEN strlen
 #endif
 
-ENTRY (STRLEN)
+ENTRY_TOCLESS (STRLEN)
 	CALL_MCOUNT 1
 
 #define rTMP4	r0
diff --git a/sysdeps/powerpc/powerpc64/strncmp.S b/sysdeps/powerpc/powerpc64/strncmp.S
index 0765998..c314293 100644
--- a/sysdeps/powerpc/powerpc64/strncmp.S
+++ b/sysdeps/powerpc/powerpc64/strncmp.S
@@ -26,7 +26,7 @@ 
 # define STRNCMP strncmp
 #endif
 
-EALIGN (STRNCMP, 4, 0)
+ENTRY_TOCLESS (STRNCMP, 4)
 	CALL_MCOUNT 3
 
 #define rTMP2	r0
diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h
index 860420e..ab5f395 100644
--- a/sysdeps/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/powerpc/powerpc64/sysdep.h
@@ -146,34 +146,51 @@ 
 
 #endif /* _CALL_ELF */
 
-#define ENTRY(name)	\
-	.section	".text";		\
-	ENTRY_2(name);				\
-	.align ALIGNARG(2);			\
-BODY_LABEL(name):				\
-	cfi_startproc;				\
-	LOCALENTRY(name)
+	.macro NOPS NARG
+	.if \NARG
+	NOPS \NARG-1
+	nop
+	.endif
+	.endm
 
-#define EALIGN_W_0  /* No words to insert.  */
-#define EALIGN_W_1  nop
-#define EALIGN_W_2  nop;nop
-#define EALIGN_W_3  nop;nop;nop
-#define EALIGN_W_4  EALIGN_W_3;nop
-#define EALIGN_W_5  EALIGN_W_4;nop
-#define EALIGN_W_6  EALIGN_W_5;nop
-#define EALIGN_W_7  EALIGN_W_6;nop
-
-/* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes
-   past a 2^alignt boundary.  */
-#define EALIGN(name, alignt, words) \
-	.section	".text";		\
-	ENTRY_2(name);				\
-	.align ALIGNARG(alignt);		\
-	EALIGN_W_##words;			\
-BODY_LABEL(name):				\
+	.macro ENTRY_3 name, alignp2=2, nopwords=0
+	.text
+	ENTRY_2(\name)
+	.p2align \alignp2
+	NOPS \nopwords
+BODY_LABEL(\name):
+	.endm
+
+/* Use ENTRY_TOCLESS for functions that make no use of r2 and
+   guarantee r2 is unchanged on exit.  Any function that has @toc or
+   @got relocs uses r2.  Functions that call other functions via the
+   PLT use r2.  Use ENTRY for functions that may use or change r2.
+   The first argument is the function name.
+   The optional second argument specifies alignment of the function's
+   code, as the logarithm base two of the byte alignment.  For
+   example, a value of four aligns to a sixteen byte boundary.
+   The optional third argument specifies the number of NOPs to emit
+   before the start of the function's code.   */
+#ifndef PROF
+#define ENTRY_TOCLESS(name, ...)		\
+	ENTRY_3 name, ## __VA_ARGS__;		\
+	cfi_startproc
+
+#define ENTRY(name, ...)			\
+	ENTRY_TOCLESS(name, ## __VA_ARGS__);	\
+	LOCALENTRY(name)
+#else
+/* The call to _mcount is potentially via the plt, so profiling code
+   is never free of an r2 use.  */
+#define ENTRY_TOCLESS(name, ...)		\
+	ENTRY_3 name, ## __VA_ARGS__;		\
 	cfi_startproc;				\
 	LOCALENTRY(name)
 
+#define ENTRY(name, ...)			\
+	ENTRY_TOCLESS(name, ## __VA_ARGS__)
+#endif
+
 /* Local labels stripped out by the linker.  */
 #undef L
 #define L(x) .L##x