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

[MiNT] MiNT: gcc 2.95.2 exceptions and __EH_FRAME_BEGIN__



I'm currently in the process of packaging the UPX exe packer
( http://upx.tsx.org ) as a native atari/mint package.

First I started out by building cross-binutils 2.9.1 and a 
cross-gcc 2.95.2 under linux/i386, and then compiled and 
tested a bunch of things (under the STonX emulator). 
This worked really fine.

The only problem I hit is that exception handling does not
work. Please compile and run the short test program attached 
below.

After digging into the sources it looks that mintlib is not
initializing the exception frame, and therefore the
libgcc.a runtime function __frame_state_for() fails.

Other platforms use something like

  __register_frame_info(__EH_FRAME_BEGIN__, &outer_frame_object);

in their lib crt startup code.

Unfortunately I don't know enough about the config of your binutils
how to get the outer frame __EH_FRAME_BEGIN__ as there is
no ".eh_frame" section or equivalent.

Anyone succeeded in doing this ? Maybe binutils 2.10 would
help (if they are already ported) ?

Thanks,
Markus


// test.cpp
//
// compile with `g++ -Wall -W -O2 -o test.ttp test.cpp'

#include <stdio.h>
#include <exception>
#include <stdexcept>
#include <new>
#include <typeinfo>

using namespace std;

static void my_terminate(void)
{
    printf("THIS SHOULD NOT HAPPEN: terminate called!\n");
    exit(1);
}

int main(int, char *[])
{
    set_terminate(my_terminate);
    try {
        throw exception();
    } catch (const exception &e) {
        // ok
        printf("Normal exit.\n");
    } catch (...) {
        printf("ERROR: wrong handler\n");
    }
    return 0;
}


//      Markus F.X.J. Oberhumer <markus@oberhumer.com>      */
//                 http://www.oberhumer.com                 */
//     5E CB 5C 85 DE AF 9E BF  E9 DA 7E 6A 39 F8 CC 67     */

                       3 WARPS TO URANUS