OS Specific Toolchain: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
Added build instructions, caveats and disclaimer
m Fixed links
Line 251:
 
== Linking a kernel with libsupc++ ==
You can use your libsupc++ to get execption handling and RTTI in a c++ kernel (no more passing -fno-exceptions -fno-rtti to g++!) so you can use things like throw and dynamic_cast<>. Libsupc++ depends upon libgcc for stack unwinding support. Passing the -nostdlib option to gcc when linking caused libgcc.a and libsupc++.a to not be included, so you need to specify -lgcc -lsupc++ on the command line (no need to specify the directories; gcc knows where it installed them to). In addition, you need to include a .eh_frame section in your linker script and terminate it with 32 bits of zeros (QUAD(0) is a useful linker script command). The symbol start_eh_frame should point to the start of the eh_frame section. In addition you need to include your constructors and destructors in the link (see [[C++C_PlusPlus]] for details). You also need to provide __register_frame(), void *__dso_handle;, __cxa_atexit() and __cxa_finalize (again see [[C++C_PlusPlus]]). Something along the lines of
#include <reent.h>
static struct _reent global_reent;