ELF linker: support common-page-size and max-page-size lld opts

These linker flags are required to build static ELF binaries that
can run under the Blink emulator:

https://github.com/jart/blink/issues/14
This commit is contained in:
Frank Denis
2023-01-05 21:21:29 +01:00
committed by Andrew Kelley
parent c28c38d1e5
commit 6ad92108e2
5 changed files with 46 additions and 0 deletions
+14
View File
@@ -155,6 +155,12 @@ link_z_relro: bool = true,
/// Allow relocations to be lazily processed after load.
link_z_lazy: bool = false,
/// Common page size
link_z_common_page_size: ?u64 = null,
/// Maximum page size
link_z_max_page_size: ?u64 = null,
/// (Darwin) Install name for the dylib
install_name: ?[]const u8 = null,
@@ -1338,6 +1344,14 @@ fn make(step: *Step) !void {
try zig_args.append("-z");
try zig_args.append("lazy");
}
if (self.link_z_common_page_size) |size| {
try zig_args.append("-z");
try zig_args.append(builder.fmt("common-page-size={d}", .{size}));
}
if (self.link_z_max_page_size) |size| {
try zig_args.append("-z");
try zig_args.append(builder.fmt("max-page-size={d}", .{size}));
}
if (self.libc_file) |libc_file| {
try zig_args.append("--libc");