authorgravatar for joachim.schmidt557@outlook.comJoachim Schmidt <joachim.schmidt557@outlook.com> 2020-11-11 23:29:18+01:00
committergravatar for joachim.schmidt557@outlook.comJoachim Schmidt <joachim.schmidt557@outlook.com> 2020-11-11 23:29:18+01:00
logb17859b56863d18ecadb3cf733799a4381e666ac
tree7b6024e55266f2c454234c38a27c72dda4357dd2
parent5b92d0ea45af155a7d3d70aff56301e4c0aee338
signaturelock-open Commit is signed but in an unrecognized format.

stage2 AArch64: add Linux Hello World test


1 files changed, 45 insertions(+), 0 deletions(-)

test/stage2/aarch64.zig+45
......@@ -6,6 +6,11 @@ const macos_aarch64 = std.zig.CrossTarget{
66 .os_tag = .macos,
77};
88
9const linux_aarch64 = std.zig.CrossTarget{
10 .cpu_arch = .aarch64,
11 .os_tag = .linux,
12};
13
914pub fn addCases(ctx: *TestContext) !void {
1015 // TODO enable when we add codesigning to the self-hosted linker
1116 // related to #6971
......@@ -112,4 +117,44 @@ pub fn addCases(ctx: *TestContext) !void {
112117 \\
113118 );
114119 }
120
121 {
122 var case = ctx.exe("hello world", linux_aarch64);
123 // Regular old hello world
124 case.addCompareOutput(
125 \\export fn _start() noreturn {
126 \\ print();
127 \\ exit();
128 \\}
129 \\
130 \\fn doNothing() void {}
131 \\
132 \\fn answer() u64 {
133 \\ return 0x1234abcd1234abcd;
134 \\}
135 \\
136 \\fn print() void {
137 \\ asm volatile ("svc #0"
138 \\ :
139 \\ : [number] "{x8}" (64),
140 \\ [arg1] "{x0}" (1),
141 \\ [arg2] "{x1}" (@ptrToInt("Hello, World!\n")),
142 \\ [arg3] "{x2}" ("Hello, World!\n".len)
143 \\ : "memory", "cc"
144 \\ );
145 \\}
146 \\
147 \\fn exit() noreturn {
148 \\ asm volatile ("svc #0"
149 \\ :
150 \\ : [number] "{x8}" (93),
151 \\ [arg1] "{x0}" (0)
152 \\ : "memory", "cc"
153 \\ );
154 \\ unreachable;
155 \\}
156 ,
157 "Hello, World!\n",
158 );
159 }
115160}