mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
std: don't get CPU context when using CBE targeting MSVC
Calling `current` here causes compilation failures as the C backend currently does not emit valid MSVC inline assembly. This change means that when building for MSVC with the self-hosted C backend, only FP unwinding can be used.
This commit is contained in:
parent
dae703d3c0
commit
084e92879a
@ -756,7 +756,13 @@ const StackIterator = union(enum) {
|
|||||||
// Use `di_first` here so we report the PC in the context before unwinding any further.
|
// Use `di_first` here so we report the PC in the context before unwinding any further.
|
||||||
return .{ .di_first = .init(context_ptr) };
|
return .{ .di_first = .init(context_ptr) };
|
||||||
}
|
}
|
||||||
if (SelfInfo.supports_unwinding and cpu_context.Native != noreturn) {
|
// Workaround the C backend being unable to use inline assembly on MSVC by disabling the
|
||||||
|
// call to `current`. This effectively constrains stack trace collection and dumping to FP
|
||||||
|
// unwinding when building with CBE for MSVC.
|
||||||
|
if (!(builtin.zig_backend == .stage2_c and builtin.target.abi == .msvc) and
|
||||||
|
SelfInfo.supports_unwinding and
|
||||||
|
cpu_context.Native != noreturn)
|
||||||
|
{
|
||||||
// We don't need `di_first` here, because our PC is in `std.debug`; we're only interested
|
// We don't need `di_first` here, because our PC is in `std.debug`; we're only interested
|
||||||
// in our caller's frame and above.
|
// in our caller's frame and above.
|
||||||
return .{ .di = .init(&.current()) };
|
return .{ .di = .init(&.current()) };
|
||||||
|
|||||||
@ -316,7 +316,7 @@ pub const X86_64 = struct {
|
|||||||
\\movq %%r15, 0x78(%%rdi)
|
\\movq %%r15, 0x78(%%rdi)
|
||||||
\\leaq (%%rip), %%rax
|
\\leaq (%%rip), %%rax
|
||||||
\\movq %%rax, 0x80(%%rdi)
|
\\movq %%rax, 0x80(%%rdi)
|
||||||
\\movq 0x00(%%rdi), %%rax // restore saved rax
|
\\movq 0x00(%%rdi), %%rax
|
||||||
:
|
:
|
||||||
: [gprs] "{rdi}" (&ctx.gprs.values),
|
: [gprs] "{rdi}" (&ctx.gprs.values),
|
||||||
: .{ .memory = true });
|
: .{ .memory = true });
|
||||||
@ -431,7 +431,7 @@ pub const Aarch64 = extern struct {
|
|||||||
\\str x1, [x0, #0x0f8]
|
\\str x1, [x0, #0x0f8]
|
||||||
\\adr x1, .
|
\\adr x1, .
|
||||||
\\str x1, [x0, #0x100]
|
\\str x1, [x0, #0x100]
|
||||||
\\ldr x1, [x0, #0x008] // restore saved x1
|
\\ldr x1, [x0, #0x008]
|
||||||
:
|
:
|
||||||
: [gprs] "{x0}" (&ctx),
|
: [gprs] "{x0}" (&ctx),
|
||||||
: .{ .memory = true });
|
: .{ .memory = true });
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user