GCC : Using 'try'-'catch'-'throw' with HC12 port - unresolved link errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I am investigating the HC12 port of the GNU GCC tools (GCC 3.0.4 and GNU LD
2.12.1) and I am experiencing unresolved link errors when I attempt to use
the 'try'-'throw'-'catch' mechanism.

The program compiles OK, but at link time, generates the following messages:

main.o: undefined reference to `__gxx_personality_sj0'
main.o: undefined reference to `typeinfo for int'
main.o: undefined reference to `__cxa_allocate_exception'
main.o: undefined reference to `__cxa_throw'
main.o: undefined reference to `__cxa_begin_catch'
main.o: undefined reference to `__cxa_end_catch'

I suspect that this is due to a partial port of the compiler libraries or
something similar, hence
the underlying support functions for the compiler are not available.

Or, perhaps I am not adding the correct library to the link line (I am
using -lgcc).

What is interesting is the inclusion of the 'try'-'catch' pair does not
generate an error.  It is
only when the 'throw' is included that the error appears.

If anyone can explain this behaviour to me, and hopefully offer a solution,
I'd appreciate it.

Regards,

Daniel Quinz

Acacetus Inc.

Here is the test code that I am using:

----------------------
#include <string.h>

extern "C"
{
  extern const char _start_of_init ;

  extern char       _start_of_data ;
  extern char       _end_of_data   ;
};

int main () try
{
  memcpy (&_start_of_data, &_start_of_init, &_end_of_data - &_start_of_data)
;

  for (;;)
    {
       // enable/disable following '#if' to create/remove link error.

	  #if 1
         throw __LINE_) ;    // Generates unresolved references
       #else
                             // Blank line : Links ok!
       #endif
    }

  return 0 ;
}

catch (...)
{
}


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux