diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-12-02 14:51:22 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-12-02 14:52:56 -0700 |
| commit | 463186e8565c717049fabd4ff1c2442053c8ba9a (patch) | |
| tree | 953c1f5f517efbd1b34fd4392e397a6d627bc416 /src/codegen.zig | |
| parent | f84232714791137ab0e3f457b0eed773e476f293 (diff) | |
| download | zig-463186e8565c717049fabd4ff1c2442053c8ba9a.tar.gz zig-463186e8565c717049fabd4ff1c2442053c8ba9a.zip | |
stage2: wire up -Dskip-non-native
The purpose of this is to save time in the edit-compile-test cycle when
working on stage2 code.
Diffstat (limited to 'src/codegen.zig')
| -rw-r--r-- | src/codegen.zig | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/codegen.zig b/src/codegen.zig index ee3f0ee4a8..c5bf3c1249 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -16,6 +16,7 @@ const trace = @import("tracy.zig").trace; const DW = std.dwarf; const leb128 = std.leb; const log = std.log.scoped(.codegen); +const build_options = @import("build_options"); /// The codegen-related data that is stored in `ir.Inst.Block` instructions. pub const BlockData = struct { @@ -427,6 +428,10 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { code: *std.ArrayList(u8), debug_output: DebugInfoOutput, ) GenerateSymbolError!Result { + if (build_options.skip_non_native and std.Target.current.cpu.arch != arch) { + @panic("Attempted to compile for architecture that was disabled by build configuration"); + } + const module_fn = typed_value.val.cast(Value.Payload.Function).?.func; const fn_type = module_fn.owner_decl.typed_value.most_recent.typed_value.ty; |
