FIO, powerpc-darwin mangling patch [7.x and earlier].

Message ID 442332F3-027C-4985-8DCF-563C929CBE0E@sandoe.co.uk
State New
Headers show
Series
  • FIO, powerpc-darwin mangling patch [7.x and earlier].
Related show

Commit Message

Iain Sandoe Nov. 27, 2018, 3:05 p.m.
Hi,

So it turns out that the Darwin PPC port was  broken essentially “forever” (before the tidy-up in 8.2) with respect to mangling the symbols for __ibm128 type (the default long double for the port).

In 7.x and earlier (at least back to Apple’s 4.2.1) the use passes right through rs6000_mangle_type, which causes it to mangle to ‘e’ - which is the representation for long double as a 64b value (-mlong-double-64).

This is fixable, even quite easily, but I think it’s better to have the break in the upstream sources on a major boundary (so we leave it alone and have the correction in 8+)

In due course, I will apply the following fix to my “vendor” branches (7, 6 and 5) for anyone who actually cares.

cheers
Iain

Comments

Mike Stump Nov. 27, 2018, 6:57 p.m. | #1
On Nov 27, 2018, at 7:05 AM, Iain Sandoe <iain@sandoe.co.uk> wrote:
> 

> So it turns out that the Darwin PPC port was  broken essentially “forever” (before the tidy-up in 8.2) with respect to mangling the symbols for __ibm128 type (the default long double for the port).

> 

> In 7.x and earlier (at least back to Apple’s 4.2.1) the use passes right through rs6000_mangle_type, which causes it to mangle to ‘e’ - which is the representation for long double as a 64b value (-mlong-double-64).

> 

> This is fixable, even quite easily, but I think it’s better to have the break in the upstream sources on a major boundary (so we leave it alone and have the correction in 8+)


So, I'll pre-approve the back port to all active gcc release branches for anyway that cares.  This is the perfect type of fix to back port in my book.

Patch

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index d377e24..ccb771b 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -35375,6 +35375,10 @@  rs6000_mangle_type (const_tree type)
       && !TARGET_IEEEQUAD)
     return "g";

+  if (TARGET_MACHO && type == long_double_type_node
+      && TREE_INT_CST_LOW (TYPE_SIZE (type)) == 128)
+    return "g";
+
   /* For all other types, use normal C++ mangling.  */
   return NULL;
 }