exception handling broken on x86-64?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

exception handling broken on x86-64?

Bugzilla from tneumann@users.sourceforge.net
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


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: exception handling broken on x86-64?

Dale Johannesen

On Feb 9, 2008, at 6:53 AM, Thomas Neumann wrote:

> 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.

> 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
>
>
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: exception handling broken on x86-64?

Anton Korobeynikov
In reply to this post by Bugzilla from tneumann@users.sourceforge.net
Hello, Thomas

> 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
EH never worked on x86-64. Mainly due to absence of intrinsics used in
unwinding runtime. Also, some other important stuff is missed as well
(like stack layout information).

> When compiled with llvm-g++ it aborts after printing "B". The generated
> assembler code looks reasonable at a first glance,
It shouldn't. At least all frame moves information is missing.

> but something must be broken. Any ideas about how to debug this?
I'd suggest to start with filling necessary bits in the
X86RegisterInfo.cpp. This includes frame moves information and
description of stack layout.

Then you can proceed to x86-64-specific lowering of some important
intrinsics. You can link your code with native g++ in order to use
gcc-provided (and thus working) runtime.

--
WBR, Anton Korobeynikov
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: exception handling broken on x86-64?

Anton Korobeynikov
In reply to this post by Bugzilla from tneumann@users.sourceforge.net
Dale,

> Works for me on x86-64 Darwin, fwiw.
That looks pretty strange. Ok, it can work for small testcases, but will
surely fail when you try to use for something more real. Currently it at
least lacks information about frame moves. So, every invoke, which needs
to restore call-clobbered registers during unwinding will be broken.

Does Shootout-C++/except work for you? And stuff from llvm testsuite
like omnetpp and xalan ?

Also, Darwin is different than Linux, because Darwin's unwinding runtime
is native one, not built by llvm-gcc.

--
WBR, Anton Korobeynikov
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: exception handling broken on x86-64?

Dale Johannesen

On Feb 9, 2008, at 11:20 AM, Anton Korobeynikov wrote:

> Dale,
>
>> Works for me on x86-64 Darwin, fwiw.
> That looks pretty strange. Ok, it can work for small testcases, but  
> will
> surely fail when you try to use for something more real. Currently  
> it at
> least lacks information about frame moves. So, every invoke, which  
> needs
> to restore call-clobbered registers during unwinding will be broken.
>
> Does Shootout-C++/except work for you? And stuff from llvm testsuite
> like omnetpp and xalan ?

Everything in the llvm testsuite works.

> Also, Darwin is different than Linux, because Darwin's unwinding  
> runtime
> is native one, not built by llvm-gcc.

I didn't look too hard, but it looks like the x86-64 info is only  
slightly modified from the x86-32 info on darwin (in gcc).  A few  
fields were extended to 64 bits but it was not far off.  So what was  
there mostly just worked.  You may be right that there are problems  
that haven't shown up yet.

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: exception handling broken on x86-64?

Dale Johannesen

On Feb 9, 2008, at 11:48 AM, Dale Johannesen wrote:

>
> On Feb 9, 2008, at 11:20 AM, Anton Korobeynikov wrote:
>
>> Dale,
>>
>>> Works for me on x86-64 Darwin, fwiw.
>> That looks pretty strange. Ok, it can work for small testcases, but  
>> will
>> surely fail when you try to use for something more real. Currently  
>> it at
>> least lacks information about frame moves. So, every invoke, which  
>> needs
>> to restore call-clobbered registers during unwinding will be broken.
>>
>> Does Shootout-C++/except work for you? And stuff from llvm testsuite
>> like omnetpp and xalan ?
>
> Everything in the llvm testsuite works.

And the gcc testsuite - well, there are a couple of failures, but I  
looked at them and am convinced they are not problems with the EH  
mechanism.

>> Also, Darwin is different than Linux, because Darwin's unwinding  
>> runtime
>> is native one, not built by llvm-gcc.
>
> I didn't look too hard, but it looks like the x86-64 info is only  
> slightly modified from the x86-32 info on darwin (in gcc).  A few  
> fields were extended to 64 bits but it was not far off.  So what was  
> there mostly just worked.  You may be right that there are problems  
> that haven't shown up yet.
>

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: exception handling broken on x86-64?

Bugzilla from tneumann@users.sourceforge.net
In reply to this post by Dale Johannesen
> 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


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: exception handling broken on x86-64?

Bugzilla from tneumann@users.sourceforge.net
In reply to this post by Anton Korobeynikov
> I'd suggest to start with filling necessary bits in the
> X86RegisterInfo.cpp. This includes frame moves information and
> description of stack layout.
I looked at X86RegisterInfo.cpp, but I think that it already supports
x86-64. At least there were no obvious places were the code would only
work for 32bit mode.
After comparing the generated assembler code with native gcc code I
think the generated code is fine, just the exception handler info in
the non-code sections is broken/missing.

Thomas


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: exception handling broken on x86-64?

Anton Korobeynikov
In reply to this post by Bugzilla from tneumann@users.sourceforge.net
Hello, Thomas

> The problem apparently is the catch part.
Catching is done by gcc unwinding runtime. Which is, in your case
(--disable-shared), compiled by llvm and thus is definitely broken. What
if you link the llvm-generated .S file with native g++ ?

> 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?
Well, it's "expected, because unimplemented" :). The contents of
".eh_frame" section (aka EH common frame information) is among the
missed stuff, I talked about.

--
WBR, Anton Korobeynikov
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: exception handling broken on x86-64?

Anton Korobeynikov
In reply to this post by Bugzilla from tneumann@users.sourceforge.net
Hello, Thomas

> > I'd suggest to start with filling necessary bits in the
> > X86RegisterInfo.cpp. This includes frame moves information and
> > description of stack layout.
> I looked at X86RegisterInfo.cpp, but I think that it already supports
> x86-64. At least there were no obvious places were the code would only
> work for 32bit mode.
Right. See my last e-mail to Dale. It's really amazing :)

> After comparing the generated assembler code with native gcc code I
> think the generated code is fine, just the exception handler info in
> the non-code sections is broken/missing.
It seems, that EH dwarf information emission is disabled in
X86TargetAsmInfo.cpp. Remove the is64Bit() condition near
"SupportExceptionHandling = true" line in X86Subtarget::isELF section.

Also, don't forget to add --enable-eh switch to llc invocation.

You will need to link .S with your native unwinding runtime (so, use g++
to link, not llvm-g++)

--
WBR, Anton Korobeynikov
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: exception handling broken on x86-64?

Bugzilla from tneumann@users.sourceforge.net
In reply to this post by Anton Korobeynikov
> Catching is done by gcc unwinding runtime. Which is, in your case
> (--disable-shared), compiled by llvm and thus is definitely broken.
> What if you link the llvm-generated .S file with native g++ ?
same behavior. The abort message changes (only the string, the meaning
is identical), but otherwise the same. The exception is not caught and
thus terminate -> abort is called.

> Well, it's "expected, because unimplemented" :). The contents of
> ".eh_frame" section (aka EH common frame information) is among the
> missed stuff, I talked about.
I see. Shouldn't there be an open bug about this? I had checked
Bugzilla before posting here, but could not find anything.

Could you perhaps point me more explicitly to the place where x86-64
support would have to be implemented? I searched around
X86RegisterInfo.cpp a bit but I do not see why the 32bit mode should
work and the 64bit mode not.

Thomas


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: exception handling broken on x86-64?

Dale Johannesen
In reply to this post by Anton Korobeynikov

On Feb 9, 2008, at 2:48 PM, Anton Korobeynikov wrote:
>> After comparing the generated assembler code with native gcc code I
>> think the generated code is fine, just the exception handler info in
>> the non-code sections is broken/missing.
> It seems, that EH dwarf information emission is disabled in
> X86TargetAsmInfo.cpp. Remove the is64Bit() condition near
> "SupportExceptionHandling = true" line in X86Subtarget::isELF section.
>
> Also, don't forget to add --enable-eh switch to llc invocation.

Just in case it doesn't work the first time:) patch 46029 might be  
helpful.  That made it work on Darwin for me, and it's possible some  
of the changes there are also applicable to Linux.  Compare your .s  
with g++ output.

> You will need to link .S with your native unwinding runtime (so, use  
> g++
> to link, not llvm-g++)

This is not necessary on Darwin, btw, the unwinding stuff Just Worked  
too.

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: exception handling broken on x86-64?

Evan Cheng-2
Where we are on the subject... Are we sure EH is done for x86?

These two tests have never worked on Mac OS X / x86:
SPEC/CINT2006/471.omnetpp
Shootout-C++/except

Evan

On Feb 9, 2008, at 2:57 PM, Dale Johannesen wrote:

>
> On Feb 9, 2008, at 2:48 PM, Anton Korobeynikov wrote:
>>> After comparing the generated assembler code with native gcc code I
>>> think the generated code is fine, just the exception handler info in
>>> the non-code sections is broken/missing.
>> It seems, that EH dwarf information emission is disabled in
>> X86TargetAsmInfo.cpp. Remove the is64Bit() condition near
>> "SupportExceptionHandling = true" line in X86Subtarget::isELF  
>> section.
>>
>> Also, don't forget to add --enable-eh switch to llc invocation.
>
> Just in case it doesn't work the first time:) patch 46029 might be
> helpful.  That made it work on Darwin for me, and it's possible some
> of the changes there are also applicable to Linux.  Compare your .s
> with g++ output.
>
>> You will need to link .S with your native unwinding runtime (so, use
>> g++
>> to link, not llvm-g++)
>
> This is not necessary on Darwin, btw, the unwinding stuff Just Worked
> too.
>
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: exception handling broken on x86-64?

Dale Johannesen

On Feb 10, 2008, at 7:04 PM, Evan Cheng wrote:

> Where we are on the subject... Are we sure EH is done for x86?
>
> These two tests have never worked on Mac OS X / x86:
> SPEC/CINT2006/471.omnetpp
> Shootout-C++/except
>
> Evan

Shootout-C++/except works for me.  Anton suggests there may be an  
issue with the unwinding libraries and he may be right, I'll look at  
it with you tomorrow.

> On Feb 9, 2008, at 2:57 PM, Dale Johannesen wrote:
>
>>
>> On Feb 9, 2008, at 2:48 PM, Anton Korobeynikov wrote:
>>>> After comparing the generated assembler code with native gcc code I
>>>> think the generated code is fine, just the exception handler info  
>>>> in
>>>> the non-code sections is broken/missing.
>>> It seems, that EH dwarf information emission is disabled in
>>> X86TargetAsmInfo.cpp. Remove the is64Bit() condition near
>>> "SupportExceptionHandling = true" line in X86Subtarget::isELF
>>> section.
>>>
>>> Also, don't forget to add --enable-eh switch to llc invocation.
>>
>> Just in case it doesn't work the first time:) patch 46029 might be
>> helpful.  That made it work on Darwin for me, and it's possible some
>> of the changes there are also applicable to Linux.  Compare your .s
>> with g++ output.
>>
>>> You will need to link .S with your native unwinding runtime (so, use
>>> g++
>>> to link, not llvm-g++)
>>
>> This is not necessary on Darwin, btw, the unwinding stuff Just Worked
>> too.
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> [hidden email]         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: exception handling broken on x86-64?

Anton Korobeynikov
In reply to this post by Bugzilla from tneumann@users.sourceforge.net
Hello Evan and Dale,

> Shootout-C++/except works for me.  Anton suggests there may be an  
> issue with the unwinding libraries and he may be right, I'll look at  
> it with you tomorrow.
Yes. Please be sure, that you're linking with system libgcc.{so,dylib},
not with llvm-compiled one.

--
WBR, Anton Korobeynikov
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: exception handling broken on x86-64?

Robert Zeh-2
Did anything ever come of the work on exception handling for x86_64?

I'm having problems with exceptions on linux x86_64.  Today, on x86_64  
with a recently updated working copy of llvm, I tried calling a JITted  
function that calls an external function that throws:

thrower.cpp: (which gets compiled into a dynamic library)

extern "C"
void throwexception()
{
   throw 5;
}

My code that invokes the JIT:

     llvm::Function *q_main = implementationVisitor.m_module-
 >getFunction("q_main");
     std::vector<GenericValue> args;
     try {
     GenericValue GV=EE->runFunction(q_main, args);
     } catch (...) {
       printf("hello!\n");

     }
   }

And instead of printing out hello I got

Program received signal SIGABRT, Aborted.
[Switching to Thread 48011952506048 (LWP 6197)]
0x00002baaa72d1765 in raise () from /lib/libc.so.6
(gdb) where
#0  0x00002baaa72d1765 in raise () from /lib/libc.so.6
#1  0x00002baaa72d31c0 in abort () from /lib/libc.so.6
#2  0x00002baaa6bcb7b4 in __gnu_cxx::__verbose_terminate_handler ()  
from /usr/lib/libstdc++.so.6
#3  0x00002baaa6bc9746 in ?? () from /usr/lib/libstdc++.so.6
#4  0x00002baaa6bc9773 in std::terminate () from /usr/lib/libstdc++.so.6
#5  0x00002baaa6bc985a in __cxa_throw () from /usr/lib/libstdc++.so.6
#6  0x00002baaa69046b7 in throwexception () from /usr/local/src/GQ/
libthrower.so
#7  0x00002baaa777f06d in ?? ()
#8  0x34353530372e302d in ?? ()
#9  0x0000000000000030 in ?? ()
#10 0x000000000051d7b4 in llvmImplementationVisitorTest () at main.cpp:
365
#11 0x000000000051e06c in main (argc=1, argv=0x7fff047e0298) at  
main.cpp:389

Am I doing anything wrong?

q_main looks like this:
After pass manager:
; ModuleID = 'Q'

define void @q_main() {
entry:
        call void @throwexception( )
        ret void
}

declare void @throwexception()

declare void @abort()

               
On Feb 11, 2008, at 12:06 AM, Anton Korobeynikov wrote:

> Hello Evan and Dale,
>
>> Shootout-C++/except works for me.  Anton suggests there may be an
>> issue with the unwinding libraries and he may be right, I'll look at
>> it with you tomorrow.
> Yes. Please be sure, that you're linking with system libgcc.
> {so,dylib},
> not with llvm-compiled one.
>
> --
> WBR, Anton Korobeynikov
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: exception handling broken on x86-64?

Duncan Sands
> Did anything ever come of the work on exception handling for x86_64?
>
> I'm having problems with exceptions on linux x86_64.

I'm fairly sure that exception handling doesn't currently work on
x86-64 linux (it may work with darwin - not sure).  I don't know
what it would take to get it to work.

Ciao,

Duncan.
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: exception handling broken on x86-64?

Dale Johannesen

On Mar 16, 2008, at 5:07 AM, Duncan Sands wrote:

>> Did anything ever come of the work on exception handling for x86_64?
>>
>> I'm having problems with exceptions on linux x86_64.
>
> I'm fairly sure that exception handling doesn't currently work on
> x86-64 linux (it may work with darwin - not sure).  I don't know
> what it would take to get it to work.

On Darwin, the Dwarf metadata emitted in .s/.o files is correct  
(although there may be bugs, it hasn't been exercised beyond the llvm  
and gcc testsuites).   The unwinding code in libgcc* has not been  
ported to x86-64 and does not work.  Thus, if you take the libgcc*  
from a non-llvm gcc and link llvm-gcc-produced .o files with that,  
things work.
It would probably not take much to get Linux x86-64 to this state, I  
doubt the metadata is much different from Darwin.

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: exception handling broken on x86-64?

Robert Zeh-2
I'm sorry to beat a dead horse, but I just want to be clear that I'm  
asking about exception handling from within the JIT, not the native  
code produced by llvm-g++.  For example, the following doesn't work  
for me on linux x86 (let alone x86_64).  I'm using an llvm build from  
revision 48493 (March 18th).

exceptiontest.cpp:
#include <stdio.h>

int main(int argc, char *argv[])
{
   try {
     throw 5;

   } catch (int i) {
     printf("caught %d\n", i);
   }
   return 0;
}

$ llvm-g++ -emit-llvm exceptiontest.cpp -c
$ lli -enable-eh -enable-correct-eh-support exceptiontest.o
terminate called after throwing an instance of 'int'
lli(_ZN40_GLOBAL__N_Signals.cpp_00000000_17C8705F15PrintStackTraceEv
+0x24)[0x884948c]
lli(_ZN40_GLOBAL__N_Signals.cpp_00000000_17C8705F13SignalHandlerEi
+0x115)[0x8849623]
[0xffffe420]
/lib/tls/libc.so.6(abort+0xeb)[0x4018fdbb]
/usr/lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv
+0x179)[0x4010b489]
/usr/lib/libstdc++.so.6[0x40108e15]
/usr/lib/libstdc++.so.6[0x40108e52]
/usr/lib/libstdc++.so.6[0x40108fba]
[0x40307055]
lli
(_ZN4llvm15ExecutionEngine17runFunctionAsMainEPNS_8FunctionERKSt6vectorISsSaISsEEPKPKc
+0x41c)[0x84f7428]
lli(main+0x44b)[0x83b66d3]
/lib/tls/libc.so.6(__libc_start_main+0xd0)[0x4017bea0]
lli[0x83b61c1]
Aborted

I had hoped this would work --- and if I use llvm-g++ to compile  
exceptiontest.cpp to native code it does.  But it looks like the JIT  
is producing stack frames that the C++ runtime doesn't like.

Robert


On Mar 16, 2008, at 12:41 PM, Dale Johannesen wrote:

>
> On Mar 16, 2008, at 5:07 AM, Duncan Sands wrote:
>
>>> Did anything ever come of the work on exception handling for x86_64?
>>>
>>> I'm having problems with exceptions on linux x86_64.
>>
>> I'm fairly sure that exception handling doesn't currently work on
>> x86-64 linux (it may work with darwin - not sure).  I don't know
>> what it would take to get it to work.
>
> On Darwin, the Dwarf metadata emitted in .s/.o files is correct  
> (although there may be bugs, it hasn't been exercised beyond the  
> llvm and gcc testsuites).   The unwinding code in libgcc* has not  
> been ported to x86-64 and does not work.  Thus, if you take the  
> libgcc* from a non-llvm gcc and link llvm-gcc-produced .o files with  
> that, things work.
> It would probably not take much to get Linux x86-64 to this state, I  
> doubt the metadata is much different from Darwin.
>

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: exception handling broken on x86-64?

Anton Korobeynikov
In reply to this post by Bugzilla from tneumann@users.sourceforge.net
Hello, Robert

> I had hoped this would work --- and if I use llvm-g++ to compile  
> exceptiontest.cpp to native code it does.  But it looks like the JIT  
> is producing stack frames that the C++ runtime doesn't like.
Yes, surely. Emission of frames 'on fly' won't automatically make them
visible for the unwinding runtime. JIT currently doesn't register these
frames at all. I'll try to look into this issue little bit later.

--
WBR, Anton Korobeynikov
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev