[LLVMdev] ARM EHABI support in LLVM + clang

Senthil Kumar senthilkumar_ttv at yahoo.com
Wed Mar 14 05:52:45 PDT 2012


Hi all,
        I found some problem when trying to use exception handling with LLVM (SVN revision 152113) + clang combination (SVN revision 152115). I am observing failure in __gnu_unwind_pr_common unwind-arm.c (gcc/config/arm dir in gcc 4.5.3 source). Personality routine 0 is used.
 
        Inside __gnu_unwind_pr_common after "switch (((offset & 1) << 1) | (len & 1))" control reaches default: return _URC_FAILURE. offset was == 0x808f and len was == 0xff. (((offset & 1) << 1) | (len & 1)) was == 3. 3 is an undefined descriptor as per ARM EHABI spec section 9.2. DwarfException::EmitExceptionTable Asm->EmitULEB128(TTypeBaseOffset, "@TType base offset", SizeAlign); was generating ".asciz  "\217\200"             @ @TType base offset" in .s file leading to the problem.
 
        I would like to know whether anyone managed to use ARM EHABI successfully. Also I can see from 3.0 release html notes EHABI support might be there in 3.1, html comment was there though. Can someone let me know what is the current state of ARM EHABI support for C++ exceptions? I am not sure whether DwarfException::EmitExceptionTable is appropriate to make ARM EHABI specific changes. If someone is already working on this pls let me know your comments. I have mentioned the steps I have followed.
 
$LLVM_BIN_PATH/clang --sysroot=$SYSROOT a.cpp -funwind-tables -ccc-host-triple arm-linux-gnueabi -mcpu=cortex-a9 -emit-llvm -c -o a.bc
$LLVM_BIN_PATH/llc -mtriple=arm-linux-gnueabi -arm-enable-ehabi -arm-enable-ehabi-descriptors -march=arm a.bc
arm-linux-gnueabi-g++ --sysroot=$SYSROOT -static a.s -o a.bin
 
==== a.cpp ====
class A {};
void throwA(int x)
{
  if(x == 0)
        throw A();
}
int main()
{
  try {
    throwA(0);
  } catch (A a) {
    return 0;
  }
  return 1;
}
 
Thanks in advance
Senthil Kumar




More information about the llvm-dev mailing list