This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Undefined symbols with exceptions for an egcs 1.1.1 cross-compiler
- To: egcs at egcs dot cygnus dot com
- Subject: Re: Undefined symbols with exceptions for an egcs 1.1.1 cross-compiler
- From: Damian Gilmurray <dgilmurray at adaptivebroadband dot com>
- Date: 07 Jan 1999 12:18:10 +0000
- References: <199901060054.QAA21242@kankakee.wrs.com>
mrs@wrs.com (Mike Stump) writes:
> > To: egcs@egcs.cygnus.com
> > From: Damian Gilmurray <dgilmurray@adaptivebroadband.com>
> > Date: 05 Jan 1999 09:25:36 +0000
>
> > In order to provide runtime support for exceptions, I've pulled libgcc2.c,
> > cp/exception.cc, cp/tinfo.cc and cp/tinfo2.cc from the distribution into a
> > C++ support library, compiling the .cc files with -frtti -fexceptions.
>
> > __class_type_info type_info node
>
> If you ask the compiler to not link with libgcc.a and libstdc++.a you
> should expect tons of these type of problem. Maybe what you want to
> do is link against them, or at least more of them. nm will tell you
> where things are defined. Also, I suggest you let the libraries be
> built in the normal way.
>
Mike,
Thanks for your reply.
I've tracked down what I believe is the source of the problem.
These symbols were indeed being defined in tinfo.o and tinfo2.o but were
defined as common symbols. However, the cross-compiler is for an embedded
environment and in this environment we are using a bespoke linker (and
indeed bespoke runtime libraries, hence not linking in the full libgcc.a
and libstdc++). This linker cannot handle the resolution of common symbols
and therefore everything is compiled with -fno-common. However, when
compiling cp/tinfo.cc and cp/tinfo2.cc common symbols are generated for the
type_info nodes irrespective of the no-common flag. This is because the
code generation for type_info initialization in the function
synthesize_tinfo_fn() in cp/rtti.c ignores the no-common flag. With the
following patch:
*** rtti.c.orig Fri Nov 13 19:45:38 1998
--- rtti.c Wed Jan 6 18:44:15 1999
***************
*** 1074,1080 ****
tdecl = get_tinfo_var (type);
DECL_EXTERNAL (tdecl) = 0;
TREE_STATIC (tdecl) = 1;
! DECL_COMMON (tdecl) = 1;
TREE_USED (tdecl) = 1;
DECL_ALIGN (tdecl) = TYPE_ALIGN (ptr_type_node);
cp_finish_decl (tdecl, NULL_TREE, NULL_TREE, 0, 0);
--- 1074,1081 ----
tdecl = get_tinfo_var (type);
DECL_EXTERNAL (tdecl) = 0;
TREE_STATIC (tdecl) = 1;
! if (!flag_no_common)
! DECL_COMMON (tdecl) = 1;
TREE_USED (tdecl) = 1;
DECL_ALIGN (tdecl) = TYPE_ALIGN (ptr_type_node);
cp_finish_decl (tdecl, NULL_TREE, NULL_TREE, 0, 0);
I can successfully link the application. I know very little about the
implementation of RTTI so please excuse any ignorance on my behalf but is
there a particular reason why the no-common flag is ignored here?
Regards,
Damian.
[ Damian P. Gilmurray email: dgilmurray@adaptivebroadband.com
Adaptive Broadband Limited www: http://www.adaptivebroadband.com/
The Westbrook Centre phone: +44 (0)1223 713417
Cambridge CB4 1YQ U.K. fax: +44 (0)1223 713714 ]