[llvm-dev] What is __builtin_dwarf_cfa()?
陳韋任 via llvm-dev
llvm-dev at lists.llvm.org
Wed Mar 14 06:21:58 PDT 2018
Hi All,
While compiling libgcc with LLVM for our target, it seems I don't
get __builtin_dwarf_cfa() right. That causes uw_init_context_1 [1]
initialize the wrong context, and the overall exception handling fail.
I find Hal provided patch years ago adding ISD::EH_DWARF_CFA, which
corresponding to __builtin_dwarf_cfa(), and let us have the
opportunity to handle __builtin_dwarf_cfa() for our own [2].
I copy Mips' lowerEH_DWARF_CFA for our target, and it *just* works
[3]. I have to admit that I don't understand what Hal explained in his
patch, also don't know why Mips code work for ours. Here I have two
questions:
1. What is __builtin_dwarf_cfa()?
What I know about CFA (Canonical Frame Address) is, it's a
base address which we can restore registers for the caller frame. Why
do we have to call __builtin_dwarf_cfa() for uw_init_context_1, I
don't see the connection between them.
2. Why Mips code works for our target?
Okay... Maybe when I fully understand the answer of question
1, I can answer this by myself. But what does Mips' lowerEH_DWARF_CFA?
And why only PowerPC and Mips have to lower EH_DWARF_CFA by
themselves?
Thanks.
P.S. ASCII art might be help on explaining the whole thing. ;-)
[1] https://github.com/gcc-mirror/gcc/blob/master/libgcc/unwind-dw2.c
[2] https://reviews.llvm.org/rL280350
[3] http://llvm.org/doxygen/MipsISelLowering_8cpp_source.html
--
Wei-Ren Chen (陳韋任)
Homepage: https://people.cs.nctu.edu.tw/~chenwj
More information about the llvm-dev
mailing list