This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH], Add weak references to bridge old/new PowerPC ieee 128-bit name mangling


The new mangling scheme for PowerPC now uses "u9__ieee128" as the mangled name
instead of "U10__float128".  This would break old code that used __float128 and
called to libraries built with the new compiler.

This patch adds a hook to emit a weak reference for the old mangled name when
we are creating the new mangled name with a different spelling.  I added an
undocumented switch (-malias-old-name-mangling) to not create the weak
reference if it is a problem.

This patch also makes __ibm128 or __float128 use the long double mode if long
double uses the IBM extended double or IEEE 128-bit representations.  This
allows templates to work again with those types (the template code aborts if
you have two distinct types use the same mangling).  However, overloaded types
won't work, but I suspect these days people use templates over overloaded
functions.  I fixed up the test case for this (pr85657.C) so that it only tests
for templates.

I have tested it on a little endian power8 system and there were no
regressions.  It does fix the error in pr85657.C that was due to the previous
name mangling changes.  Can I check this into the trunk?  We will need to
backport the name mangling changes and these patches back to GCC 8.2 as well.

I will need to re-issue the patch for __builtin_{,un}pack_longdouble and
__builtin_{,un}pack_ibm128 due to changes made by these patches.

[gcc]
2018-06-01  Michael Meissner  <meissner@linux.ibm.com>

	* config/rs6000/rs6000.c (rs6000_passes_ieee128): New static
	boolean to remember if we passed or returned IEEE 128-bit values.
	(old_mangling): New static boolean to say whether to use the old
	mangling strings for IEEE 128-bit floating point or the new
	mangling.
	(TARGET_ASM_GLOBALIZE_DECL_NAME): Define target hook.
	(rs6000_debug_reg_global): Print whether we support creating weak
	references for the old mangling name.
	(rs6000_option_override_internal): Add support for
	-malias-old-name-mangling.
	(init_cumulative_args): Note if we ever have passed or returned
	IEEE 128-bit floating point.
	(rs6000_function_arg_advance_1): Likewise.
	(rs6000_init_builtins): If long double is IBM extended double,
	make __int128 use the TFmode type.  If long double is IEEE 128-bit
	floating point, make __float128 use the TFmode type.
	(rs6000_mangle_type): Return either the old mangling or new
	mangling string for IEEE 128-bit floating point types.
	(rs6000_globalize_decl_name): If we are putting out a .globl for a
	C++ mangled name that contains an IEEE 128-bit floating point
	value, put out a weak reference for the old name if it was
	different.
	* config/rs6000/rs6000.opt (-malias-old-name-mangling): Add
	undocumented switch to control whether weak references are put out
	for the old mangled name if the mangling changed.

[gcc/testsuite]
2018-06-01  Michael Meissner  <meissner@linux.ibm.com>

	* g++.dg/pr85657.C: Update test, only test whether templates can
	be used on all 3 128-bit floating point types.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.ibm.com, phone: +1 (978) 899-4797

Attachment: ieee128-patch100b
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]