Skip to content

Commit

Permalink
Interpret EH actions properly
Browse files Browse the repository at this point in the history
The EH actions stored in the LSDA follows the format of GCC except table
(even for LLVM-generated code). An missing action in the table is the
encoding for `Terminate`, see [1].

The currently code interprets it as `None`, as a workaround for rust-lang#35011,
an issue that seems to occur in LLVM 3.7 and not after 3.9. These are
very old versions of LLVM and we don't support them anymore, so remove
this workaround and interpret them properly.

Note that LLVM currently does not emit any `Terminate` actions, but GCC
does. Although GCC backend currently doesn't do unwinding, removing it
preemptively would prevent future developers from wasting time to figure
out what's wrong.

[1]: https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/libsupc%2B%2B/eh_personality.cc#L522-L526
  • Loading branch information
nbdd0121 committed Oct 5, 2022
1 parent 01af504 commit 8bda133
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions library/std/src/personality/dwarf/eh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext<'_>) -> Result
}
}
}
// Ip is not present in the table. This should not happen... but it does: issue #35011.
// So rather than returning EHAction::Terminate, we do this.
Ok(EHAction::None)
// Ip is not present in the table. This indicates a nounwind call.
Ok(EHAction::Terminate)
} else {
// SjLj version:
// The "IP" is an index into the call-site table, with two exceptions:
Expand Down

0 comments on commit 8bda133

Please sign in to comment.