Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions crates/runtime/src/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ void* GetPcFromUContext(ucontext_t *cx) {
}
#endif

#if defined(__FreeBSD__) && defined(__x86_64__)
#include <sys/ucontext.h>

void* GetPcFromUContext(ucontext_t *cx) {
return (void*) cx->uc_mcontext.mc_rip;
}
#endif


#if defined(__linux__) && defined(__aarch64__)
#include <sys/ucontext.h>

Expand Down
2 changes: 1 addition & 1 deletion crates/runtime/src/traphandlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ cfg_if::cfg_if! {
fn GetPcFromUContext(cx: *mut libc::c_void) -> *const u8;
}
GetPcFromUContext(cx)
} else if #[cfg(target_os = "macos")] {
} else if #[cfg(any(target_os = "macos", target_os = "freebsd"))] {
// FIXME(rust-lang/libc#1702) - once that lands and is
// released we should inline the definition here
extern "C" {
Expand Down