powerpc64le: guarantee a .gnu.attributes section [BZ #26220]

Message ID 20200708222342.314779-1-murphyp@linux.vnet.ibm.com
State Committed
Delegated to: Tulio Magno Quites Machado Filho
Headers
Series powerpc64le: guarantee a .gnu.attributes section [BZ #26220] |

Commit Message

Paul E. Murphy July 8, 2020, 10:23 p.m. UTC
  Upstream GCC 11 development is now building the ibm128 runtime
support (in libgcc) without a .gnu.attributes section on ppc64le.
Ensure we have one to replace by building one ibm128 file in
libc and libm with attributes.
---
 sysdeps/powerpc/powerpc64/le/Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Tulio Magno Quites Machado Filho July 17, 2020, 8:56 p.m. UTC | #1
"Paul E. Murphy via Libc-alpha" <libc-alpha@sourceware.org> writes:

> Upstream GCC 11 development is now building the ibm128 runtime
> support (in libgcc) without a .gnu.attributes section on ppc64le.
> Ensure we have one to replace by building one ibm128 file in
> libc and libm with attributes.

Tested with GCC master and LGTM.

But I think it also need to be approved by Carlos before it gets merged in
glibc 2.32.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
  
Carlos O'Donell July 17, 2020, 9:03 p.m. UTC | #2
On 7/8/20 6:23 PM, Paul E. Murphy via Libc-alpha wrote:
> Upstream GCC 11 development is now building the ibm128 runtime
> support (in libgcc) without a .gnu.attributes section on ppc64le.
> Ensure we have one to replace by building one ibm128 file in
> libc and libm with attributes.
> ---
>  sysdeps/powerpc/powerpc64/le/Makefile | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
> index 05ab13d85c..033dc77b01 100644
> --- a/sysdeps/powerpc/powerpc64/le/Makefile
> +++ b/sysdeps/powerpc/powerpc64/le/Makefile
> @@ -38,6 +38,14 @@ if [ ! -z "$(filter libm.so libc.so,$(notdir $1))" ]; then \
>  fi
>  endef
>  
> +# Ensure a .gnu.attributes section is present by building an ibm128 file with
> +# -mgnu-attribute in both libm and libc shared libraries.  Prior to GCC 11 this
> +# section was implicitly included via static libgcc ibm128 routines.
> +ifeq ($(subdir),math)
> +$(objpfx)m_ldexpl.os: CFLAGS += -mgnu-attribute
> +$(objpfx)s_ldexpl.os: CFLAGS += -mgnu-attribute
> +endif
> +
>  endif # ifeq ($(build-shared),yes)
>  endif # ifeq ($(ibm128-fcts),yes)
>  
> 

I'll admit this seems a bit hackish. I would have expected the compiler
would have output something that marked the object as using the ibm128
with gnu attributes by default, but I guess that isn't a default and
you have to ask for the attributes?

OK for 2.32.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
  
Paul E Murphy July 21, 2020, 2:32 p.m. UTC | #3
On 7/17/20 4:03 PM, Carlos O'Donell wrote:
> On 7/8/20 6:23 PM, Paul E. Murphy via Libc-alpha wrote:
>> Upstream GCC 11 development is now building the ibm128 runtime
>> support (in libgcc) without a .gnu.attributes section on ppc64le.
>> Ensure we have one to replace by building one ibm128 file in
>> libc and libm with attributes.
>> ---
>>   sysdeps/powerpc/powerpc64/le/Makefile | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
>> index 05ab13d85c..033dc77b01 100644
>> --- a/sysdeps/powerpc/powerpc64/le/Makefile
>> +++ b/sysdeps/powerpc/powerpc64/le/Makefile
>> @@ -38,6 +38,14 @@ if [ ! -z "$(filter libm.so libc.so,$(notdir $1))" ]; then \
>>   fi
>>   endef
>>   
>> +# Ensure a .gnu.attributes section is present by building an ibm128 file with
>> +# -mgnu-attribute in both libm and libc shared libraries.  Prior to GCC 11 this
>> +# section was implicitly included via static libgcc ibm128 routines.
>> +ifeq ($(subdir),math)
>> +$(objpfx)m_ldexpl.os: CFLAGS += -mgnu-attribute
>> +$(objpfx)s_ldexpl.os: CFLAGS += -mgnu-attribute
>> +endif
>> +
>>   endif # ifeq ($(build-shared),yes)
>>   endif # ifeq ($(ibm128-fcts),yes)
>>   
>>
> 
> I'll admit this seems a bit hackish. I would have expected the compiler
> would have output something that marked the object as using the ibm128
> with gnu attributes by default, but I guess that isn't a default and
> you have to ask for the attributes?

Yes, but I think libc/libm should provide a permissive gnu attributes
section on libc/libm instead of stripping it.  We disabled this feature
when building glibc to avoid the linking warning/errors, thus any
externally built and subsequently linked libraries might provide their
own.

I have committed this patch.  Thank you Carlos and Tulio for reviewing.
  

Patch

diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
index 05ab13d85c..033dc77b01 100644
--- a/sysdeps/powerpc/powerpc64/le/Makefile
+++ b/sysdeps/powerpc/powerpc64/le/Makefile
@@ -38,6 +38,14 @@  if [ ! -z "$(filter libm.so libc.so,$(notdir $1))" ]; then \
 fi
 endef
 
+# Ensure a .gnu.attributes section is present by building an ibm128 file with
+# -mgnu-attribute in both libm and libc shared libraries.  Prior to GCC 11 this
+# section was implicitly included via static libgcc ibm128 routines.
+ifeq ($(subdir),math)
+$(objpfx)m_ldexpl.os: CFLAGS += -mgnu-attribute
+$(objpfx)s_ldexpl.os: CFLAGS += -mgnu-attribute
+endif
+
 endif # ifeq ($(build-shared),yes)
 endif # ifeq ($(ibm128-fcts),yes)