diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-09-26 01:42:54 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-09-26 01:47:27 -0700 |
| commit | 6af2990549709ec5e2bc1efeb5090a944f1a8bdf (patch) | |
| tree | c4dc51ddde68c2842b6450bd6dee6432e2226bde /test | |
| parent | a337046832b936d912b6902e331cb58bdc513a2d (diff) | |
| download | zig-6af2990549709ec5e2bc1efeb5090a944f1a8bdf.tar.gz zig-6af2990549709ec5e2bc1efeb5090a944f1a8bdf.zip | |
implement -femit-asm, -femit-docs, -femit-llvm-ir, etc
These CLI options are now forwarded to the stage1 backend.
We're not going to support the -mllvm CLI option any longer. As a
compromise, we unconditionally tell LLVM to output intel x86 syntax when
using -femit-asm.
Simplify stage1 logic; it no longer has the concept of an output
directory. --output-dir is no longer a valid CLI option. cmake uses
the `-femit-bin=[path]` option.
Note the changes to test/cli.zig. This breaks the CLI API that Godbolt
is using so we're going to want to open a PR to help them upgrade to the
new CLI for the upcoming Zig 0.7.0 release.
Diffstat (limited to 'test')
| -rw-r--r-- | test/cli.zig | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/test/cli.zig b/test/cli.zig index b9de23e250..c92636fb3c 100644 --- a/test/cli.zig +++ b/test/cli.zig @@ -118,17 +118,20 @@ fn testGodboltApi(zig_exe: []const u8, dir_path: []const u8) anyerror!void { \\} ); - const args = [_][]const u8{ + var args = std.ArrayList([]const u8).init(a); + try args.appendSlice(&[_][]const u8{ zig_exe, "build-obj", "--cache-dir", dir_path, "--name", "example", - "--output-dir", dir_path, - "--emit", "asm", - "-mllvm", "--x86-asm-syntax=intel", - "--strip", "--release-fast", - example_zig_path, "--disable-gen-h", - }; - _ = try exec(dir_path, &args); + "-fno-emit-bin", "-fno-emit-h", + "--strip", "-OReleaseFast", + example_zig_path, + }); + + const emit_asm_arg = try std.fmt.allocPrint(a, "-femit-asm={s}", .{example_s_path}); + try args.append(emit_asm_arg); + + _ = try exec(dir_path, args.items); const out_asm = try std.fs.cwd().readFileAlloc(a, example_s_path, std.math.maxInt(usize)); testing.expect(std.mem.indexOf(u8, out_asm, "square:") != null); |
