[PATCHv2] powerpc64: Fix calls when r2 is not used [BZ #26173]

Paul E Murphy murphyp@linux.ibm.com
Wed Jul 1 21:32:40 GMT 2020



On 7/1/20 3:50 PM, Tulio Magno Quites Machado Filho wrote:
> Paul E Murphy via Libc-alpha <libc-alpha@sourceware.org> writes:
> 
>> Will this also require a newer version of binutils?
> 
> Yes.  Fixed in this version.
> 
> Thanks!
> 
> Changes since v1:
> 
>   - Detect at configure time if the assembler supports @notoc. Use @notoc only
>     when available.
> 
> ---8<---
> 
> Teach the linker that __mcount_internal, __sigjmp_save_symbol,
> __syscall_error and __GI_exit do not use r2, so that it does not need to
> recover r2 after the call.
> 
> Test at configure time if the assembler supports @notoc and define
> USE_PPC64_NOTOC.
> ---
>   config.h.in                                   |  3 ++
>   sysdeps/powerpc/powerpc64/configure           | 28 +++++++++++++++++++
>   sysdeps/powerpc/powerpc64/configure.ac        | 11 ++++++++
>   sysdeps/powerpc/powerpc64/ppc-mcount.S        |  2 +-
>   sysdeps/powerpc/powerpc64/setjmp-common.S     |  2 +-
>   sysdeps/powerpc/powerpc64/sysdep.h            |  8 +++++-
>   .../linux/powerpc/powerpc64/makecontext.S     |  2 +-
>   7 files changed, 52 insertions(+), 4 deletions(-)
> 
> diff --git a/config.h.in b/config.h.in
> index 831eca2fe1..6598d4573a 100644
> --- a/config.h.in
> +++ b/config.h.in
> @@ -20,6 +20,9 @@
>   /* On powerpc64, use overlapping .opd entries.  */
>   #undef  USE_PPC64_OVERLAPPING_OPD
>   
> +/* On powerpc64, use @notoc.  */
> +#undef  USE_PPC64_NOTOC
> +
>   /* Define if _Unwind_Find_FDE should be exported from glibc.  */
>   #undef  EXPORT_UNWIND_FIND_FDE
>   
> diff --git a/sysdeps/powerpc/powerpc64/configure b/sysdeps/powerpc/powerpc64/configure
> index 7632a7be04..5ce77af631 100644
> --- a/sysdeps/powerpc/powerpc64/configure
> +++ b/sysdeps/powerpc/powerpc64/configure
> @@ -31,3 +31,31 @@ if test x$libc_cv_overlapping_opd = xyes; then
>     $as_echo "#define USE_PPC64_OVERLAPPING_OPD 1" >>confdefs.h
>   
>   fi
> +
> +# @notoc started to be supported in GNU Binutils 2.31.

An optional rewording suggestion: s/started to be supported/was added/.

I also did a quick compile test with binutils 2.30
and 2.34.  LGTM.


More information about the Libc-alpha mailing list