[LLVMdev] ARM EABI Exceptions

Renato Golin renato.golin at arm.com
Mon May 17 10:02:35 PDT 2010


Hi,

I was comparing the way LLVM generates the exception table and it looks
a bit different from what GCC (arm-none-eabi-g++) generates.

Maybe that's because clang is not generating ARM IR when I do:

$ clang -c -emit-llvm -march=arm -mcpu=cortex-a8 -mtriple=arm-none-eabi
exception.cpp -o exception.clang.bc
clang: warning: argument unused during compilation: '-mcpu=cortex-a8'
clang: warning: argument unused during compilation:
'-mtriple=arm-none-eabi'

The IR triple is "x86_64-unknown-linux-gnu". Is there a way I can force
the triple?

Then I compiled with llc:

$ llc -march=arm -mcpu=cortex-a8 -mtriple=arm-none-eabi
exception.clang.ll -o exception.clang.s

It doesn't generate the tables because ARMELFMCAsmInfo doesn't set
ExceptionsType. If I set it to Dwarf and fix the missing lowering
operations (EXCEPTIONADDR and EHSELECTION), it does generate a table
which is slightly different than what GCC is doing.

I've compared the assembly generated and it's close, but not perfect.
Some EABI issues (frame pointer, some intrinsics mismatch, EH call
table) were present, but the general execution flow seems very similar.

If I compile the resulting asm with GCC ("-T generic-hosted.ld") and
run, it breaks completely. GCC's run flawlessly.

Anyone has any idea on the status of exception handling in clang/LLVM?
DwarfException cannot be easily overwritten, and adding target specific
code to it seems wrong...

Attached is my example compiled with Codesourcery's GCC (2009q3) and
clang (2.7).

cheers,
--renato

-------------- next part --------------
A non-text attachment was scrubbed...
Name: exception-clang-example.tar.gz
Type: application/x-compressed-tar
Size: 9630 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100517/ba3d2692/attachment.bin>


More information about the llvm-dev mailing list