Hi!

Honza's recent change to use the libiberty demangler inside of gcc
broke Ada bootstrap.  The issue is that there is a symbol clash,
libiberty contains ada_demangle symbol (with one API), and ada/adadecode.c
(since around 3.3 time, claimed for compatibility) contains another one,
with incompatible API, guarded with IN_GCC.  IN_GCC for some strange reason
in Ada means that it is linked both into gnat1 and libgnat*.{a,so}.
This means that current trunk fails to bootstrap, because there are
two ada_demangle definitions being linked in.
gnat1 doesn't use ada_demangle for anything, libgnat*.{a,so} only exports it
but there are no direct users, and ada_demangle in libiberty is used froim
the same file, but not elsewhere from what I could find.

In any case, for compatibility, this patch just changes the guard so that
adadecode.c's ada_demangle is compiled only into libgnat*.{a,so} and not
into gnat1, which can then successfully link against libiberty cplus-dem.o.

The ipa-devirt.c change is obvious IMHO, the same header is included a few
lines above this.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2015-03-23  Jakub Jelinek  <ja...@redhat.com>

        PR bootstrap/65522
        * ipa-devirt.c: Remove duplicate demangle.h include.

        * adadecode.c (ada_demangle): Guard with IN_RTS instead of IN_GCC.

--- gcc/ipa-devirt.c.jj 2015-03-23 08:47:53.000000000 +0100
+++ gcc/ipa-devirt.c    2015-03-23 13:52:49.937174740 +0100
@@ -166,7 +166,6 @@ along with GCC; see the file COPYING3.
 #include "gimple-pretty-print.h"
 #include "stor-layout.h"
 #include "intl.h"
-#include "demangle.h"
 
 /* Hash based set of pairs of types.  */
 typedef struct
--- gcc/ada/adadecode.c.jj      2012-01-23 18:23:54.000000000 +0100
+++ gcc/ada/adadecode.c 2015-03-23 13:53:35.869429888 +0100
@@ -6,7 +6,7 @@
  *                                                                          *
  *                          C Implementation File                           *
  *                                                                          *
- *           Copyright (C) 2001-2012, Free Software Foundation, Inc.        *
+ *           Copyright (C) 2001-2015, Free Software Foundation, Inc.        *
  *                                                                          *
  * GNAT is free software;  you can  redistribute it  and/or modify it under *
  * terms of the  GNU General Public License as published  by the Free Soft- *
@@ -368,7 +368,7 @@ __gnat_decode (const char *coded_name, c
 extern "C" {
 #endif
 
-#ifdef IN_GCC
+#ifdef IN_RTS
 char *
 ada_demangle (const char *coded_name)
 {

        Jakub

Reply via email to