Skip to content

Commit ef39a7d

Browse files
authored
Add support for arm64ec (#587)
The Rust Compiler has recently added support for ARM64EC (rust-lang/rust#119199), so this change adds support for ARM64EC to backtrace by using the same OS structures and functions as x64 NOT AArch64: this is because an ARM64EC binary runs within an x64 process (on an AArch64 machine), thus all the OS binaries it is interfacing with expose the x64 API.
1 parent 7fa4fee commit ef39a7d

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

Diff for: src/backtrace/dbghelp.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl Frame {
6060
#[repr(C, align(16))] // required by `CONTEXT`, is a FIXME in winapi right now
6161
struct MyContext(CONTEXT);
6262

63-
#[cfg(target_arch = "x86_64")]
63+
#[cfg(any(target_arch = "x86_64", target_arch = "arm64ec"))]
6464
impl MyContext {
6565
#[inline(always)]
6666
fn ip(&self) -> DWORD64 {
@@ -122,7 +122,11 @@ impl MyContext {
122122
}
123123
}
124124

125-
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
125+
#[cfg(any(
126+
target_arch = "x86_64",
127+
target_arch = "aarch64",
128+
target_arch = "arm64ec"
129+
))]
126130
#[inline(always)]
127131
pub unsafe fn trace(cb: &mut dyn FnMut(&super::Frame) -> bool) {
128132
use core::ptr;

Diff for: src/windows.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,11 @@ ffi! {
459459
}
460460
}
461461

462-
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
462+
#[cfg(any(
463+
target_arch = "x86_64",
464+
target_arch = "aarch64",
465+
target_arch = "arm64ec"
466+
))]
463467
ffi! {
464468
#[link(name = "kernel32")]
465469
extern "system" {
@@ -606,7 +610,7 @@ ffi! {
606610
}
607611
}
608612

609-
#[cfg(target_arch = "x86_64")]
613+
#[cfg(any(target_arch = "x86_64", target_arch = "arm64ec"))]
610614
ffi! {
611615
#[repr(C, align(8))]
612616
pub struct CONTEXT {
@@ -674,7 +678,7 @@ ffi! {
674678
}
675679

676680
#[repr(C)]
677-
#[cfg(target_arch = "x86_64")]
681+
#[cfg(any(target_arch = "x86_64", target_arch = "arm64ec"))]
678682
#[derive(Copy, Clone)]
679683
pub struct FLOATING_SAVE_AREA {
680684
_Dummy: [u8; 512],

0 commit comments

Comments
 (0)