Go to file
Jakub Jelinek e79f6e61d5 libgfortran: Make sure glibc < 2.32 built powerpc64le-linux libgfortran doesn't use __*ieee128 APIs
I've just tried to build libgfortran on an old glibc system
(gcc112.fsffrance.org) and unfortunately we still have work to do:

[jakub@gcc2-power8 obj38]$ LD_PRELOAD=/home/jakub/gcc/obj38/powerpc64le-unknown-linux-gnu/libgfortran/.libs/libgfortran.so.5.0.0 /bin/true
[jakub@gcc2-power8 obj38]$ LD_BIND_NOW=1 LD_PRELOAD=/home/jakub/gcc/obj38/powerpc64le-unknown-linux-gnu/libgfortran/.libs/libgfortran.so.5.0.0 /bin/true
/bin/true: symbol lookup error: /home/jakub/gcc/obj38/powerpc64le-unknown-linux-gnu/libgfortran/.libs/libgfortran.so.5.0.0: undefined symbol: __atan2ieee128

While we do use some libquadmath APIs:
readelf -Wr /home/jakub/gcc/obj38/powerpc64le-unknown-linux-gnu/libgfortran/.libs/libgfortran.so.5.0.0 | grep QUADMATH
0000000000251268  000005e400000026 R_PPC64_ADDR64         0000000000000000 quadmath_snprintf@QUADMATH_1.0 + 0
0000000000251270  0000030600000026 R_PPC64_ADDR64         0000000000000000 strtoflt128@QUADMATH_1.0 + 0
00000000002502e0  0000011600000015 R_PPC64_JMP_SLOT       0000000000000000 ynq@QUADMATH_1.0 + 0
0000000000250390  0000016000000015 R_PPC64_JMP_SLOT       0000000000000000 sqrtq@QUADMATH_1.0 + 0
0000000000250508  000001fa00000015 R_PPC64_JMP_SLOT       0000000000000000 fmaq@QUADMATH_1.0 + 0
0000000000250530  0000021200000015 R_PPC64_JMP_SLOT       0000000000000000 fabsq@QUADMATH_1.0 + 0
0000000000250760  0000030600000015 R_PPC64_JMP_SLOT       0000000000000000 strtoflt128@QUADMATH_1.0 + 0
0000000000250990  000003df00000015 R_PPC64_JMP_SLOT       0000000000000000 cosq@QUADMATH_1.0 + 0
00000000002509f0  0000040a00000015 R_PPC64_JMP_SLOT       0000000000000000 expq@QUADMATH_1.0 + 0
0000000000250a88  0000045100000015 R_PPC64_JMP_SLOT       0000000000000000 erfcq@QUADMATH_1.0 + 0
0000000000250a98  0000045e00000015 R_PPC64_JMP_SLOT       0000000000000000 jnq@QUADMATH_1.0 + 0
0000000000250ac8  0000047e00000015 R_PPC64_JMP_SLOT       0000000000000000 sinq@QUADMATH_1.0 + 0
0000000000250e38  000005db00000015 R_PPC64_JMP_SLOT       0000000000000000 fmodq@QUADMATH_1.0 + 0
0000000000250e48  000005e000000015 R_PPC64_JMP_SLOT       0000000000000000 tanq@QUADMATH_1.0 + 0
0000000000250e58  000005e400000015 R_PPC64_JMP_SLOT       0000000000000000 quadmath_snprintf@QUADMATH_1.0 + 0
0000000000250f20  0000062900000015 R_PPC64_JMP_SLOT       0000000000000000 copysignq@QUADMATH_1.0 + 0
we don't do it consistently:
readelf -Wr /home/jakub/gcc/obj38/powerpc64le-unknown-linux-gnu/libgfortran/.libs/libgfortran.so.5.0.0 | grep ieee128
0000000000250310  0000012800000015 R_PPC64_JMP_SLOT       0000000000000000 __atan2ieee128 + 0
0000000000250340  0000014200000015 R_PPC64_JMP_SLOT       0000000000000000 __clogieee128 + 0
0000000000250438  000001a300000015 R_PPC64_JMP_SLOT       0000000000000000 __acoshieee128 + 0
00000000002504b8  000001cc00000015 R_PPC64_JMP_SLOT       0000000000000000 __csinieee128 + 0
0000000000250500  000001f300000015 R_PPC64_JMP_SLOT       0000000000000000 __sinhieee128 + 0
0000000000250570  0000022a00000015 R_PPC64_JMP_SLOT       0000000000000000 __asinieee128 + 0
0000000000250580  0000022d00000015 R_PPC64_JMP_SLOT       0000000000000000 __roundieee128 + 0
00000000002505a0  0000023e00000015 R_PPC64_JMP_SLOT       0000000000000000 __logieee128 + 0
00000000002505c8  0000024900000015 R_PPC64_JMP_SLOT       0000000000000000 __tanieee128 + 0
0000000000250630  0000027500000015 R_PPC64_JMP_SLOT       0000000000000000 __ccosieee128 + 0
0000000000250670  0000028a00000015 R_PPC64_JMP_SLOT       0000000000000000 __log10ieee128 + 0
00000000002506c8  000002bd00000015 R_PPC64_JMP_SLOT       0000000000000000 __cexpieee128 + 0
00000000002506d8  000002c800000015 R_PPC64_JMP_SLOT       0000000000000000 __coshieee128 + 0
00000000002509b0  000003ef00000015 R_PPC64_JMP_SLOT       0000000000000000 __truncieee128 + 0
0000000000250af8  000004a600000015 R_PPC64_JMP_SLOT       0000000000000000 __expieee128 + 0
0000000000250b50  000004c600000015 R_PPC64_JMP_SLOT       0000000000000000 __fmodieee128 + 0
0000000000250bb0  000004e700000015 R_PPC64_JMP_SLOT       0000000000000000 __tanhieee128 + 0
0000000000250c38  0000051300000015 R_PPC64_JMP_SLOT       0000000000000000 __acosieee128 + 0
0000000000250ce0  0000055400000015 R_PPC64_JMP_SLOT       0000000000000000 __sinieee128 + 0
0000000000250d60  0000057e00000015 R_PPC64_JMP_SLOT       0000000000000000 __atanieee128 + 0
0000000000250dd8  000005b100000015 R_PPC64_JMP_SLOT       0000000000000000 __sqrtieee128 + 0
0000000000250e98  0000060200000015 R_PPC64_JMP_SLOT       0000000000000000 __cosieee128 + 0
0000000000250eb0  0000060a00000015 R_PPC64_JMP_SLOT       0000000000000000 __atanhieee128 + 0
0000000000250ef0  0000062000000015 R_PPC64_JMP_SLOT       0000000000000000 __asinhieee128 + 0
0000000000250fd8  0000067f00000015 R_PPC64_JMP_SLOT       0000000000000000 __csqrtieee128 + 0
0000000000251038  000006ad00000015 R_PPC64_JMP_SLOT       0000000000000000 __cabsieee128 + 0
All these should for POWER_IEEE128 use atan2q@QUADMATH_1.0 etc.

It seems all these come from f951 compiled sources.
For user code, I think the agreement was if you want to use successfully
-mabi=ieeelongdouble, you need glibc 2.32 or later, which is why the Fortran
FE doesn't conditionalize on whether glibc 2.32 is available or not and just
emits __WHATEVERieee128 entrypoints.
But for Fortran compiled sources in libgfortran, we need to use
__WHATEVERieee128 only if glibc 2.32 or later and WHATEVERq (from
libquadmath) otherwise.

The following patch implements that, adds -fbuilding-libgfortran option
similar to e.g. -fbuilding-libgcc used when building libgcc and if
that option is set and the TARGET_GLIBC_{MAJOR,MINOR} macros indicate
no glibc or glibc older than 2.32, it will use the libquadmath APIs
rather than glibc 2.32 APIs.

2022-01-07  Jakub Jelinek  <jakub@redhat.com>

gcc/fortran/
	* trans-types.c (gfc_init_kinds): When setting abi_kind to 17, if not
	targetting glibc 2.32 or later and -fbuilding-libgfortran, set
	gfc_real16_is_float128 and c_float128 in gfc_real_kinds.
	(gfc_build_real_type): Don't set c_long_double if c_float128 is
	already set.
	* trans-intrinsic.c (builtin_decl_for_precision): Don't use
	long_double_built_in if gfc_real16_is_float128 and
	long_double_type_node == gfc_float128_type_node.
	* lang.opt (fbuilding-libgfortran): New undocumented option.
libgfortran/
	* Makefile.am (AM_FCFLAGS): Add -fbuilding-libgfortran after
	-fallow-leading-underscore.
	* Makefile.in: Regenerated.
2022-01-11 23:49:52 +01:00
c++tools Update copyright years. 2022-01-03 10:42:10 +01:00
config Daily bump. 2021-12-22 00:16:30 +00:00
contrib check-MAINTAINERS.py: use sys.argv[1] 2022-01-11 14:29:54 +01:00
fixincludes Daily bump. 2022-01-07 00:16:24 +00:00
gcc libgfortran: Make sure glibc < 2.32 built powerpc64le-linux libgfortran doesn't use __*ieee128 APIs 2022-01-11 23:49:52 +01:00
gnattools Daily bump. 2021-10-23 00:16:26 +00:00
gotools
include Update copyright years. 2022-01-03 10:42:10 +01:00
INSTALL
intl Daily bump. 2021-11-30 00:16:44 +00:00
libada Update copyright years. 2022-01-03 10:42:10 +01:00
libatomic Update copyright years. 2022-01-03 10:42:10 +01:00
libbacktrace Update copyright years. 2022-01-03 10:42:10 +01:00
libcc1 Update copyright years. 2022-01-03 10:42:10 +01:00
libcody Update Copyright in ChangeLog files 2022-01-03 10:31:39 +01:00
libcpp Update copyright years. 2022-01-03 10:42:10 +01:00
libdecnumber Update copyright years. 2022-01-03 10:42:10 +01:00
libffi Daily bump. 2021-11-16 00:16:31 +00:00
libgcc Daily bump. 2022-01-05 00:16:52 +00:00
libgfortran libgfortran: Make sure glibc < 2.32 built powerpc64le-linux libgfortran doesn't use __*ieee128 APIs 2022-01-11 23:49:52 +01:00
libgo compiler, libgo: don't pad sparc64-linux epollevent 2021-12-29 15:52:23 -08:00
libgomp Daily bump. 2022-01-05 00:16:52 +00:00
libiberty Update copyright years. 2022-01-03 10:42:10 +01:00
libitm Daily bump. 2022-01-04 00:16:40 +00:00
libobjc Update copyright years. 2022-01-03 10:42:10 +01:00
liboffloadmic Daily bump. 2021-10-20 00:16:43 +00:00
libphobos Daily bump. 2022-01-04 00:16:40 +00:00
libquadmath libquadmath: Use -mno-gnu-attribute in libquadmath 2022-01-11 23:49:48 +01:00
libsanitizer Daily bump. 2021-12-07 00:16:23 +00:00
libssp Update copyright years. 2022-01-03 10:42:10 +01:00
libstdc++-v3 libstdc++: Install <source_location> header for freestanding [PR103726] 2022-01-11 18:36:36 +00:00
libvtv Update copyright years. 2022-01-03 10:42:10 +01:00
lto-plugin Update copyright years. 2022-01-03 10:42:10 +01:00
maintainer-scripts
zlib Daily bump. 2021-12-17 00:16:20 +00:00
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ar-lib
build.log Allow propagations from inner loop to outer loop. 2022-01-07 23:09:05 +08:00
ChangeLog Daily bump. 2022-01-11 00:16:36 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub config.sub: change mode to 755. 2021-12-21 09:10:57 +01:00
configure config: Add check whether D compiler works (PR103528) 2021-12-21 21:29:35 +01:00
configure.ac Revert "Sync with binutils: GCC: Pass --plugin to AR and RANLIB" 2021-12-15 20:45:58 -08:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4 Revert "Sync with binutils: GCC: Pass --plugin to AR and RANLIB" 2021-12-15 20:45:58 -08:00
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS Sort 2 names in ChangeLog. 2022-01-11 14:12:48 +01:00
Makefile.am Prepare library for REAL(KIND=17). 2022-01-11 23:39:54 +01:00
Makefile.def d: Import dmd b8384668f, druntime e6caaab9, phobos 5ab9ad256 (v2.098.0-beta.1) 2021-11-30 16:53:28 +01:00
Makefile.in Revert "Sync with binutils: GCC: Pass --plugin to AR and RANLIB" 2021-12-15 20:45:58 -08:00
Makefile.tpl Revert "Sync with binutils: GCC: Pass --plugin to AR and RANLIB" 2021-12-15 20:45:58 -08:00
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
symlink-tree
test-driver
ylwrap

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.