diff options
| author | joachimschmidt557 <joachim.schmidt557@outlook.com> | 2020-11-11 23:29:18 +0100 |
|---|---|---|
| committer | joachimschmidt557 <joachim.schmidt557@outlook.com> | 2020-11-11 23:29:18 +0100 |
| commit | b17859b56863d18ecadb3cf733799a4381e666ac (patch) | |
| tree | 7b6024e55266f2c454234c38a27c72dda4357dd2 | |
| parent | 5b92d0ea45af155a7d3d70aff56301e4c0aee338 (diff) | |
| download | zig-b17859b56863d18ecadb3cf733799a4381e666ac.tar.gz zig-b17859b56863d18ecadb3cf733799a4381e666ac.zip | |
stage2 AArch64: add Linux Hello World test
| -rw-r--r-- | test/stage2/aarch64.zig | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/stage2/aarch64.zig b/test/stage2/aarch64.zig index 48cf7700c1..323d63b9fe 100644 --- a/test/stage2/aarch64.zig +++ b/test/stage2/aarch64.zig @@ -6,6 +6,11 @@ const macos_aarch64 = std.zig.CrossTarget{ .os_tag = .macos, }; +const linux_aarch64 = std.zig.CrossTarget{ + .cpu_arch = .aarch64, + .os_tag = .linux, +}; + pub fn addCases(ctx: *TestContext) !void { // TODO enable when we add codesigning to the self-hosted linker // related to #6971 @@ -112,4 +117,44 @@ pub fn addCases(ctx: *TestContext) !void { \\ ); } + + { + var case = ctx.exe("hello world", linux_aarch64); + // Regular old hello world + case.addCompareOutput( + \\export fn _start() noreturn { + \\ print(); + \\ exit(); + \\} + \\ + \\fn doNothing() void {} + \\ + \\fn answer() u64 { + \\ return 0x1234abcd1234abcd; + \\} + \\ + \\fn print() void { + \\ asm volatile ("svc #0" + \\ : + \\ : [number] "{x8}" (64), + \\ [arg1] "{x0}" (1), + \\ [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), + \\ [arg3] "{x2}" ("Hello, World!\n".len) + \\ : "memory", "cc" + \\ ); + \\} + \\ + \\fn exit() noreturn { + \\ asm volatile ("svc #0" + \\ : + \\ : [number] "{x8}" (93), + \\ [arg1] "{x0}" (0) + \\ : "memory", "cc" + \\ ); + \\ unreachable; + \\} + , + "Hello, World!\n", + ); + } } |
