| author | |
| committer | |
| log | cff5358f60bac70728c9b738c8311e055e96d04a |
| tree | 1e89a67d08c3c0b3afa318b758d9b4512771ceb6 |
| parent | 3cbd0065fa4b0f659dfb1733b25bd09e37442d09 |
5 files changed, 24 insertions(+), 9 deletions(-)
src/codegen.cpp+2-2| ... | ... | @@ -381,10 +381,10 @@ static LLVMValueRef fn_llvm_value(CodeGen *g, FnTableEntry *fn_table_entry) { |
| 381 | 381 | LLVMSetLinkage(fn_table_entry->llvm_value, LLVMExternalLinkage); |
| 382 | 382 | break; |
| 383 | 383 | case GlobalLinkageIdWeak: |
| 384 | LLVMSetLinkage(fn_table_entry->llvm_value, LLVMWeakODRLinkage); | |
| 384 | LLVMSetLinkage(fn_table_entry->llvm_value, LLVMWeakAnyLinkage); | |
| 385 | 385 | break; |
| 386 | 386 | case GlobalLinkageIdLinkOnce: |
| 387 | LLVMSetLinkage(fn_table_entry->llvm_value, LLVMLinkOnceODRLinkage); | |
| 387 | LLVMSetLinkage(fn_table_entry->llvm_value, LLVMLinkOnceAnyLinkage); | |
| 388 | 388 | break; |
| 389 | 389 | } |
| 390 | 390 |
std/debug.zig+2-1| ... | ... | @@ -92,7 +92,8 @@ pub fn writeStackTrace(out_stream: &io.OutStream, allocator: &mem.Allocator, tty |
| 92 | 92 | const ptr_hex = if (@sizeOf(usize) == 4) "0x{x8}" else "0x{x16}"; |
| 93 | 93 | |
| 94 | 94 | const compile_unit = findCompileUnit(st, return_address) ?? { |
| 95 | %return out_stream.print(DIM ++ ptr_hex ++ " in ??? (???)" ++ RESET ++ "\n\n\n", return_address); | |
| 95 | %return out_stream.print("???:?:?: " ++ DIM ++ ptr_hex ++ " in ??? (???)" ++ RESET ++ "\n ???\n\n", | |
| 96 | return_address); | |
| 96 | 97 | %return out_stream.flush(); |
| 97 | 98 | continue; |
| 98 | 99 | }; |
std/os/index.zig+14-5| ... | ... | @@ -52,6 +52,7 @@ error ReadOnlyFileSystem; |
| 52 | 52 | error LinkQuotaExceeded; |
| 53 | 53 | error RenameAcrossMountPoints; |
| 54 | 54 | error DirNotEmpty; |
| 55 | error WouldBlock; | |
| 55 | 56 | |
| 56 | 57 | /// Fills `buf` with random bytes. If linking against libc, this calls the |
| 57 | 58 | /// appropriate OS-specific library call. Otherwise it uses the zig standard |
| ... | ... | @@ -128,6 +129,11 @@ pub fn posixClose(fd: i32) { |
| 128 | 129 | } |
| 129 | 130 | } |
| 130 | 131 | |
| 132 | error WouldBlock; | |
| 133 | error FileClosed; | |
| 134 | error DestinationAddressRequired; | |
| 135 | error FileSystem; | |
| 136 | ||
| 131 | 137 | /// Calls POSIX write, and keeps trying if it gets interrupted. |
| 132 | 138 | pub fn posixWrite(fd: i32, bytes: []const u8) -> %void { |
| 133 | 139 | while (true) { |
| ... | ... | @@ -136,12 +142,15 @@ pub fn posixWrite(fd: i32, bytes: []const u8) -> %void { |
| 136 | 142 | if (write_err > 0) { |
| 137 | 143 | return switch (write_err) { |
| 138 | 144 | errno.EINTR => continue, |
| 139 | errno.EINVAL => unreachable, | |
| 145 | errno.EINVAL, errno.EFAULT => unreachable, | |
| 146 | errno.EAGAIN => error.WouldBlock, | |
| 147 | errno.EBADF => error.FileClosed, | |
| 148 | errno.EDESTADDRREQ => error.DestinationAddressRequired, | |
| 140 | 149 | errno.EDQUOT => error.DiskQuota, |
| 141 | 150 | errno.EFBIG => error.FileTooBig, |
| 142 | errno.EIO => error.Io, | |
| 151 | errno.EIO => error.FileSystem, | |
| 143 | 152 | errno.ENOSPC => error.NoSpaceLeft, |
| 144 | errno.EPERM => error.BadPerm, | |
| 153 | errno.EPERM => error.AccessDenied, | |
| 145 | 154 | errno.EPIPE => error.PipeFail, |
| 146 | 155 | else => error.Unexpected, |
| 147 | 156 | } |
| ... | ... | @@ -185,7 +194,7 @@ pub fn posixOpen(file_path: []const u8, flags: usize, perm: usize, allocator: ?& |
| 185 | 194 | |
| 186 | 195 | errno.EFAULT => unreachable, |
| 187 | 196 | errno.EINVAL => unreachable, |
| 188 | errno.EACCES => error.BadPerm, | |
| 197 | errno.EACCES => error.AccessDenied, | |
| 189 | 198 | errno.EFBIG, errno.EOVERFLOW => error.FileTooBig, |
| 190 | 199 | errno.EISDIR => error.IsDir, |
| 191 | 200 | errno.ELOOP => error.SymLinkLoop, |
| ... | ... | @@ -197,7 +206,7 @@ pub fn posixOpen(file_path: []const u8, flags: usize, perm: usize, allocator: ?& |
| 197 | 206 | errno.ENOMEM => error.SystemResources, |
| 198 | 207 | errno.ENOSPC => error.NoSpaceLeft, |
| 199 | 208 | errno.ENOTDIR => error.NotDir, |
| 200 | errno.EPERM => error.BadPerm, | |
| 209 | errno.EPERM => error.AccessDenied, | |
| 201 | 210 | else => error.Unexpected, |
| 202 | 211 | } |
| 203 | 212 | } |
std/special/builtin.zig+5| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | // Note that these functions do not return `dest`, like the libc API. |
| 5 | 5 | // The semantics of these functions is dictated by the corresponding |
| 6 | 6 | // LLVM intrinsics, not by the libc API. |
| 7 | const builtin = @import("builtin"); | |
| 7 | 8 | |
| 8 | 9 | export fn memset(dest: ?&u8, c: u8, n: usize) { |
| 9 | 10 | @setDebugSafety(this, false); |
| ... | ... | @@ -31,5 +32,9 @@ export fn memcpy(noalias dest: ?&u8, noalias src: ?&const u8, n: usize) { |
| 31 | 32 | } |
| 32 | 33 | |
| 33 | 34 | export fn __stack_chk_fail() { |
| 35 | if (builtin.is_release) { | |
| 36 | @setGlobalLinkage(__stack_chk_fail, builtin.GlobalLinkage.Internal); | |
| 37 | unreachable; | |
| 38 | } | |
| 34 | 39 | @panic("stack smashing detected"); |
| 35 | 40 | } |
std/special/zigrt.zig+1-1| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | const builtin = @import("builtin"); |
| 6 | 6 | |
| 7 | 7 | export coldcc fn __zig_panic(message_ptr: &const u8, message_len: usize) -> noreturn { |
| 8 | @setGlobalLinkage(__zig_panic, builtin.GlobalLinkage.Weak); | |
| 8 | @setGlobalLinkage(__zig_panic, builtin.GlobalLinkage.LinkOnce); | |
| 9 | 9 | @setDebugSafety(this, false); |
| 10 | 10 | |
| 11 | 11 | if (builtin.__zig_panic_implementation_provided) { |