public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Problem with exceptions on arm
@ 2008-03-27 10:10 Henrik Grindal Bakken
  2008-03-29 18:54 ` Martin Guy
  2008-04-01  8:25 ` Henrik Grindal Bakken
  0 siblings, 2 replies; 16+ messages in thread
From: Henrik Grindal Bakken @ 2008-03-27 10:10 UTC (permalink / raw)
  To: gcc-help


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

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2008-04-01 12:18 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-27 10:10 Problem with exceptions on arm Henrik Grindal Bakken
2008-03-29 18:54 ` Martin Guy
2008-03-31  6:41   ` Henrik Grindal Bakken
2008-03-31 12:09     ` Andrew Haley
2008-03-31 12:21       ` Henrik Grindal Bakken
2008-03-31 12:40         ` Martin Guy
2008-03-31 12:45           ` Henrik Grindal Bakken
2008-04-01  8:25 ` Henrik Grindal Bakken
2008-04-01 10:01   ` Martin Guy
2008-04-01 10:13     ` Andrew Haley
2008-04-01 10:32       ` Kai Ruottu
2008-04-01 11:04         ` Henrik Grindal Bakken
2008-04-01 16:30         ` Andrew Haley
2008-04-01 10:51       ` Henrik Grindal Bakken
2008-04-01 12:16       ` Henrik Grindal Bakken
2008-04-01 10:21     ` Henrik Grindal Bakken

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).