Skip to content

Commit

Permalink
stage2: add aarch64 stage2 tests
Browse files Browse the repository at this point in the history
Fix missing string format specifier in Mach-O used to generate
path to debug symbols bundle.
  • Loading branch information
kubkon committed Jan 3, 2021
1 parent 2a410ba commit 807dc56
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/link/MachO.zig
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio
self.base.file = file;

// Create dSYM bundle.
const d_sym_path = try fmt.allocPrint(allocator, "{}.dSYM/Contents/Resources/DWARF/", .{sub_path});
const d_sym_path = try fmt.allocPrint(allocator, "{s}.dSYM/Contents/Resources/DWARF/", .{sub_path});
defer allocator.free(d_sym_path);
var d_sym_bundle = try options.emit.?.directory.handle.makeOpenPath(d_sym_path, .{});
defer d_sym_bundle.close();
Expand Down
44 changes: 44 additions & 0 deletions test/stage2/aarch64.zig
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,48 @@ pub fn addCases(ctx: *TestContext) !void {
"Hello, World!\n",
);
}

{
var case = ctx.exe("exit fn taking argument", macos_aarch64);

case.addCompareOutput(
\\export fn _start() noreturn {
\\ exit(0);
\\}
\\
\\fn exit(ret: usize) noreturn {
\\ asm volatile ("svc #0x80"
\\ :
\\ : [number] "{x16}" (1),
\\ [arg1] "{x0}" (ret)
\\ : "memory"
\\ );
\\ unreachable;
\\}
,
"",
);
}

{
var case = ctx.exe("exit fn taking argument", linux_aarch64);

case.addCompareOutput(
\\export fn _start() noreturn {
\\ exit(0);
\\}
\\
\\fn exit(ret: usize) noreturn {
\\ asm volatile ("svc #0"
\\ :
\\ : [number] "{x8}" (93),
\\ [arg1] "{x0}" (ret)
\\ : "memory", "cc"
\\ );
\\ unreachable;
\\}
,
"",
);
}
}

0 comments on commit 807dc56

Please sign in to comment.