Skip to content

Commit b8fba62

Browse files
committed
Add support for 16k pages in library builder
1 parent 1c83e87 commit b8fba62

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/tasks/LibraryBuilder/LibraryBuilder.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,10 @@ private string BuildAndroidLibrary(List<string> sources, List<string> libs, List
337337
buildOptions.CompilerArguments.Add(IsSharedLibrary ? $"-shared -o {libraryName}" : $"-o {libraryName}");
338338
buildOptions.IncludePaths.Add(MonoRuntimeHeaders);
339339
buildOptions.LinkerArguments.Add($"--soname={libraryName}");
340+
341+
// Google requires all the native libraries to be aligned to 16 bytes (for 16k memory page size)
342+
// This is required only for 64-bit binaries, but there's not much harm if it is also done for 32-bit ones.
343+
buildOptions.LinkerArguments.Add($"-z,max-page-size=16384");
340344
buildOptions.LinkerArguments.AddRange(linkerArgs);
341345
buildOptions.NativeLibraryPaths.AddRange(libs);
342346
buildOptions.Sources.AddRange(sources);

0 commit comments

Comments
 (0)