exception handling broken on x86-64?

Hi,

when building the second release candidate of llvm 2.2 I noticed that
exception handling seems to be broken on Linux x86-64. The exception is
thrown but never caught.
This can be seen by this trivial example:

#include <iostream>
using namespace std;
class A { };
int main()
{
   cout << "A" << endl;
   try {
       cout << "B" << endl;
       throw A();
       cout << "C" << endl;
   } catch (const A&) {
      cout << "D" << endl;
   }
   cout << "E" << endl;
}

When compiled with llvm-g++ it aborts after printing "B". The generated
assembler code looks reasonable at a first glance, but something must
be broken. Any ideas about how to debug this?

I build the gcc 4.2 snapshot from the second release candidate with
--disable-multilib and --disable-shared to get it to build (as
suggested by the readme). llvm itself was build without special
options.

Thomas

Hi,

when building the second release candidate of llvm 2.2 I noticed that
exception handling seems to be broken on Linux x86-64. The exception is
thrown but never caught.
This can be seen by this trivial example:

#include <iostream>
using namespace std;
class A { };
int main()
{
  cout << "A" << endl;
  try {
      cout << "B" << endl;
      throw A();
      cout << "C" << endl;
  } catch (const A&) {
     cout << "D" << endl;
  }
  cout << "E" << endl;
}

Works for me on x86-64 Darwin, fwiw. I made EH work in that environment with 46029, and it's possible I broke Linux when I did that, although I don't think so. Anybody tried this since January 16?

If the assembler code looks right there is probably something wrong in the Dwarf metadata. Try comparing with the output of g++; you'll need some understanding of Dwarf. The options -asm-verbose on llvm and -dA on g++ will give you some debugging info.

If the assembler code looks right there is probably something wrong
in the Dwarf metadata. Try comparing with the output of g++; you'll
need some understanding of Dwarf. The options -asm-verbose on llvm
and -dA on g++ will give you some debugging info.

llvm-g++ and native g++ seem to produce equivalent assembler code. I
only compared the part from start of main to the throw statement, they
are functional identical.

The problem apparently is the catch part. Comparing the assembler dumps
is not the most intuitive task... But I noticed that the native g++
apparently includes much more information than llcm-g++. For example it
writes data in section ".eh_frame", which sounds suspiciously like
exception handling info, which is not written by llvm. Is this expected
or is exception handling completely unimplemented on Linux/x86-64?

Thomas