Message ID | 20180528220027.30943-1-tuliom@linux.ibm.com |
---|---|
State | New |
Headers | show |
Series | Move -mlong-double-128 away from platform-agnostic files | expand |
On Mon, 28 May 2018, Tulio Magno Quites Machado Filho wrote: > The compiler flag -mlong-double-128 is platform-specific and shouldn't > be used in platform-agnostic directories, such as ldbl-128ibm and > ldbl-opt. Theoretically, as a -m option, it's platform-specific. But in practice, I'm not sure that's really the case - certainly all existing platforms using ldbl-opt support -mlong-double-128 and -mlong-double-64. Indeed, sysdeps/ieee754/ldbl-opt/configure.ac tests that -mlong-double-128 is supported, and that __LONG_DOUBLE_128__ gets defined by the compiler; the ldbl-opt bits/long-double.h relies on that __LONG_DOUBLE_128__ macro; the ldbl-opt Makefile relies on -mlong-double-64 being available to build a test with that option (unfortunately there is only the one test for -mlong-double-64 support; new ieee128 interfaces should have more thorough test coverage added no later than when the interfaces are enabled for powerpc64le). > This was not a problem because all the architectures implying these > directories had to use -mlong-double-128 to set their long double type. > As powerpc64le is changing its default long double type to be binary > compatible with IEEE 128-bit floating point, this will have to change. But as far as I know the option is still supported for powerpc64le. And indeed it works fine together with -mabi=ieeelongdouble, and does not change the format away from IEEE, and -mlong-double-64 also works together with -mabi=ieeelongdouble (overriding it to make long double have the same ABI as double). So what is the actual problem you're trying to fix here? As far as I can tell, the existing code should work just fine for powerpc64le in the context of a changed long double default - you may need to *add* options somewhere else to ensure -mabi=ibmlongdouble or -mabi=ieeelongdouble are used to compile particular files (possibly together with -mno-gnu-attribute to avoid link errors for incompatible ABIs), but I don't see anything that would require -mlong-double-128 to be avoided, and thus don't see any need to duplicate the code using that option for different architectures.
Joseph Myers <joseph@codesourcery.com> writes: > On Mon, 28 May 2018, Tulio Magno Quites Machado Filho wrote: > >> This was not a problem because all the architectures implying these >> directories had to use -mlong-double-128 to set their long double type. >> As powerpc64le is changing its default long double type to be binary >> compatible with IEEE 128-bit floating point, this will have to change. > > But as far as I know the option is still supported for powerpc64le. And > indeed it works fine together with -mabi=ieeelongdouble, and does not > change the format away from IEEE, and -mlong-double-64 also works together > with -mabi=ieeelongdouble (overriding it to make long double have the same > ABI as double). > > So what is the actual problem you're trying to fix here? I'm trying to avoid compiler calls like this: gcc ... -mlong-double-128 ... \ ... -mabi=ieeelongdouble ... Because they make it hard to understand which long double format is being used in a multiline compiler command.
On Fri, 1 Jun 2018, Tulio Magno Quites Machado Filho wrote: > I'm trying to avoid compiler calls like this: > > gcc ... -mlong-double-128 ... \ > ... -mabi=ieeelongdouble ... > > Because they make it hard to understand which long double format is being used > in a multiline compiler command. I don't think they make it hard to understand; -mlong-double-128 says long double is 128-bit, which is true, and -mabi=ieeelongdouble says which particular 128-bit format is in use. If you wanted to avoid redundant -mlong-double-128, I think the way would be to adjust the configure test in ldbl-opt so it sets (via LIBC_CONFIG_VAR) a Makefile variable to empty if -mlong-double-128 is the default, and to -mlong-double-128 if it's not the default, and then the ldbl-opt Makefile would use that variable in setting sysdep-CFLAGS.
diff --git a/sysdeps/ieee754/ldbl-128ibm/Makefile b/sysdeps/ieee754/ldbl-128ibm/Makefile index bdba6cc6b5..caf118566b 100644 --- a/sysdeps/ieee754/ldbl-128ibm/Makefile +++ b/sysdeps/ieee754/ldbl-128ibm/Makefile @@ -2,7 +2,6 @@ # -mlong-double-128 option is used (or when it becomes a default # when -mlong-double-64 is not used). long-double-fcts = yes -sysdep-CFLAGS += -mlong-double-128 ifeq ($(subdir),stdlib) tests += tst-strtold-ldbl-128ibm diff --git a/sysdeps/ieee754/ldbl-opt/Makefile b/sysdeps/ieee754/ldbl-opt/Makefile index ef790adc77..92828cac0b 100644 --- a/sysdeps/ieee754/ldbl-opt/Makefile +++ b/sysdeps/ieee754/ldbl-opt/Makefile @@ -2,9 +2,6 @@ # -mlong-double-128 option is used (or when it becomes a default # when -mlong-double-64 is not used). long-double-fcts = yes -ifeq (,$(filter -mlong-double-128,$(sysdep-CFLAGS))) -sysdep-CFLAGS += -mlong-double-128 -endif ifeq ($(subdir),math) libm-routines += s_nexttowardfd diff --git a/sysdeps/powerpc/powerpc32/Makefile b/sysdeps/powerpc/powerpc32/Makefile index cf620c8269..03c1be3e74 100644 --- a/sysdeps/powerpc/powerpc32/Makefile +++ b/sysdeps/powerpc/powerpc32/Makefile @@ -47,3 +47,5 @@ ifeq ($(subdir),elf) # extra shared linker files to link only into dl-allobjs.so sysdep-rtld-routines += dl-start endif + +sysdep-CFLAGS += -mlong-double-128 diff --git a/sysdeps/powerpc/powerpc64/be/Makefile b/sysdeps/powerpc/powerpc64/be/Makefile new file mode 100644 index 0000000000..0ecff70b8d --- /dev/null +++ b/sysdeps/powerpc/powerpc64/be/Makefile @@ -0,0 +1 @@ +sysdep-CFLAGS += -mlong-double-128 diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile index 14d39e28b1..1be614008d 100644 --- a/sysdeps/powerpc/powerpc64/le/Makefile +++ b/sysdeps/powerpc/powerpc64/le/Makefile @@ -79,3 +79,5 @@ CFLAGS-printf_fp.c = -mfloat128 CFLAGS-printf_fphex.c = -mfloat128 CFLAGS-printf_size.c = -mfloat128 endif + +sysdep-CFLAGS += -mlong-double-128 diff --git a/sysdeps/unix/sysv/linux/alpha/Makefile b/sysdeps/unix/sysv/linux/alpha/Makefile index 50f4fb1183..dd346002aa 100644 --- a/sysdeps/unix/sysv/linux/alpha/Makefile +++ b/sysdeps/unix/sysv/linux/alpha/Makefile @@ -1,3 +1,7 @@ +ifeq (,$(filter -mlong-double-128,$(sysdep-CFLAGS))) +sysdep-CFLAGS += -mlong-double-128 +endif + ifeq ($(subdir),stdlib) gen-as-const-headers += ucontext-offsets.sym endif diff --git a/sysdeps/unix/sysv/linux/s390/Makefile b/sysdeps/unix/sysv/linux/s390/Makefile index 77f38523b5..20ce8450e3 100644 --- a/sysdeps/unix/sysv/linux/s390/Makefile +++ b/sysdeps/unix/sysv/linux/s390/Makefile @@ -2,6 +2,10 @@ abi-variants := 32 64 abi-32-condition := __WORDSIZE == 32 abi-64-condition := __WORDSIZE == 64 +ifeq (,$(filter -mlong-double-128,$(sysdep-CFLAGS))) +sysdep-CFLAGS += -mlong-double-128 +endif + ifeq ($(subdir),rt) librt-routines += rt-sysdep librt-shared-only-routines += rt-sysdep diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile b/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile index 21c7dc1680..0dba32b698 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile @@ -5,6 +5,10 @@ asm-CPPFLAGS = -D__ASSEMBLY__ ASFLAGS-.os += -fPIC LD += -melf32_sparc +ifeq (,$(filter -mlong-double-128,$(sysdep-CFLAGS))) +sysdep-CFLAGS += -mlong-double-128 +endif + ifeq ($(subdir),stdlib) gen-as-const-headers += ucontext_i.sym endif
The compiler flag -mlong-double-128 is platform-specific and shouldn't be used in platform-agnostic directories, such as ldbl-128ibm and ldbl-opt. This was not a problem because all the architectures implying these directories had to use -mlong-double-128 to set their long double type. As powerpc64le is changing its default long double type to be binary compatible with IEEE 128-bit floating point, this will have to change. Tested on powerpc, powerpc64 and powerpc64le. Tested with build-many-glibcs.py on alpha and s390x. 2018-05-28 Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com> * sysdeps/ieee754/ldbl-128ibm/Makefile: Move sysdeps-CFLAGS definition to... * sysdeps/powerpc/powerpc32/Makefile: ... here. * sysdeps/powerpc/powerpc64/be/Makefile: ... here. * sysdeps/powerpc/powerpc64/le/Makefile: ... and here. * sysdeps/ieee754/ldbl-opt/Makefile: Move sysdeps-CFLAGS definition to... * sysdeps/unix/sysv/linux/alpha/Makefile: ... here. * sysdeps/unix/sysv/linux/s390/Makefile: ... here. * sysdeps/unix/sysv/linux/sparc/sparc32/Makefile: ... and here. Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com> --- sysdeps/ieee754/ldbl-128ibm/Makefile | 1 - sysdeps/ieee754/ldbl-opt/Makefile | 3 --- sysdeps/powerpc/powerpc32/Makefile | 2 ++ sysdeps/powerpc/powerpc64/be/Makefile | 1 + sysdeps/powerpc/powerpc64/le/Makefile | 2 ++ sysdeps/unix/sysv/linux/alpha/Makefile | 4 ++++ sysdeps/unix/sysv/linux/s390/Makefile | 4 ++++ sysdeps/unix/sysv/linux/sparc/sparc32/Makefile | 4 ++++ 8 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 sysdeps/powerpc/powerpc64/be/Makefile