authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-04-24 15:36:08-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-04-24 15:36:08-04:00
log9ebf25d1458988b6aa75d4608062f18f802c6a38
tree4ceaa7a31cafc2887a3653303441fe3fcca3f53c
parent058937e44df7fe07c09ee9291170a74f58ec1562

link: change default executable mode to 0o777

Jonathan S writes: On common systems with a 022 umask, this will still result in a file created with 755 permissions, but it works appropriately if the system is configured more leniently. (As another data point, C's fopen seems to open files with the 666 mode.)

2 files changed, 6 insertions(+), 2 deletions(-)

lib/std/mem.zig+1-1
......@@ -2061,7 +2061,7 @@ pub fn alignBackward(addr: usize, alignment: usize) usize {
20612061/// The alignment must be a power of 2 and greater than 0.
20622062pub fn alignBackwardGeneric(comptime T: type, addr: T, alignment: T) T {
20632063 assert(@popCount(T, alignment) == 1);
2064 // 000010000 // example addr
2064 // 000010000 // example alignment
20652065 // 000001111 // subtract 1
20662066 // 111110000 // binary not
20672067 return addr & ~(alignment - 1);
src-self-hosted/link.zig+5-1
......@@ -7,7 +7,11 @@ const fs = std.fs;
77const elf = std.elf;
88const codegen = @import("codegen.zig");
99
10const executable_mode = 0o755;
10/// On common systems with a 0o022 umask, 0o777 will still result in a file created
11/// with 0o755 permissions, but it works appropriately if the system is configured
12/// more leniently. As another data point, C's fopen seems to open files with the
13/// 666 mode.
14const executable_mode = 0o777;
1115const default_entry_addr = 0x8000000;
1216
1317pub const ErrorMsg = struct {