PowerPC: PR libgcc/97543, fix 64-bit long double issues
There are two issues in PR libgcc/97543 which shows up if you build a GCC
compiler with long double defaulting to 64-bit instead of 128-bit with IBM
extended double:
1) The first issue was the t-linux file forced the entire libgcc library
to be compiled with the -mlong-double-128 option.
2) The second issue is that the GNU attribute #4 is set to reflect using
128-bit long doubles, and you get linker warnings when you use use the
compiler, since libgcc_s.so indicates 128-bit IBM long doubles were
used. I ran into a similar issue with my patches to extend libgcc to
work if long doubles were configured to use the 128-bit IEEE format
instead of the 128-bit IBM format.
One feature of the current GNU attribute implementation is if you have a shared
library (such as libgcc_s.so), the GNU attributes for the shared library is an
inclusive OR of all of the modules within the library. This means if any
module uses the -mlong-double-128 option and uses long double, the GNU
attributes for the library will indicate that it uses 128-bit IBM long
doubles. If you have a static library, you will get the warning only if you
actually reference a module with the attribute set.
In addition to the issues for 64-bit long doubles, there are similar issues if
long double is configured to be IEEE 128-bit (PR libgcc/97643).
This patch does two things:
1) All of the modules that support IBM 128-bit long doubles explicitly set
the ABI to IBM extended double.
2) I turned off GNU attributes for building the shared library.
I have tested this by building a compiler on a little endian power9 system
running Linux with long double defaulting to 64-bits using the configure
option: --without-long-double-128, and I verified that the warning no longer is
generated by the linker.
I then built a bootstrap compiler, by first building a non-bootstrap version.
With that non-bootstrap compiler, I built versions of the MPC and MPFR. Using
those libraries, and the non-bootstrap compiler as the host compiler, I was
able to do a full bootstrap compiler.
There are differences in the regression test suite where the test implicitly
assumed long double was 128-bits or was a float128 test.
Can I install this patch into the master branch? I would also like to install
it in the GCC 10 branch after an appropriate period.
libgcc/
2020-11-10 Michael Meissner <meissner@linux.ibm.com>
PR libgcc/97543
PR libgcc/97643
* config/rs6000/t-linux (IBM128_STATIC_OBJS): New make variable.
Set all objects to use the explicit IBM format.
(IBM128_SHARD_CFLAGS): New make variable. Set all objects to use
the explicit IBM format.
(IBM128_SHARED_CFLAGS): New make variable.
(IBM128_STATIC_CFLAGS): New make variable.
(gcc_s_compile): Add -mno-gnu-attribute to all shared library
modules.