On Mon, Jan 03, 2022 at 04:36:21PM +0100, Jakub Jelinek via Gcc-patches wrote:
> The following patch adds the library side of -mabi=ieeelongdouble
> I/O support.
> 
> There is one issue to be resolved though, for the sake of libgfortran.a
> built on an older powerpc64le-linux system (glibc older than 2.32) and
> then deployed on glibc 2.32 or later, I believe we want to use
> _gfortran_transfer_real128_write etc. APIs so that we force in libquadmath
> in that case.  The following patch does that, but unfortunately it means
> that right now those
>    512: 00000000001a31d0    56 FUNC    GLOBAL DEFAULT   11 
> _gfortran_transfer_real128@@GFORTRAN_8     [<localentry>: 8]
>    920: 00000000001a3210    56 FUNC    GLOBAL DEFAULT   11 
> _gfortran_transfer_real128_write@@GFORTRAN_8       [<localentry>: 8]
>    487: 00000000001a3290    56 FUNC    GLOBAL DEFAULT   11 
> _gfortran_transfer_complex128_write@@GFORTRAN_8    [<localentry>: 8]
>    574: 00000000001a3250    56 FUNC    GLOBAL DEFAULT   11 
> _gfortran_transfer_complex128@@GFORTRAN_8  [<localentry>: 8]
> symbols.  But those symbols weren't exported on powerpc64le-linux in
> GCC 8, 9, 10 or 11, so they shouldn't be exported @@GFORTRAN_8, but 
> @@GFORTRAN_12.
> 
> So, either we'd need to add e.g. preprocessing support for gfortran.map

Note, an example of preprocessed version file is e.g. libgomp, in the
Makefile it does:
# -Wc is only a libtool option.
comma = ,
PREPROCESS = $(subst -Wc$(comma), , $(COMPILE)) -E

libgomp.ver: $(top_srcdir)/libgomp.map
        $(EGREP) -v '#(#| |$$)' $< | \
          $(PREPROCESS) -P -include config.h - > $@ || (rm -f $@ ; exit 1)
and in libgomp.map it has both:
#ifdef HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT
        # If the assembler used lacks the .symver directive or the linker
        # doesn't support GNU symbol versioning, we have the same symbol in
        # two versions, which Sun ld chokes on.
        omp_init_lock;
...
#endif
so we could similarly have something like:
#if !(defined(__powerpc64__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && 
__SIZEOF_LONG_DOUBLE__ == 16)
    _gfortran_transfer_complex128;
    _gfortran_transfer_complex128_write;
#endif
...
#if !(defined(__powerpc64__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && 
__SIZEOF_LONG_DOUBLE__ == 16)
    _gfortran_transfer_real128;
    _gfortran_transfer_real128_write;
#endif
...
#if defined(__powerpc64__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && 
__SIZEOF_LONG_DOUBLE__ == 16
  _gfortran_transfer_complex128;
  _gfortran_transfer_complex128_write;
  _gfortran_transfer_real128;
  _gfortran_transfer_real128_write;
#endif

or make that dependent on HAVE_GFC_REAL_17 or whatever else (with suitable
includes that only define macros and not actual C code).

        Jakub

Reply via email to