Skip to content

Commit 9ebf25d

Browse files
committed
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 commit 9ebf25d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/std/mem.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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.
20622062
pub 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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ const fs = std.fs;
77
const elf = std.elf;
88
const codegen = @import("codegen.zig");
99

10-
const 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.
14+
const executable_mode = 0o777;
1115
const default_entry_addr = 0x8000000;
1216

1317
pub const ErrorMsg = struct {

0 commit comments

Comments
 (0)