C++ Issue on GCC 3.0 branch

John David Anglin dave@hiauly1.hia.nrc.ca
Fri Apr 20 21:29:00 GMT 2001


> A few of the remaining failures for PA32 using static libraries are
> multiply defined symbols -- in each case one or more symbols defined by
> the main program is a duplicate of a symbol in libstdc++.

The duplicate symbol problem also prevents building a shared libstdc++.,
particularly if you use a low optimization level for debugging.

I have been trying to track this for a couple of days.  The enclosed
patch may resolve the problem of duplicate symbols.  It appears to prevent
the symbols from being exported.  However, I have no idea whether it is
technically correct.  It is possible the problem should be fixed when
the original clone decl is created.

The functions are all constructors being instantiated from templates.
It is my assumption that these don't really need to be accessible from
other files and the duplication won't be a problem (ie., static data
should be in common).  On systems with weak support, they are weak
symbols.

The patch is not a complete solution.  There are still import assembler
statements being generated for these functions.  I have being trying to
figure out how DECL_EXTERNAL gets set but so far I can't find where it
is set.  I tried setting breaks on every place that cc1plus sets it
directly but this didn't work.  I am now running a test using `watch'
but this is incredibly slow.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2001-04-21  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* optimize.c (maybe_clone_body): Copy TREE_PUBLIC to clone.

--- optimize.c.orig	Wed Apr 11 15:05:20 2001
+++ optimize.c	Fri Apr 20 16:14:38 2001
@@ -1028,6 +1028,7 @@
       int parmno;
 
       /* Update CLONE's source position information to match FN's.  */
+      TREE_PUBLIC (clone) = TREE_PUBLIC (fn);
       DECL_SOURCE_FILE (clone) = DECL_SOURCE_FILE (fn);
       DECL_SOURCE_LINE (clone) = DECL_SOURCE_LINE (fn);
       DECL_INLINE (clone) = DECL_INLINE (fn);



More information about the Gcc mailing list