Problem with exceptions on arm
Henrik Grindal Bakken
hgb@ifi.uio.no
Thu Mar 27 10:10:00 GMT 2008
Hi. I have built myself a cross-compiler x86->arm-linuxeabi, with
which I'm having some problems.
My current toolchain is built like this:
../${GCCDIST}/configure \
--build="${BUILD_ARCH}" \
--host="${BUILD_ARCH}" \
--target="${GNU_ARCH}" \
--with-cross-host="${GNU_ARCH}" \
--prefix="${PREFIX}" \
--libdir="${PREFIX}/lib" \
--includedir="${PREFIX}/include" \
--with-headers="${PREFIX}/include" \
--with-local-prefix="${PREFIX}/${GNU_ARCH}" \
--program-prefix="${PROGRAM_PREFIX}" \
--disable-nls \
${ARCHARG} ${FLOATARG} \
${GMPARG} ${MPFRARG} \
${GCC_LANG_ARG} \
${GCC_CONF_ARG}
make all && make install install_root="${PREFIX}"
BUILD_ARCH=i686-linux
GNU_ARCH=arm-linuxeabi
ARCH_ARG="--with-arch=armv5t --with-tune=arm926ej-s--with-cpu=arm926ej-s"
GCC_LANG_ARG="--enable-languages=c,c++"
GCC_CONF_ARG="\
--enable-shared \
--enable-threads=posix \
--enable-symvers=gnu \
"
This is part of a larger script setting up a cross-compiling
toolchain. binutils, glibc and a first-stage gcc for arm is already
built at this point. I have tried gcc-4.2.2 and gcc-4.2.3. Our
codebase isn't quite ready for 4.3 yet...
When I run on target, a simple test program with exceptions fail:
===8<===8<===
#include <stdio.h>
#include <stdlib.h>
int main() {
try {
throw "hello";
}
catch(const char *e) {
fprintf(stderr, "I caught %s\n", e);
exit(1);
}
catch(...) {
fprintf(stderr, "I caught something\n");
exit(1);
}
fprintf(stderr, "Still happy, but why??\n");
exit(0);
}
===8<===8<===
Fails like this:
$ /tmp/fnord
terminate called after throwing an instance of 'char*'
terminate called recursively
Aborted
I've also tried throwing ints, but to no avail.
The test application was built like this:
arm-linuxeabi-g++ -fexceptions -frtti -o /tmp/fnord /tmp/fnord.cpp
My next try is a new toolchain, built with --with-sjlj-exceptions, but
then gcc fails to build:
/home/hgb/src/dev/toolchain/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/build-gcc-full/./gcc/xgcc -shared-libgcc -B/home/hgb/src/dev/toolchain/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/build-gcc-full/./gcc -nostdinc++ -L/home/hgb/src/dev/toolchain/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/build-gcc-full/arm-linuxeabi/libstdc++-v3/src -L/home/hgb/src/dev/toolchain/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/build-gcc-full/arm-linuxeabi/libstdc++-v3/src/.libs -B/home/hgb/src/dev/toolchain/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/arm-linuxeabi/bin/ -B/home/hgb/src/dev/toolchain/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/arm-linuxeabi/lib/ -isystem /home/hgb/src/dev/toolchain/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/arm-linuxeabi/include -isystem /home/hgb/src/dev/toolchain/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/arm-linuxeabi/sys-include -I/home/hgb/src/dev/toolchain/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/gcc-4.2.3/libstdc++-v3/../gcc -I/home/hgb/src/dev/toolchain/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/build-gcc-full/arm-linuxeabi/libstdc++-v3/include/arm-linuxeabi -I/home/hgb/src/dev/toolchain/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/build-gcc-full/arm-linuxeabi/libstdc++-v3/include -I/home/hgb/src/dev/toolchain/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/gcc-4.2.3/libstdc++-v3/libsupc++ -I/home/hgb/src/dev/toolchain/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/include -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -g -O2 -D_GNU_SOURCE -c ../../../../gcc-4.2.3/libstdc++-v3/libsupc++/eh_alloc.cc -fPIC -DPIC -o eh_alloc.o
/tmp/ccc0srso.s: Assembler messages:
/tmp/ccc0srso.s:649: Error: duplicate .personality directive
/tmp/ccc0srso.s:1200: Error: duplicate .personality directive
make[4]: *** [eh_alloc.lo] Error 1
make[4]: Leaving directory `/home/hgb/src/dev/toolchain/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/build-gcc-full/arm-linuxeabi/libstdc++-v3/libsupc++'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/hgb/src/dev/toolchain/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/build-gcc-full/arm-linuxeabi/libstdc++-v3'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/hgb/src/dev/toolchain/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/build-gcc-full/arm-linuxeabi/libstdc++-v3'
make[1]: *** [all-target-libstdc++-v3] Error 2
make[1]: Leaving directory `/home/hgb/src/dev/toolchain/arm_gcc-4.2.3_glibc-2.7_i686-linux-1/build-gcc-full'
Does anyone have any great ideas as to either how to get exceptions
working without --with-sjlj-exceptions, or alternatively how to get
that working?
--
Henrik Grindal Bakken <hgb@ifi.uio.no>
PGP ID: 8D436E52
Fingerprint: 131D 9590 F0CF 47EF 7963 02AF 9236 D25A 8D43 6E52
More information about the Gcc-help
mailing list