diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2018-07-16 16:38:56 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2018-08-15 17:20:13 -0700 |
| commit | fccc04d3e72bb462cba1b492ba0e2cd4ab2aebec (patch) | |
| tree | c7f02bfe96a7865c68ce3403516ed220ce0510fb /src/libstd/sys/windows/backtrace | |
| parent | d767ee11616390d128853a06f5addb619e79213f (diff) | |
| download | rust-fccc04d3e72bb462cba1b492ba0e2cd4ab2aebec.tar.gz rust-fccc04d3e72bb462cba1b492ba0e2cd4ab2aebec.zip | |
Start adding an `aarch64-pc-windows-msvc` target
This commit adds the necessary definitions for target specs and such as well as
the necessary support in libstd to compile basic `aarch64-pc-windows-msvc`
binaries. The target is not currently built on CI, but it can be built locally
with:
./configure --target=aarch64-pc-windows-msvc --set rust.lld
./x.py build src/libstd --target aarch64-pc-windows-msvc
Currently this fails to build `libtest` due to a linker bug (seemingly in LLD?)
which hasn't been investigate yet. Otherwise though with libstd you can build a
hello world program (linked with LLD). I've not tried to execute it yet, but it
at least links!
Full support for this target is still a long road ahead, but this is hopefully a
good stepping stone to get started.
Points of note about this target are:
* Currently defaults to `panic=abort` as support is still landing in LLVM for
SEH on AArch64.
* Currently defaults to LLD as a linker as I was able to get farther with it
than I was with `link.exe`
Diffstat (limited to 'src/libstd/sys/windows/backtrace')
| -rw-r--r-- | src/libstd/sys/windows/backtrace/mod.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/libstd/sys/windows/backtrace/mod.rs b/src/libstd/sys/windows/backtrace/mod.rs index 7ef4e203571..f64cae810b9 100644 --- a/src/libstd/sys/windows/backtrace/mod.rs +++ b/src/libstd/sys/windows/backtrace/mod.rs @@ -229,6 +229,7 @@ impl StackFrame for c::STACKFRAME_EX { self.AddrFrame.Mode = c::ADDRESS_MODE::AddrModeFlat; c::IMAGE_FILE_MACHINE_I386 } + #[cfg(target_arch = "x86_64")] fn init(&mut self, ctx: &c::CONTEXT) -> c::DWORD { self.AddrPC.Offset = ctx.Rip as u64; @@ -240,6 +241,17 @@ impl StackFrame for c::STACKFRAME_EX { c::IMAGE_FILE_MACHINE_AMD64 } + #[cfg(target_arch = "aarch64")] + fn init(&mut self, ctx: &c::CONTEXT) -> c::DWORD { + self.AddrPC.Offset = ctx.Pc as u64; + self.AddrPC.Mode = c::ADDRESS_MODE::AddrModeFlat; + self.AddrStack.Offset = ctx.Sp as u64; + self.AddrStack.Mode = c::ADDRESS_MODE::AddrModeFlat; + self.AddrFrame.Offset = ctx.Fp as u64; + self.AddrFrame.Mode = c::ADDRESS_MODE::AddrModeFlat; + c::IMAGE_FILE_MACHINE_ARM64 + } + fn get_addr(&self) -> *const u8 { (self.AddrPC.Offset - 1) as *const u8 } @@ -260,6 +272,7 @@ impl StackFrame for c::STACKFRAME64 { self.AddrFrame.Mode = c::ADDRESS_MODE::AddrModeFlat; c::IMAGE_FILE_MACHINE_I386 } + #[cfg(target_arch = "x86_64")] fn init(&mut self, ctx: &c::CONTEXT) -> c::DWORD { self.AddrPC.Offset = ctx.Rip as u64; @@ -271,6 +284,17 @@ impl StackFrame for c::STACKFRAME64 { c::IMAGE_FILE_MACHINE_AMD64 } + #[cfg(target_arch = "aarch64")] + fn init(&mut self, ctx: &c::CONTEXT) -> c::DWORD { + self.AddrPC.Offset = ctx.Pc as u64; + self.AddrPC.Mode = c::ADDRESS_MODE::AddrModeFlat; + self.AddrStack.Offset = ctx.Sp as u64; + self.AddrStack.Mode = c::ADDRESS_MODE::AddrModeFlat; + self.AddrFrame.Offset = ctx.Fp as u64; + self.AddrFrame.Mode = c::ADDRESS_MODE::AddrModeFlat; + c::IMAGE_FILE_MACHINE_ARM64 + } + fn get_addr(&self) -> *const u8 { (self.AddrPC.Offset - 1) as *const u8 } |
