add tests for previous commit

This commit is contained in:
Jacob G-W 2021-11-13 12:52:17 -05:00 committed by Jakub Konka
parent 8fc3a707a4
commit 149bc79486
2 changed files with 33 additions and 1 deletions

View File

@ -2604,7 +2604,7 @@ fn addDbgInfoType(self: *Elf, ty: Type, dbg_info_buffer: *std.ArrayList(u8)) !vo
// DW.AT.name, DW.FORM.string
try dbg_info_buffer.writer().print("{}\x00", .{ty});
} else {
log.err("TODO implement .debug_info for type '{}'", .{ty});
log.warn("TODO implement .debug_info for type '{}'", .{ty});
try dbg_info_buffer.append(abbrev_pad1);
}
},

View File

@ -1819,4 +1819,36 @@ pub fn addCases(ctx: *TestContext) !void {
":2:28: error: cannot set address space of local variable 'foo'",
});
}
{
var case = ctx.exe("issue 10138: callee preserved regs working", linux_x64);
case.addCompareOutput(
\\pub fn main() void {
\\ const fd = open();
\\ _ = write(fd, "a", 1);
\\ _ = close(fd);
\\}
\\
\\fn open() usize {
\\ return 42;
\\}
\\
\\fn write(fd: usize, a: [*]const u8, len: usize) usize {
\\ return syscall4(.WRITE, fd, @ptrToInt(a), len);
\\}
\\
\\fn syscall4(n: enum { WRITE }, a: usize, b: usize, c: usize) usize {
\\ _ = n;
\\ _ = a;
\\ _ = b;
\\ _ = c;
\\ return 23;
\\}
\\
\\fn close(fd: usize) usize {
\\ if (fd != 42)
\\ unreachable;
\\ return 0;
\\}
, "");
}
}