[PATCH] D73739: Exception support for basic block sections

James Y Knight via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 05:47:28 PST 2023


jyknight added a comment.
Herald added subscribers: pmatos, asb, pengfei.
Herald added a project: All.

> This does not matter in practice because these call site tables are all comprehensive

Unfortunately, this isn't exactly true: the callsite table can have gaps in it. Currently, the gaps only arise for IP-ranges which are not supposed to unwind (e.g. no calls or only "nounwind" calls). This is already somewhat unfortunate, as if you _do_ unwind from such a range, the malformed table will probably cause some misbehavior inside of the unwinder library.

But, the real problem only arises with a change-series I'm working on for https://discourse.llvm.org/t/rfc-add-call-unwindabort-to-llvm-ir/62543, which uses a gap to indicate "call std::terminate".

I think one of two things needs to be done:

1. Emit properly-formed tables, via emitting a separate action table per callsite table. (IMO this would be the better idea...)
2. Fix the hack, by emitting a final entry for every non-function-end callsite table, which guarantees to cover the end of the basic-block-section. This will fix the issue because the unwinder will stop iterating on two conditions: a) when it reaches the end of the table (as indicated by the callsite table size), or b) once it finds that the "start" address in the examined callsite table entry is past the lookup address (since the table is guaranteed to be sorted by address). As long as we can ensure property b, by ensuring an entry in the map that covers the end of the basic-block-section, should get correct behavior.

I can cook up a patch for option 2, though it still makes me rather uncomfortable that this code is emitting malformed tables.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73739/new/

https://reviews.llvm.org/D73739



More information about the llvm-commits mailing list