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]

[PATCH] dwarf1 undefined symbol error


NOTE:  This patch repairs one undefined symbol problem in dwarf1 output.  I have a second patch coming to fix others! :-)

This patch repairs a problem in dwarfout.c when outputting the inheritance DIEs for base classes of a class.  It insures that the *types* of those base classes are also output.  This raised its ugly head in the following code:

--------
template <class _Arg1, class _Arg2, class _Result>
struct binary_function {
  typedef _Arg1 first_argument_type;
  typedef _Arg2 second_argument_type;
  typedef _Result result_type;
};      

template <class _Tp>
struct multiplies : public binary_function<_Tp,_Tp,_Tp> {
  _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x * __y; }
};

template class multiplies<int>;
------------

which comes straight from stl_function.h.  When the multiplies<int> gets output, no DIE was output for the binary_function type, even though the inheritance DIE referenced it.

ChangeLog:

1999-06-16 Eric Raskin (ehr@listworks.com)

	* dwarfout.c(output_type): Output DIEs for any un-output base class types
	when outputting a inheritance info.

--- egcs-19990608-orig/gcc/dwarfout.c   Sun Apr 18 09:09:27 1999
+++ egcs-19990608/gcc/dwarfout.c        Wed Jun 16 12:09:59 1999
@@ -4433,9 +4443,16 @@ output_type (type, containing_scope)
                register tree bases = TYPE_BINFO_BASETYPES (type);
                register int n_bases = TREE_VEC_LENGTH (bases);
                register int i;
+               register tree curr_base;
 
                for (i = 0; i < n_bases; i++)
-                 output_die (output_inheritance_die, TREE_VEC_ELT (bases, i));
+                 {
+                   curr_base = TREE_VEC_ELT (bases, i);
+                   output_die (output_inheritance_die, curr_base);
+       /* Be sure to output the types of the base classes as well */
+                   if (! TREE_ASM_WRITTEN (BINFO_TYPE (curr_base)))
+                     output_type (BINFO_TYPE (curr_base), containing_scope);
+                 }
              }
 
            ++in_class;



------------------------------------------------------------------------
Eric H. Raskin                            Voice:  914-769-7100 x321
President, CSC Division                   Fax:    914-769-8070
The Listworks Corp.                       E-Mail: ehr@listworks.com
1 Campus Drive
Pleasantville, NY 10570


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