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.)
master
Andrew Kelley 2020-04-24 15:36:08 -04:00
parent 058937e44d
commit 9ebf25d145
2 changed files with 6 additions and 2 deletions

View File

@ -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);

View File

@ -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 {