See this commit: 6af2990549709ec5e2bc1efeb5090a944f1a8bdf
That diff tells how godbolt needs to update its command line to the new API. Specifically the changes to test/cli.zig:
--- 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);
https://github.com/compiler-explorer/compiler-explorer/
This a really valuable contribution if anyone is willing to take on this chore!
For bonus points, zig could be integrated into their "a.out" thing. I'm not sure how it works on their end, but now you can pass both -femit-bin=foo and -femit-asm=foo.s and zig will output both a binary which can be executed and the assembly for it.
Opened a PR, compiler-explorer/compiler-explorer#2254
The PR was just merged, I will wait until the changes are live on the website then close this issue
Thanks Alex!
Most helpful comment
Opened a PR, compiler-explorer/compiler-explorer#2254