AIX template instantiation

David Edelsohn dje@watson.ibm.com
Tue Nov 7 11:43:00 GMT 2000


	The main problem with v3 on AIX seems to be template
instantiation.  The following patch to src/locale-inst.cc explicitly
instantiating missing templates solves some of the errors.

Index: locale-inst.cc
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/src/locale-inst.cc,v
retrieving revision 1.9
diff -c -p -r1.9 locale-inst.cc
*** locale-inst.cc	2000/10/18 23:26:22	1.9
--- locale-inst.cc	2000/11/07 19:34:53
*************** namespace std {
*** 194,199 ****
--- 194,205 ----
      vec_pfacet::
      insert(vec_pfacet::iterator, vec_pfacet::size_type, 
  	   const vec_pfacet::value_type&);
+   template 
+     void 
+     vec_pfacet::
+     _M_fill_insert(vec_pfacet::iterator, vec_pfacet::size_type, 
+ 		   const vec_pfacet::value_type&);
+ 
  
    typedef istreambuf_iterator<char, char_traits<char> > istreambuf_iter;
    typedef ostreambuf_iterator<char, char_traits<char> > ostreambuf_iter;
*************** namespace std {
*** 291,301 ****
      locale::facet** 
      fill_n<locale::facet**, unsigned int, locale::facet*>
      (locale::facet**, unsigned int, locale::facet* const &);
- 
- } //std
- 
  
! 
! 
  
  
--- 297,307 ----
      locale::facet** 
      fill_n<locale::facet**, unsigned int, locale::facet*>
      (locale::facet**, unsigned int, locale::facet* const &);
  
!   template 
!     locale::facet** 
!     fill_n<locale::facet**, unsigned long, locale::facet*>
!     (locale::facet**, unsigned long, locale::facet* const &);
  
+ } //std
  

	I exchanged email with a person who reported a problem through
Gnats GCC database which is similar to "virtual table" linker errors.  In
the interim, he has worked around the problem with explicit template
instantiations as well.

	GNU/Linux and Solaris libstdc++.so provide the following symbol:

libstdc++.a:locale-inst.o:0000000000000000 W std::vector<std::locale::facet *, std::allocator<std::locale::facet *> >::_M_fill_insert(std::__normal_iterator<std::locale::facet **, std::vector<std::locale::facet *,>std::allocator<std::locale::facet *> > >, unsigned int, std::locale::facet *const &)

	AIX libstdc++.so does not contain any equivalent symbol.  Note
that this is defined as a Weak Symbol, a feature which AIX XCOFF file
format does not provide.

	It looks like all of the v3 testsuite errors not present on other
targets with weak symbol support are a case of G++ not producing implicit
template instantiations.

David


More information about the Libstdc++ mailing list