authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-05 20:39:24-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-05 21:54:05-07:00
logc34392b24e5ef69f34dd73f08d9e1e9add1385cd
treedf9d8911dabe5dc8d4111c5f8d1267c33019c989
parentf639cb33a9acf71e32fb69882cf59250148cfaff

std.os.linux.io_uring: work around LLVM bug

See #12014

1 files changed, 7 insertions(+), 1 deletions(-)

lib/std/os/linux/io_uring.zig+7-1
...@@ -1902,6 +1902,12 @@ test "openat" {...@@ -1902,6 +1902,12 @@ test "openat" {
1902 const path = "test_io_uring_openat";1902 const path = "test_io_uring_openat";
1903 defer std.fs.cwd().deleteFile(path) catch {};1903 defer std.fs.cwd().deleteFile(path) catch {};
19041904
1905 // Workaround for LLVM bug: https://github.com/ziglang/zig/issues/12014
1906 const path_addr = if (builtin.zig_backend == .stage2_llvm) p: {
1907 var workaround = path;
1908 break :p @ptrToInt(workaround);
1909 } else @ptrToInt(path);
1910
1905 const flags: u32 = os.O.CLOEXEC | os.O.RDWR | os.O.CREAT;1911 const flags: u32 = os.O.CLOEXEC | os.O.RDWR | os.O.CREAT;
1906 const mode: os.mode_t = 0o666;1912 const mode: os.mode_t = 0o666;
1907 const sqe_openat = try ring.openat(0x33333333, linux.AT.FDCWD, path, flags, mode);1913 const sqe_openat = try ring.openat(0x33333333, linux.AT.FDCWD, path, flags, mode);
...@@ -1911,7 +1917,7 @@ test "openat" {...@@ -1911,7 +1917,7 @@ test "openat" {
1911 .ioprio = 0,1917 .ioprio = 0,
1912 .fd = linux.AT.FDCWD,1918 .fd = linux.AT.FDCWD,
1913 .off = 0,1919 .off = 0,
1914 .addr = @ptrToInt(path),1920 .addr = path_addr,
1915 .len = mode,1921 .len = mode,
1916 .rw_flags = flags,1922 .rw_flags = flags,
1917 .user_data = 0x33333333,1923 .user_data = 0x33333333,