public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-9510] rs6000: Remove GCC 8.1 U10__float128 mangling compatibility [PR104172]
@ 2022-01-25 13:57 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2022-01-25 13:57 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:79b0091b13eb7dce0294407d9bd78750df10180d

commit r11-9510-g79b0091b13eb7dce0294407d9bd78750df10180d
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Jan 25 05:49:05 2022 +0100

    rs6000: Remove GCC 8.1 U10__float128 mangling compatibility [PR104172]
    
    In GCC 7.x and earlier, while it had -mabi=ieeelongdouble option, that option
    was undocumented and unsupported.
    In GCC 8.1 that option got documented and -mabi=ieeelongdouble long double started
    to be mangled as U10__float128.
    In GCC 9 and backported to before 8.2 release, that mangling changed to
    u9__ieee128 and a support for emitting compatibility mangling aliases have
    been added.
    Unfortunately, as mentioned in the PR, those don't really work well in many
    cases, the free_lang_data pass throws away important trees, so e.g. with
    -flto -ffat-lto-objects the compiler often ICEs on templates that involve
    IEEE quad long double arguments etc. because the mangling was done too late
    (at final time).
    Furthermore, lto1's mangler is not the C++ mangler, so with -flto it would
    often emit as "mangled identifiers" something that wasn't a valid assembler
    identifier, e.g. operator+ etc.
    While it is possible to do such mangling earlier, e.g. at the same time when
    the C++ FE emits its mangling aliases and untested proof of concept is in
    the PR, there seems to be agreement that we shouldn't bother with this
    ABI compatibility with something that probably nobody really used.
    GCC 8.2 already uses the new mangling, it was just a few months, but more
    importantly, libstdc++ support for IEEE quad long double on
    powerpc64le-linux was only added in GCC 11, and glibc support for that some
    weeks after 8.2 got released.
    
    So, the following patch just drops those aliases.
    
    2022-01-25  Jakub Jelinek  <jakub@redhat.com>
    
            PR target/104172
    gcc/
            * config/rs6000/rs6000-internal.h (rs6000_passes_ieee128): Don't
            declare.
            * config/rs6000/rs6000.c (rs6000_passes_ieee128,
            ieee128_mangling_gcc_8_1): Remove.
            (TARGET_ASM_GLOBALIZE_DECL_NAME): Don't redefine.
            (rs6000_mangle_type): Return "u9__ieee128" instead of
            ieee128_mangling_gcc_8_1 ? "U10__float128" : "u9__ieee128".
            (rs6000_globalize_decl_name): Remove.
            * config/rs6000/rs6000-call.c (init_cumulative_args,
            rs6000_function_arg_advance_1): Don't set rs6000_passes_ieee128.
    
    (cherry picked from commit f4ee27d3262fc4fc3e5d3535f195fdcf87d7ec77)

Diff:
---
 gcc/config/rs6000/rs6000-call.c     | 12 ---------
 gcc/config/rs6000/rs6000-internal.h |  3 ---
 gcc/config/rs6000/rs6000.c          | 53 +------------------------------------
 3 files changed, 1 insertion(+), 67 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 84b591512c4..ef20cb30388 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -6738,12 +6738,6 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype,
 			  && (TYPE_MAIN_VARIANT (return_type)
 			      == long_double_type_node))))
 		rs6000_passes_long_double = true;
-
-	      /* Note if we passed or return a IEEE 128-bit type.  We changed
-		 the mangling for these types, and we may need to make an alias
-		 with the old mangling.  */
-	      if (FLOAT128_IEEE_P (return_mode))
-		rs6000_passes_ieee128 = true;
 	    }
 	  if (ALTIVEC_OR_VSX_VECTOR_MODE (return_mode))
 	    rs6000_passes_vector = true;
@@ -7179,12 +7173,6 @@ rs6000_function_arg_advance_1 (CUMULATIVE_ARGS *cum, machine_mode mode,
 		  || (type != NULL
 		      && TYPE_MAIN_VARIANT (type) == long_double_type_node)))
 	    rs6000_passes_long_double = true;
-
-	  /* Note if we passed or return a IEEE 128-bit type.  We changed the
-	     mangling for these types, and we may need to make an alias with
-	     the old mangling.  */
-	  if (FLOAT128_IEEE_P (mode))
-	    rs6000_passes_ieee128 = true;
 	}
       if (named && ALTIVEC_OR_VSX_VECTOR_MODE (mode))
 	rs6000_passes_vector = true;
diff --git a/gcc/config/rs6000/rs6000-internal.h b/gcc/config/rs6000/rs6000-internal.h
index 88cf9bd5692..1fd9810844f 100644
--- a/gcc/config/rs6000/rs6000-internal.h
+++ b/gcc/config/rs6000/rs6000-internal.h
@@ -180,9 +180,6 @@ extern tree rs6000_fold_builtin (tree fndecl ATTRIBUTE_UNUSED,
 			         tree *args ATTRIBUTE_UNUSED,
 			         bool ignore ATTRIBUTE_UNUSED);
 
-#if TARGET_ELF
-extern bool rs6000_passes_ieee128;
-#endif
 extern bool rs6000_passes_float;
 extern bool rs6000_passes_long_double;
 extern bool rs6000_passes_vector;
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 3bd9643409e..c4f5c53932c 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -117,19 +117,6 @@ int dot_symbols;
    of this machine mode.  */
 scalar_int_mode rs6000_pmode;
 
-#if TARGET_ELF
-/* Note whether IEEE 128-bit floating point was passed or returned, either as
-   the __float128/_Float128 explicit type, or when long double is IEEE 128-bit
-   floating point.  We changed the default C++ mangling for these types and we
-   may want to generate a weak alias of the old mangling (U10__float128) to the
-   new mangling (u9__ieee128).  */
-bool rs6000_passes_ieee128 = false;
-#endif
-
-/* Generate the manged name (i.e. U10__float128) used in GCC 8.1, and not the
-   name used in current releases (i.e. u9__ieee128).  */
-static bool ieee128_mangling_gcc_8_1;
-
 /* Width in bits of a pointer.  */
 unsigned rs6000_pointer_size;
 
@@ -1758,11 +1745,6 @@ static const struct attribute_spec rs6000_attribute_table[] =
 #undef TARGET_STARTING_FRAME_OFFSET
 #define TARGET_STARTING_FRAME_OFFSET rs6000_starting_frame_offset
 
-#if TARGET_ELF && RS6000_WEAK
-#undef TARGET_ASM_GLOBALIZE_DECL_NAME
-#define TARGET_ASM_GLOBALIZE_DECL_NAME rs6000_globalize_decl_name
-#endif
-
 #undef TARGET_SETJMP_PRESERVES_NONVOLATILE_REGS_P
 #define TARGET_SETJMP_PRESERVES_NONVOLATILE_REGS_P hook_bool_void_true
 
@@ -20064,7 +20046,7 @@ rs6000_mangle_type (const_tree type)
   if (SCALAR_FLOAT_TYPE_P (type) && FLOAT128_IBM_P (TYPE_MODE (type)))
     return "g";
   if (SCALAR_FLOAT_TYPE_P (type) && FLOAT128_IEEE_P (TYPE_MODE (type)))
-    return ieee128_mangling_gcc_8_1 ? "U10__float128" : "u9__ieee128";
+    return "u9__ieee128";
 
   if (type == vector_pair_type_node)
     return "u13__vector_pair";
@@ -27759,39 +27741,6 @@ rs6000_starting_frame_offset (void)
 }
 \f
 
-/* Create an alias for a mangled name where we have changed the mangling (in
-   GCC 8.1, we used U10__float128, and now we use u9__ieee128).  This is called
-   via the target hook TARGET_ASM_GLOBALIZE_DECL_NAME.  */
-
-#if TARGET_ELF && RS6000_WEAK
-static void
-rs6000_globalize_decl_name (FILE * stream, tree decl)
-{
-  const char *name = XSTR (XEXP (DECL_RTL (decl), 0), 0);
-
-  targetm.asm_out.globalize_label (stream, name);
-
-  if (rs6000_passes_ieee128 && name[0] == '_' && name[1] == 'Z')
-    {
-      tree save_asm_name = DECL_ASSEMBLER_NAME (decl);
-      const char *old_name;
-
-      ieee128_mangling_gcc_8_1 = true;
-      lang_hooks.set_decl_assembler_name (decl);
-      old_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
-      SET_DECL_ASSEMBLER_NAME (decl, save_asm_name);
-      ieee128_mangling_gcc_8_1 = false;
-
-      if (strcmp (name, old_name) != 0)
-	{
-	  fprintf (stream, "\t.weak %s\n", old_name);
-	  fprintf (stream, "\t.set %s,%s\n", old_name, name);
-	}
-    }
-}
-#endif
-
-\f
 /* On 64-bit Linux and Freebsd systems, possibly switch the long double library
    function names from <foo>l to <foo>f128 if the default long double type is
    IEEE 128-bit.  Typically, with the C and C++ languages, the standard math.h


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-25 13:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-25 13:57 [gcc r11-9510] rs6000: Remove GCC 8.1 U10__float128 mangling compatibility [PR104172] Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).