Re: libgfortran.so SONAME and powerpc64le-linux ABI changes (work in progress patches)
On Mon, Nov 01, 2021 at 10:56:33AM -0500, Bill Schmidt wrote: > Would starting from Advance Toolchain 15 with the most recent glibc make > things easier for Thomas to test? The problem is gcc135 runs Centos 7.x which is not compatible with AT 13-15. -- Michael Meissner, IBM PO Box 98, Ayer, Massachusetts, USA, 01432 email: meiss...@linux.ibm.com
Re: libgfortran.so SONAME and powerpc64le-linux ABI changes (work in progress patches)
Would starting from Advance Toolchain 15 with the most recent glibc make things easier for Thomas to test? Thanks, Bill On 10/29/21 4:06 PM, Michael Meissner via Gcc wrote: > On Fri, Oct 29, 2021 at 09:07:38PM +0200, Thomas Koenig wrote: >> Hi Michael, >> >> I tried this out on the one POWER machine where I can get something >> installed :-) It runs Ubuntu 20.04, but does not appear to have the >> right glibc version; it has >> >> $ lsb_release -a >> No LSB modules are available. >> Distributor ID: Ubuntu >> Description:Ubuntu 20.04.1 LTS >> Release:20.04 >> Codename: focal >> $ ldd --version >> ldd (Ubuntu GLIBC 2.31-0ubuntu9.1) 2.31 >> >> Configure was >> >> ./trunk/configure --prefix=$HOME --enable-languages=c,c++,fortran >> --with-advance-toolchain=at15.0 >> --with-native-system-header-dir=/opt/at15.0/include >> --with-long-double-format=ieee >> >> and the error message >> >> msgfmt -o fr.mo ../../../../trunk/libstdc++-v3/po/fr.po >> msgfmt: /lib/powerpc64le-linux-gnu/libm.so.6: version `GLIBC_2.32' not found >> (required by >> /home/ig25/trunk-bin/powerpc64le-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6) >> msgfmt: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.33' not found >> (required by >> /home/ig25/trunk-bin/powerpc64le-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6) >> msgfmt: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.34' not found >> (required by >> /home/ig25/trunk-bin/powerpc64le-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6) >> msgfmt: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.32' not found >> (required by >> /home/ig25/trunk-bin/powerpc64le-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6) >> msgfmt: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.34' not found >> (required by /home/ig25/trunk-bin/./gcc/libgcc_s.so.1) >> >> and so on. >> >> Since gcc135 is also too old, that exhausts my possibilities at testing. >> >> Any hints on how best to proceed? >> >> Best regards > As I've delved into it, it looks glibc 2.34 is really only needed for > switching > long double over to IEEE 128-bit, since it has all of the F128 functions that > would be needed. That is because Fortran uses the 'q' names which are in > libquadmath (that should be built). > > I built the original version with: > > --prefix=/home/meissner/fsf-install-ppc64le/fortran-orig \ > --enable-languages=c,c++,fortran \ > --disable-plugin \ > --enable-checking \ > --enable-stage1-checking \ > --enable-gnu-indirect-function \ > --disable-libgomp \ > --enable-decimal-float \ > --enable-secureplt \ > --enable-threads=posix \ > --enable-__cxa_atexit \ > --with-long-double-128 \ > --with-long-double-format=ibm \ > --with-cpu=power9 \ > --with-as=/opt/at12.0/bin/as \ > --with-ld=/opt/at12.0/bin/ld \ > --with-gnu-as=/opt/at12.0/bin/as \ > --with-gnu-ld=/opt/at12.0/bin/ld \ > --with-gmp=/home/meissner/tools-compiler/ppc64le \ > --with-mpfr=/home/meissner/tools-compiler/ppc64le \ > --with-mpc=/home/meissner/tools-compiler/ppc64le \ > --without-ppl \ > --without-cloog \ > --without-isl > > I needed to build my own version of mpfs, mpc, and gmp. I built them without > shared libraries, because I get messages like you get. > > I have a new version of the patch that makes new target hooks to allow the > backend to specify KIND numbers for types. I choose kind=16 to always be IEEE > 128-bit, and kind=15 to be long double if long double is IBM (since I > discovered yesterday, Fortran needs to be able to deal with long double). I'm > in the middle of the build an on internal IBM system, and I will start the > build on gcc135 shortly. >
Re: libgfortran.so SONAME and powerpc64le-linux ABI changes (work in progress patches)
On Fri, Oct 29, 2021 at 11:21:33PM +0200, Bernhard Reutner-Fischer wrote: > Michael, > > On Thu, 28 Oct 2021 23:36:20 -0400 > Michael Meissner via Fortran wrote: > > ISTM the second > @defmac FORTRAN_USE_LONG_DOUBLE > in tm.texi.in should be FORTRAN_USE_FLOAT128 Thanks. I had noticed that afterwards. Note, the next patches will delete those macros, because I discovered it was unworkable. -- Michael Meissner, IBM PO Box 98, Ayer, Massachusetts, USA, 01432 email: meiss...@linux.ibm.com
Re: libgfortran.so SONAME and powerpc64le-linux ABI changes (work in progress patches)
On Fri, Oct 29, 2021 at 09:07:38PM +0200, Thomas Koenig wrote: > Hi Michael, > > I tried this out on the one POWER machine where I can get something > installed :-) It runs Ubuntu 20.04, but does not appear to have the > right glibc version; it has > > $ lsb_release -a > No LSB modules are available. > Distributor ID: Ubuntu > Description:Ubuntu 20.04.1 LTS > Release:20.04 > Codename: focal > $ ldd --version > ldd (Ubuntu GLIBC 2.31-0ubuntu9.1) 2.31 > > Configure was > > ./trunk/configure --prefix=$HOME --enable-languages=c,c++,fortran > --with-advance-toolchain=at15.0 > --with-native-system-header-dir=/opt/at15.0/include > --with-long-double-format=ieee > > and the error message > > msgfmt -o fr.mo ../../../../trunk/libstdc++-v3/po/fr.po > msgfmt: /lib/powerpc64le-linux-gnu/libm.so.6: version `GLIBC_2.32' not found > (required by > /home/ig25/trunk-bin/powerpc64le-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6) > msgfmt: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.33' not found > (required by > /home/ig25/trunk-bin/powerpc64le-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6) > msgfmt: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.34' not found > (required by > /home/ig25/trunk-bin/powerpc64le-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6) > msgfmt: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.32' not found > (required by > /home/ig25/trunk-bin/powerpc64le-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6) > msgfmt: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.34' not found > (required by /home/ig25/trunk-bin/./gcc/libgcc_s.so.1) > > and so on. > > Since gcc135 is also too old, that exhausts my possibilities at testing. > > Any hints on how best to proceed? > > Best regards As I've delved into it, it looks glibc 2.34 is really only needed for switching long double over to IEEE 128-bit, since it has all of the F128 functions that would be needed. That is because Fortran uses the 'q' names which are in libquadmath (that should be built). I built the original version with: --prefix=/home/meissner/fsf-install-ppc64le/fortran-orig \ --enable-languages=c,c++,fortran \ --disable-plugin \ --enable-checking \ --enable-stage1-checking \ --enable-gnu-indirect-function \ --disable-libgomp \ --enable-decimal-float \ --enable-secureplt \ --enable-threads=posix \ --enable-__cxa_atexit \ --with-long-double-128 \ --with-long-double-format=ibm \ --with-cpu=power9 \ --with-as=/opt/at12.0/bin/as \ --with-ld=/opt/at12.0/bin/ld \ --with-gnu-as=/opt/at12.0/bin/as \ --with-gnu-ld=/opt/at12.0/bin/ld \ --with-gmp=/home/meissner/tools-compiler/ppc64le \ --with-mpfr=/home/meissner/tools-compiler/ppc64le \ --with-mpc=/home/meissner/tools-compiler/ppc64le \ --without-ppl \ --without-cloog \ --without-isl I needed to build my own version of mpfs, mpc, and gmp. I built them without shared libraries, because I get messages like you get. I have a new version of the patch that makes new target hooks to allow the backend to specify KIND numbers for types. I choose kind=16 to always be IEEE 128-bit, and kind=15 to be long double if long double is IBM (since I discovered yesterday, Fortran needs to be able to deal with long double). I'm in the middle of the build an on internal IBM system, and I will start the build on gcc135 shortly. -- Michael Meissner, IBM PO Box 98, Ayer, Massachusetts, USA, 01432 email: meiss...@linux.ibm.com
Re: libgfortran.so SONAME and powerpc64le-linux ABI changes (work in progress patches)
Michael, On Thu, 28 Oct 2021 23:36:20 -0400 Michael Meissner via Fortran wrote: ISTM the second @defmac FORTRAN_USE_LONG_DOUBLE in tm.texi.in should be FORTRAN_USE_FLOAT128 thanks,
Re: libgfortran.so SONAME and powerpc64le-linux ABI changes (work in progress patches)
Hi Michael, I tried this out on the one POWER machine where I can get something installed :-) It runs Ubuntu 20.04, but does not appear to have the right glibc version; it has $ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description:Ubuntu 20.04.1 LTS Release:20.04 Codename: focal $ ldd --version ldd (Ubuntu GLIBC 2.31-0ubuntu9.1) 2.31 Configure was ./trunk/configure --prefix=$HOME --enable-languages=c,c++,fortran --with-advance-toolchain=at15.0 --with-native-system-header-dir=/opt/at15.0/include --with-long-double-format=ieee and the error message msgfmt -o fr.mo ../../../../trunk/libstdc++-v3/po/fr.po msgfmt: /lib/powerpc64le-linux-gnu/libm.so.6: version `GLIBC_2.32' not found (required by /home/ig25/trunk-bin/powerpc64le-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6) msgfmt: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /home/ig25/trunk-bin/powerpc64le-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6) msgfmt: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /home/ig25/trunk-bin/powerpc64le-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6) msgfmt: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /home/ig25/trunk-bin/powerpc64le-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6) msgfmt: /lib/powerpc64le-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /home/ig25/trunk-bin/./gcc/libgcc_s.so.1) and so on. Since gcc135 is also too old, that exhausts my possibilities at testing. Any hints on how best to proceed? Best regards Thomas
Re: libgfortran.so SONAME and powerpc64le-linux ABI changes (work in progress patches)
Here are the patches I worked on today. It does seem to fix KIND=16 to use Float128, but by not considering long double for KIND processing, it breaks the tests that want to do ISO C binding to long double. Feel free to completely ignore the patches and go off in a different direction. But I thought it would be useful to share what I've done. > From 443773ac040383311384577b48ecc0bd957ff328 Mon Sep 17 00:00:00 2001 > From: Michael Meissner > Date: Thu, 28 Oct 2021 23:23:53 -0400 > Subject: [PATCH] Initial patch for PowerPC Fortran KIND=16 This is a work in progress patch. It attempts to make Fortran KIND=16 to always mean Float128 on PowerPC VSX systems. Unfortunately, in changing KIND=16 to Float128, it breaks all of the ISO C bindings for long double support in Fortran. gcc/ 2021-10-28 Michael Meissner * config/rs6000/rs6000.h (FORTRAN_USE_FLOAT128): New macro. (FORTRAN_USE_LONG_DOUBLE): New macro. * tree.h (complex_float128_type_node): Define. * doc/tm.texi.in (FORTRAN_USE_FLOAT128): Add documentation. (FORTRAN_USE_LONG_DOUBLE): Likewise. * doc/tm.texi: Regenerate. gcc/fortran/ 2021-10-28 Michael Meissner * f95-lang.c (gfc_init_builtin_functions): Flesh out more Float128 support. * gfortran.h (FORTRAN_USE_LONG_DOUBLE): Provide default definition. (FORTRAN_USE_FLOAT128): Likewise. * trans-types.c (gfc_init_kinds): Add support for FORTRAN_USE_LONG_DOUBLE and FORTRAN_USE_FLOAT128. (gfc_build_real_type): Likewise. (gfc_build_complex_type): Add support for Float128 complex. --- gcc/config/rs6000/rs6000.h | 10 ++ gcc/doc/tm.texi| 13 + gcc/doc/tm.texi.in | 13 + gcc/fortran/f95-lang.c | 28 gcc/fortran/gfortran.h | 13 + gcc/fortran/trans-types.c | 24 +--- gcc/tree.h | 2 ++ 7 files changed, 96 insertions(+), 7 deletions(-) diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 3eba1c072cf..4e016e548db 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -2691,3 +2691,13 @@ while (0) rs6000_asm_output_opcode (STREAM); \ } \ while (0) + +/* Whether Fortran should use long double or __float128 for KIND=16. If we + support IEEE 128-bit and long double is not IEEE 128-bit, then use the + _Float128 type for KIND=16. Otherwise use long double. */ +#undef FORTRAN_USE_FLOAT128 +#define FORTRAN_USE_FLOAT128 (TARGET_FLOAT128_TYPE && !TARGET_IEEEQUAD) + +#undef FORTRAN_USE_LONG_DOUBLE +#define FORTRAN_USE_LONG_DOUBLE(!FORTRAN_USE_FLOAT128) + diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 902402d7503..13ecca2605c 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -12612,3 +12612,16 @@ counters are incremented using atomic operations. Targets not supporting 64-bit atomic operations may override the default value and request a 32-bit type. @end deftypefn + +@defmac FORTRAN_USE_LONG_DOUBLE +Define this macro to return true if Fortran should enable @code{long +double} support for @code{KIND} processing. If you do not define this +macro, Fortran always uses the @code{long double} type. +@end defmac + +@defmac FORTRAN_USE_LONG_DOUBLE +Define this macro to return true if Fortran should enable +@code{_Float128} support for @code{KIND} processing. If you do not +define this macro, Fortran will enable @code{_Float128} support if the +quadmath library is built, and the mode @code{TFmode} is enabled. +@end defmac diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 86352dc9bd2..012ef1ecc98 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -8187,3 +8187,16 @@ maintainer is familiar with. @hook TARGET_MEMTAG_UNTAGGED_POINTER @hook TARGET_GCOV_TYPE_SIZE + +@defmac FORTRAN_USE_LONG_DOUBLE +Define this macro to return true if Fortran should enable @code{long +double} support for @code{KIND} processing. If you do not define this +macro, Fortran always uses the @code{long double} type. +@end defmac + +@defmac FORTRAN_USE_LONG_DOUBLE +Define this macro to return true if Fortran should enable +@code{_Float128} support for @code{KIND} processing. If you do not +define this macro, Fortran will enable @code{_Float128} support if the +quadmath library is built, and the mode @code{TFmode} is enabled. +@end defmac diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c index 58dcaf01d75..b8117dc72b4 100644 --- a/gcc/fortran/f95-lang.c +++ b/gcc/fortran/f95-lang.c @@ -674,9 +674,11 @@ gfc_init_builtin_functions (void) tree mfunc_float[6]; tree mfunc_double[6]; tree mfunc_longdouble[6]; + tree mfunc_float128[6]; tree mfunc_cfloat[6]; tree mfunc_cdouble[6]; tree mfunc_clongdouble[6]; + tree mfunc_cfloat128[6]; tree func_cfloat_float,