interest in an .eh_frame parser in llvm?

Hi all,

Our use case for LLVM requires us to parse the .eh_frame sections
emitted by MCJIT (for callee-saved-register spill slots, amongst other
things). Does it make sense to have an in-tree parser for .eh_frame,
given that it will make such tasks a lot easier?

-- Sanjoy

Definitely interested, you can probably throw it into the stuff in lib/DebugInfo if that makes sense.

-eric

I believe libc++abi already has such a parser.

Is it appropriate to adapt that CFI parser for use within LLVM or not?

I also know that ld64 does some translation from DWARF CFI to a more compact format, and lld may wish to replicate that functionality.

This also feels related to the Itanium C++ ABI demangling problem, where we have an implementation in libc++abi, but we can’t reliably use it from clang or lld. Maybe we can factor out an interface below the libunwind unw_* interface and cxxabi cxa_* symbols, and link that into LLVM.

I’d be interested in that, though would it be an issue if it doesn’t have an in-tree user?

Quite possibly. It would bit rot if nothing else. At minimum, we need a dumper tool - possibly an option to an existing one - which produces human readable output and a bunch of lit tests to ensure it’s not broken by other changes. In particular, we need to make sure that the in tree parser can parse the sections llvm itself is producing. p.s. One thing I think we need to be very careful to document is that this .eh_frame parser is version locked to the same version of llvm and is only guaranteed to parse output from that version of llvm. I’m not opposed to trying to be more generic, but I suspect that would involve a lot more work.

Quite possibly. It would bit rot if nothing else. At minimum, we need a dumper tool - possibly an option to an existing one - which produces human readable output and a bunch of lit tests to ensure it’s not broken by other changes. In particular, we need to make sure that the in tree parser can parse the sections llvm itself is producing. p.s. One thing I think we need to be very careful to document is that this .eh_frame parser is version locked to the same version of llvm and is only guaranteed to parse output from that version of llvm. I’m not opposed to trying to be more generic, but I suspect that would involve a lot more work.

I’d be interested in that, though would it be an issue if it doesn’t have an in-tree user?

Quite possibly. It would bit rot if nothing else.

At minimum, we need a dumper tool - possibly an option to an existing one - which produces human readable output and a bunch of lit tests to ensure it’s not broken by other changes. In particular, we need to make sure that the in tree parser can parse the sections llvm itself is producing.

Yeah, that’s why I was mentioning throwing it into lib/DebugInfo. That way llvm-dwarfdump or llvm-objdump could dump the sections that we produce.

-eric

‘llvm-readobj -u’ supports dumping ARM EHABI unwind info and the Windows UNWIND_INFO codes from .xdata, so this seems like a natural thing to hook up there as well.