public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* ppc64le: gcc 12 vs -mabi=ibmlongdouble
@ 2022-01-22  6:34 DJ Delorie
  2022-01-24 15:38 ` Florian Weimer
  0 siblings, 1 reply; 7+ messages in thread
From: DJ Delorie @ 2022-01-22  6:34 UTC (permalink / raw)
  To: libc-alpha


I've been working on updating glibc for Fedora Rawhide, and have
stumbled upon this issue (after working around the -Wuse-after-free
issues with a cflags hack)...  A few of the math tests explicitly add
-mlong-double-64 but configure adds -mabi=ibmlongdouble

I would guess that we need a "CFLAGS -= -mabi=ibmlongdouble" in all
the places we add -mlong-double-64 but I don't see an easy way of
doing that, nor am I sure that's a valid solution.  Alternately, gcc
could be changed to accept the conflicting flags in a meaningful way,
if there is one.  Is there an -mabi= that undoes the
-mabi=ibmlongdouble that we can just add to the -mlong-double-64 flag
lines?

Has anyone else seen this, and if so, is there a solution?

Working case (Fedora 35):

gcc version 11.2.1 20211203 (Red Hat 11.2.1-7) (GCC) 


checking whether gcc -O2 -g -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mcpu=power8 -mtune=power8 -fasynchronous-unwind-tables -fstack-clash-protection -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mlong-double-128 uses IBM extended format... yes

Failing case (Fedora Rawhide):

gcc version 12.0.1 20220118 (Red Hat 12.0.1-0) (GCC) 

checking whether gcc -O2 -g -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mcpu=power8 -mtune=power8 -fasynchronous-unwind-tables -fstack-clash-protection -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mlong-double-128 uses IBM extended format... no
checking whether gcc -O2 -g -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mcpu=power8 -mtune=power8 -fasynchronous-unwind-tables -fstack-clash-protection -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  supports -mabi=ibmlongdouble... yes


The logic is coming from sysdeps/unix/sysv/linux/powerpc/configure.ac,
which checks for the above and amends CFLAGS.

Logs:

gcc ../sysdeps/ieee754/ldbl-opt/test-narrow-macros-ldbl-64.c -c -std=gnu11 -fgnu89-inline  -O2 -g -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mcpu=power8 -mtune=power8 -fasynchronous-unwind-tables -fstack-clash-protection -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mabi=ibmlongdouble -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fstack-protector-strong -fno-common -Wstrict-prototypes -Wold-style-definition -fmath-errno  -Wno-psabi -mno-gnu-attribute  -fpie -mlong-double-64        -I../include -I/builddir/build/BUILD/glibc-2.34.9000-563-gf44820821a/build-ppc64le-redhat-linux/math  -I/builddir/build/BUILD/glibc-2.34.9000-563-gf44820821a/build-ppc64le-redhat-linux  -I../sysdeps/unix/sysv/linux/powerpc/powerpc64/le/fpu  -I../sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu  -I../sysdeps/unix/sysv/linux/powerpc/powerpc64/le  -I../sysdeps/unix/sysv/linux/powerpc/powerpc64  -I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdep
 s/unix/sysv/linux/powerpc  -I../sysdeps/powerpc/nptl  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix/powerpc  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/powerpc/powerpc64/le/power8/fpu/multiarch  -I../sysdeps/powerpc/powerpc64/le/power7/fpu/multiarch  -I../sysdeps/powerpc/powerpc64/le/fpu/multiarch  -I../sysdeps/powerpc/powerpc64/le/power8/fpu  -I../sysdeps/powerpc/powerpc64/le/power7/fpu  -I../sysdeps/powerpc/powerpc64/le/fpu  -I../sysdeps/powerpc/powerpc64/fpu  -I../sysdeps/powerpc/powerpc64/le/power8/multiarch  -I../sysdeps/powerpc/powerpc64/le/power7/multiarch  -I../sysdeps/powerpc/powerpc64/le/multiarch  -I../sysdeps/powerpc/powerpc64/multiarch  -I../sysdeps/powerpc/powerpc64/le/power8  -I../sysdeps/powerpc/powerpc64/power8  -I../sysdeps/powerpc/powerpc64/le/power7  -I../sysdeps/powerpc/powerpc64/power7  -I../sysdeps/powerpc/p
 owerpc64/power6  -I../sysdeps/powerpc/powerp!
 c64/power4  -I../sysdeps/powerpc/power4  -I../sysdeps/powerpc/powerpc64/le  -I../sysdeps/powerpc/powerpc64  -I../sysdeps/wordsize-64  -I../sysdeps/powerpc/fpu  -I../sysdeps/powerpc  -I../sysdeps/ieee754/ldbl-128ibm-compat  -I../sysdeps/ieee754/ldbl-128ibm/include -I../sysdeps/ieee754/ldbl-128ibm  -I../sysdeps/ieee754/ldbl-opt  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754/float128  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/ppc64le-redhat-linux/12/include -isystem /usr/include -D_LIBC_REENTRANT -include /builddir/build/BUILD/glibc-2.34.9000-563-gf44820821a/build-ppc64le-redhat-linux/libc-modules.h -DMODULE_NAME=testsuite -include ../include/libc-symbols.h  -DPIC     -DTOP_NAMESPACE=glibc -I../soft-fp -o /builddir/build/BUILD/glibc-2.34.9000-563-gf44820821a/build-ppc64le-redhat-linux/math/test-narrow-macros-ldbl-64.o -MD -MP -MF /builddir/build/BUILD/glibc-2.34.9000-563-gf44820821a/build-ppc64le-red
 hat-linux/math/test-narrow-macros-ldbl-64.o.dt -MT /builddir/build/BUILD/glibc-2.34.9000-563-gf44820821a/build-ppc64le-redhat-linux/math/test-narrow-macros-ldbl-64.o

cc1: error: '-mabi=ibmlongdouble' requires '-mlong-double-128'


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ppc64le: gcc 12 vs -mabi=ibmlongdouble
  2022-01-22  6:34 ppc64le: gcc 12 vs -mabi=ibmlongdouble DJ Delorie
@ 2022-01-24 15:38 ` Florian Weimer
  2022-01-24 16:44   ` Bill Schmidt
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Florian Weimer @ 2022-01-24 15:38 UTC (permalink / raw)
  To: DJ Delorie via Libc-alpha
  Cc: DJ Delorie, Tulio Magno Quites Machado Filho, Paul E. Murphy

[-- Attachment #1: Type: text/plain, Size: 1085 bytes --]

* DJ Delorie via Libc-alpha:

> I've been working on updating glibc for Fedora Rawhide, and have
> stumbled upon this issue (after working around the -Wuse-after-free
> issues with a cflags hack)...  A few of the math tests explicitly add
> -mlong-double-64 but configure adds -mabi=ibmlongdouble
>
> I would guess that we need a "CFLAGS -= -mabi=ibmlongdouble" in all
> the places we add -mlong-double-64 but I don't see an easy way of
> doing that, nor am I sure that's a valid solution.  Alternately, gcc
> could be changed to accept the conflicting flags in a meaningful way,
> if there is one.  Is there an -mabi= that undoes the
> -mabi=ibmlongdouble that we can just add to the -mlong-double-64 flag
> lines?

> cc1: error: '-mabi=ibmlongdouble' requires '-mlong-double-128'

I was able to reproduce with a GCC 12 build configured using
--with-long-double-format=ieee.

I tried the attached patch to remove the unwanted -mabi=ibmlongdouble,
but it does not work: it removes CFLAGS-*.c processing as a side effect.

Any suggestions how we can fix this properly?

Thanks,
Florian

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-powerpc64le-Filter-out-mabi-longdouble-in-64-bit-dou.patch --]
[-- Type: text/x-patch, Size: 2728 bytes --]

From b865fb6228bea8e956e6413002e7641f10d6e5e6 Mon Sep 17 00:00:00 2001
Message-Id: <b865fb6228bea8e956e6413002e7641f10d6e5e6.1643038207.git.fweimer@redhat.com>
From: Florian Weimer <fweimer@redhat.com>
Date: Mon, 24 Jan 2022 11:19:53 +0100
Subject: [PATCH] powerpc64le: Filter out -mabi=*longdouble in 64-bit double
 tests
To: libc-alpha@sourceware.org

GCC 12 configured with --with-long-double-format=ieee does not
accept -mabi=ibmlongdouble in combination with -mlong-double-64,
but this was how glibc tries to build these tests before this change.

sysdeps/unix/sysv/linux/configure adds -mabi=ibmlongdouble to CFLAGS,
so this variable has to be filtered as well.
---
 sysdeps/powerpc/powerpc64/le/Makefile | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
index 7c036b45fc..2aaed2b75a 100644
--- a/sysdeps/powerpc/powerpc64/le/Makefile
+++ b/sysdeps/powerpc/powerpc64/le/Makefile
@@ -95,8 +95,12 @@ $(foreach suf,$(all-object-suffixes),\
          $(objpfx)test-narrow-macros-ldbl-64$(suf) \
          $(objpfx)test-nldbl-redirect$(suf) \
          $(objpfx)test-redirection-ldbl-64$(suf) \
-         ): sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS))
-
+         ): CFLAGS := $(filter-out -mabi=%longdouble,$(CFLAGS))
+$(foreach suf,$(all-object-suffixes),\
+         $(objpfx)test-narrow-macros-ldbl-64$(suf) \
+         $(objpfx)test-nldbl-redirect$(suf) \
+         $(objpfx)test-redirection-ldbl-64$(suf) \
+         ): sysdep-CFLAGS := $(filter-out -mabi=%longdouble,$(sysdep-CFLAGS))
 endif
 
 # Newer GCC (>7) doesn't like -mabi=* and -mlong-double-64
@@ -104,14 +108,21 @@ ifeq ($(subdir),misc)
 $(foreach suf,$(all-object-suffixes),\
          $(objpfx)tst-nldbl-warn$(suf) \
          $(objpfx)tst-nldbl-error$(suf) \
-         ): sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS))
+         ): CFLAGS := $(filter-out -mabi=%longdouble,$(CFLAGS))
+$(foreach suf,$(all-object-suffixes),\
+         $(objpfx)tst-nldbl-warn$(suf) \
+         $(objpfx)tst-nldbl-error$(suf) \
+         ): sysdep-CFLAGS := $(filter-out -mabi=%longdouble,$(sysdep-CFLAGS))
 endif
 
 # Newer GCC (>7) doesn't like -mabi=* and -mlong-double-64
 ifeq ($(subdir),argp)
 $(foreach suf,$(all-object-suffixes),\
          $(objpfx)tst-nldbl-argp$(suf) \
-         ): sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS))
+         ): CFLAGS := $(filter-out -mabi=%longdouble,$(CFLAGS))
+$(foreach suf,$(all-object-suffixes),\
+         $(objpfx)tst-nldbl-argp$(suf) \
+         ): sysdep-CFLAGS := $(filter-out -mabi=%longdouble,$(sysdep-CFLAGS))
 endif
 
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ppc64le: gcc 12 vs -mabi=ibmlongdouble
  2022-01-24 15:38 ` Florian Weimer
@ 2022-01-24 16:44   ` Bill Schmidt
  2022-01-24 18:32     ` Florian Weimer
  2022-01-24 17:37   ` Adhemerval Zanella
  2022-01-24 17:46   ` Paul E Murphy
  2 siblings, 1 reply; 7+ messages in thread
From: Bill Schmidt @ 2022-01-24 16:44 UTC (permalink / raw)
  To: Florian Weimer, DJ Delorie via Libc-alpha
  Cc: Tulio Magno Quites Machado Filho

I ran this by our GCC team, and the tentative consensus is that 
-mlong-double-64 should override -mabi=ibmlongdouble, rather than 
reporting an error in the compile flags.  DJ, could you please
open a bug against the GCC powerpc target?

Thanks!
Bill

On 1/24/22 9:38 AM, Florian Weimer via Libc-alpha wrote:
> * DJ Delorie via Libc-alpha:
>
>> I've been working on updating glibc for Fedora Rawhide, and have
>> stumbled upon this issue (after working around the -Wuse-after-free
>> issues with a cflags hack)...  A few of the math tests explicitly add
>> -mlong-double-64 but configure adds -mabi=ibmlongdouble
>>
>> I would guess that we need a "CFLAGS -= -mabi=ibmlongdouble" in all
>> the places we add -mlong-double-64 but I don't see an easy way of
>> doing that, nor am I sure that's a valid solution.  Alternately, gcc
>> could be changed to accept the conflicting flags in a meaningful way,
>> if there is one.  Is there an -mabi= that undoes the
>> -mabi=ibmlongdouble that we can just add to the -mlong-double-64 flag
>> lines?
>> cc1: error: '-mabi=ibmlongdouble' requires '-mlong-double-128'
> I was able to reproduce with a GCC 12 build configured using
> --with-long-double-format=ieee.
>
> I tried the attached patch to remove the unwanted -mabi=ibmlongdouble,
> but it does not work: it removes CFLAGS-*.c processing as a side effect.
>
> Any suggestions how we can fix this properly?
>
> Thanks,
> Florian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ppc64le: gcc 12 vs -mabi=ibmlongdouble
  2022-01-24 15:38 ` Florian Weimer
  2022-01-24 16:44   ` Bill Schmidt
@ 2022-01-24 17:37   ` Adhemerval Zanella
  2022-01-24 17:46   ` Paul E Murphy
  2 siblings, 0 replies; 7+ messages in thread
From: Adhemerval Zanella @ 2022-01-24 17:37 UTC (permalink / raw)
  To: Florian Weimer, DJ Delorie via Libc-alpha
  Cc: Tulio Magno Quites Machado Filho



On 24/01/2022 12:38, Florian Weimer via Libc-alpha wrote:
> * DJ Delorie via Libc-alpha:
> 
>> I've been working on updating glibc for Fedora Rawhide, and have
>> stumbled upon this issue (after working around the -Wuse-after-free
>> issues with a cflags hack)...  A few of the math tests explicitly add
>> -mlong-double-64 but configure adds -mabi=ibmlongdouble
>>
>> I would guess that we need a "CFLAGS -= -mabi=ibmlongdouble" in all
>> the places we add -mlong-double-64 but I don't see an easy way of
>> doing that, nor am I sure that's a valid solution.  Alternately, gcc
>> could be changed to accept the conflicting flags in a meaningful way,
>> if there is one.  Is there an -mabi= that undoes the
>> -mabi=ibmlongdouble that we can just add to the -mlong-double-64 flag
>> lines?
> 
>> cc1: error: '-mabi=ibmlongdouble' requires '-mlong-double-128'
> 
> I was able to reproduce with a GCC 12 build configured using
> --with-long-double-format=ieee.
> 
> I tried the attached patch to remove the unwanted -mabi=ibmlongdouble,
> but it does not work: it removes CFLAGS-*.c processing as a side effect.
> 
> Any suggestions how we can fix this properly?

I think we will need add a concept of CFLAGS to build glibc itself and CFLAGS 
to build tests regarding ABI.  The '-mabi=ibmlongdouble' will
be added only libraries.

On sysdeps/powerpc/powerpc64/le/Makefile, add type-ldouble-CFLAGS but filtering
out $(tests), $(tests-internal), $(xtests), $(test-srcs), $(tests-time64),
and  $(xtests-time64) (maybe add a new rule to add all tests) and then 
add the required on each tests (we might know the default from configure,
but I think it would be simple to always add the long double abi flags).

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ppc64le: gcc 12 vs -mabi=ibmlongdouble
  2022-01-24 15:38 ` Florian Weimer
  2022-01-24 16:44   ` Bill Schmidt
  2022-01-24 17:37   ` Adhemerval Zanella
@ 2022-01-24 17:46   ` Paul E Murphy
  2022-01-24 17:56     ` Florian Weimer
  2 siblings, 1 reply; 7+ messages in thread
From: Paul E Murphy @ 2022-01-24 17:46 UTC (permalink / raw)
  To: Florian Weimer, DJ Delorie via Libc-alpha
  Cc: DJ Delorie, Tulio Magno Quites Machado Filho, Paul E. Murphy



On 1/24/22 9:38 AM, Florian Weimer wrote:
> * DJ Delorie via Libc-alpha:
> 
>> I've been working on updating glibc for Fedora Rawhide, and have
>> stumbled upon this issue (after working around the -Wuse-after-free
>> issues with a cflags hack)...  A few of the math tests explicitly add
>> -mlong-double-64 but configure adds -mabi=ibmlongdouble
>>
>> I would guess that we need a "CFLAGS -= -mabi=ibmlongdouble" in all
>> the places we add -mlong-double-64 but I don't see an easy way of
>> doing that, nor am I sure that's a valid solution.  Alternately, gcc
>> could be changed to accept the conflicting flags in a meaningful way,
>> if there is one.  Is there an -mabi= that undoes the
>> -mabi=ibmlongdouble that we can just add to the -mlong-double-64 flag
>> lines?

For the sake of my clarification, does this affect more than the 6 test 
cases/files in ldbl-opt Makefile? If not, could the removal be handled 
case-by-case in sysdeps/powerpc/powerpc64/le/Makefile?

> 
>> cc1: error: '-mabi=ibmlongdouble' requires '-mlong-double-128'
> 
> I was able to reproduce with a GCC 12 build configured using
> --with-long-double-format=ieee.
> 
> I tried the attached patch to remove the unwanted -mabi=ibmlongdouble,
> but it does not work: it removes CFLAGS-*.c processing as a side effect.
> 
> Any suggestions how we can fix this properly?
> 
> Thanks,
> Florian
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ppc64le: gcc 12 vs -mabi=ibmlongdouble
  2022-01-24 17:46   ` Paul E Murphy
@ 2022-01-24 17:56     ` Florian Weimer
  0 siblings, 0 replies; 7+ messages in thread
From: Florian Weimer @ 2022-01-24 17:56 UTC (permalink / raw)
  To: Paul E Murphy
  Cc: DJ Delorie via Libc-alpha, DJ Delorie,
	Tulio Magno Quites Machado Filho, Paul E. Murphy

* Paul E. Murphy:

> On 1/24/22 9:38 AM, Florian Weimer wrote:
>> * DJ Delorie via Libc-alpha:
>> 
>>> I've been working on updating glibc for Fedora Rawhide, and have
>>> stumbled upon this issue (after working around the -Wuse-after-free
>>> issues with a cflags hack)...  A few of the math tests explicitly add
>>> -mlong-double-64 but configure adds -mabi=ibmlongdouble
>>>
>>> I would guess that we need a "CFLAGS -= -mabi=ibmlongdouble" in all
>>> the places we add -mlong-double-64 but I don't see an easy way of
>>> doing that, nor am I sure that's a valid solution.  Alternately, gcc
>>> could be changed to accept the conflicting flags in a meaningful way,
>>> if there is one.  Is there an -mabi= that undoes the
>>> -mabi=ibmlongdouble that we can just add to the -mlong-double-64 flag
>>> lines?
>
> For the sake of my clarification, does this affect more than the 6
> test cases/files in ldbl-opt Makefile? If not, could the removal be
> handled case-by-case in sysdeps/powerpc/powerpc64/le/Makefile?

That's what I tried in my patch, but it seems to interact negatively
with other make constructs, so any CFLAGS-*.c settings stop working for
these targets.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ppc64le: gcc 12 vs -mabi=ibmlongdouble
  2022-01-24 16:44   ` Bill Schmidt
@ 2022-01-24 18:32     ` Florian Weimer
  0 siblings, 0 replies; 7+ messages in thread
From: Florian Weimer @ 2022-01-24 18:32 UTC (permalink / raw)
  To: Bill Schmidt; +Cc: DJ Delorie via Libc-alpha, Tulio Magno Quites Machado Filho

* Bill Schmidt:

> I ran this by our GCC team, and the tentative consensus is that 
> -mlong-double-64 should override -mabi=ibmlongdouble, rather than 
> reporting an error in the compile flags.  DJ, could you please
> open a bug against the GCC powerpc target?

I went ahead and filed a P1 bug, as agreed on the call:

  -mlong-double-64 should override a previous -mabi=ibmlongdouble
  <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104208>

Thanks,
Florian


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-01-24 18:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-22  6:34 ppc64le: gcc 12 vs -mabi=ibmlongdouble DJ Delorie
2022-01-24 15:38 ` Florian Weimer
2022-01-24 16:44   ` Bill Schmidt
2022-01-24 18:32     ` Florian Weimer
2022-01-24 17:37   ` Adhemerval Zanella
2022-01-24 17:46   ` Paul E Murphy
2022-01-24 17:56     ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).