stage2 AArch64: add Linux Hello World test

This commit is contained in:
joachimschmidt557 2020-11-11 23:29:18 +01:00
parent 5b92d0ea45
commit b17859b568
No known key found for this signature in database
GPG Key ID: E0B575BE2884ACC5

View File

@ -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",
);
}
}