@@ -495,6 +495,8 @@ const usage_build_generic =
495
495
\\ lazy Don't force all relocations to be processed on load
496
496
\\ relro (default) Force all relocations to be read-only after processing
497
497
\\ norelro Don't force all relocations to be read-only after processing
498
+ \\ common-page-size=[bytes] Set the common page size for ELF binaries
499
+ \\ max-page-size=[bytes] Set the max page size for ELF binaries
498
500
\\ -dynamic Force output to be dynamically linked
499
501
\\ -static Force output to be statically linked
500
502
\\ -Bsymbolic Bind global references locally
@@ -744,6 +746,8 @@ fn buildOutputType(
744
746
var linker_z_origin = false ;
745
747
var linker_z_now = true ;
746
748
var linker_z_relro = true ;
749
+ var linker_z_common_page_size : ? u64 = null ;
750
+ var linker_z_max_page_size : ? u64 = null ;
747
751
var linker_tsaware = false ;
748
752
var linker_nxcompat = false ;
749
753
var linker_dynamicbase = false ;
@@ -1325,6 +1329,10 @@ fn buildOutputType(
1325
1329
linker_z_relro = true ;
1326
1330
} else if (mem .eql (u8 , z_arg , "norelro" )) {
1327
1331
linker_z_relro = false ;
1332
+ } else if (mem .startsWith (u8 , z_arg , "common-page-size=" )) {
1333
+ linker_z_common_page_size = parseIntSuffix (z_arg , "common-page-size=" .len );
1334
+ } else if (mem .startsWith (u8 , z_arg , "max-page-size=" )) {
1335
+ linker_z_max_page_size = parseIntSuffix (z_arg , "max-page-size=" .len );
1328
1336
} else {
1329
1337
warn ("unsupported linker extension flag: -z {s}" , .{z_arg });
1330
1338
}
@@ -1923,6 +1931,10 @@ fn buildOutputType(
1923
1931
stack_size_override = std .fmt .parseUnsigned (u64 , next_arg , 0 ) catch | err | {
1924
1932
fatal ("unable to parse stack size '{s}': {s}" , .{ next_arg , @errorName (err ) });
1925
1933
};
1934
+ } else if (mem .startsWith (u8 , z_arg , "common-page-size=" )) {
1935
+ linker_z_common_page_size = parseIntSuffix (z_arg , "common-page-size=" .len );
1936
+ } else if (mem .startsWith (u8 , z_arg , "max-page-size=" )) {
1937
+ linker_z_max_page_size = parseIntSuffix (z_arg , "max-page-size=" .len );
1926
1938
} else {
1927
1939
warn ("unsupported linker extension flag: -z {s}" , .{z_arg });
1928
1940
}
@@ -3042,6 +3054,8 @@ fn buildOutputType(
3042
3054
.linker_z_origin = linker_z_origin ,
3043
3055
.linker_z_now = linker_z_now ,
3044
3056
.linker_z_relro = linker_z_relro ,
3057
+ .linker_z_common_page_size = linker_z_common_page_size ,
3058
+ .linker_z_max_page_size = linker_z_max_page_size ,
3045
3059
.linker_tsaware = linker_tsaware ,
3046
3060
.linker_nxcompat = linker_nxcompat ,
3047
3061
.linker_dynamicbase = linker_dynamicbase ,
0 commit comments