Commit 9ebf25d145

Andrew Kelley <andrew@ziglang.org>
2020-04-24 21:36:08
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.)
1 parent 058937e
Changed files (2)
lib
src-self-hosted
lib/std/mem.zig
@@ -2061,7 +2061,7 @@ pub fn alignBackward(addr: usize, alignment: usize) usize {
 /// The alignment must be a power of 2 and greater than 0.
 pub fn alignBackwardGeneric(comptime T: type, addr: T, alignment: T) T {
     assert(@popCount(T, alignment) == 1);
-    // 000010000 // example addr
+    // 000010000 // example alignment
     // 000001111 // subtract 1
     // 111110000 // binary not
     return addr & ~(alignment - 1);
src-self-hosted/link.zig
@@ -7,7 +7,11 @@ const fs = std.fs;
 const elf = std.elf;
 const codegen = @import("codegen.zig");
 
-const executable_mode = 0o755;
+/// On common systems with a 0o022 umask, 0o777 will still result in a file created
+/// with 0o755 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.
+const executable_mode = 0o777;
 const default_entry_addr = 0x8000000;
 
 pub const ErrorMsg = struct {