C++ Exception support with libsupc++ and libgcc (statically linked)

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


Hi all!

I'm trying to build a userland with exception-support for a custom
kernel (NOVA). To do so, I built a gcc cross compiler including libgcc
and libsupc++. This worked and I can also build (static) libraries and
programs, but throwing and catching an exception doesn't.

So far, I provide crt0.o (that calls _init and afterwards main), crt1.o
and crtn.o, an empty libstdc++, a small libc with just the required
functionality (malloc, free, strlen and so on) and an empty libg and
libm. These are built with no special flags. Finally I build the
executable with:
i686-pc-nulnova-g++ -o build/apps/root/root -static -Wl,-static
-static-libgcc -g -Wl,-T,apps/root/linker.ld build/apps/root/main.o
-Lbuild/bin/lib -L../cross/dist/lib -lsupc++
The linker script is basically the default one, with the difference that
the bss-stuff is put into the data-section, because the kernel requires
that.
The source of the program is:
int main() {
	try {
		throw 4;
	}
	catch(int x) {
		x++;
	}
	return 0;
}

I figured out by debugging the program that the function search_object
in unwind-dw2-fde.c calls the init_object-function
and afterwards it returns NULL because "pc < ob->pc_begin" is true.
Finally, this causes the unwind-stuff to call abort.

I don't really know whats the problem here. I'm using binutils 2.21.1
and gcc 4.6.1. I've put a few files that might be interesting on:
http://os.inf.tu-dresden.de/~nils/gccex/files.tar.gz
That is, two diff-files to patch binutils and gcc before building the
cross-compiler, the linker map (produced with -Map=x) and the
executable. Please tell me if you need more information.

Any help is appreciated.

Best regards,
Nils



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

Add to Google