summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Juan Yescas <jyescas@google.com> 2023-11-09 13:21:54 -0800
committer Juan Yescas <jyescas@google.com> 2023-11-09 13:29:22 -0800
commit3db51d250010c30e0150e1309673af4cef9ed928 (patch)
treec707aaae9f934cd3d5f700254286a7b1ee999363
parent38ec22a8168f7819dafd7026f9dae3d79bc85c16 (diff)
16k: soong: Add linker flag -Wl,-z,max-page-size for x86-84 to align binaries and .so
To simulate 16k page size in x86-64 cuttefish, it is necessary to compile the shared libraries and binaries with max-page-size greater than 4096. Bug: 309816695 Test: source build/envsetup.sh lunch aosp_cf_x86_64_phone_pgagnostic-trunk-userdebug m readelf -l out/target/product/vsoc_x86_64_only/system/bin/toybox Change-Id: I38e4449a7826a2eca0c1a1cccc916af21f0b3a93
-rw-r--r--cc/config/x86_64_device.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/cc/config/x86_64_device.go b/cc/config/x86_64_device.go
index 9f093bb90..ee7d47241 100644
--- a/cc/config/x86_64_device.go
+++ b/cc/config/x86_64_device.go
@@ -33,6 +33,8 @@ var (
"-Wl,--hash-style=gnu",
}
+ X86_64Lldflags = x86_64Ldflags
+
x86_64ArchVariantCflags = map[string][]string{
"": []string{
"-march=x86-64",
@@ -94,7 +96,12 @@ func init() {
exportedVars.ExportStringListStaticVariable("X86_64ToolchainLdflags", []string{"-m64"})
exportedVars.ExportStringListStaticVariable("X86_64Ldflags", x86_64Ldflags)
- exportedVars.ExportStringListStaticVariable("X86_64Lldflags", x86_64Ldflags)
+ exportedVars.ExportStringList("X86_64Lldflags", X86_64Lldflags)
+ pctx.VariableFunc("X86_64Lldflags", func(ctx android.PackageVarContext) string {
+ maxPageSizeFlag := "-Wl,-z,max-page-size=" + ctx.Config().MaxPageSizeSupported()
+ flags := append(X86_64Lldflags, maxPageSizeFlag)
+ return strings.Join(flags, " ")
+ })
// Clang cflags
exportedVars.ExportStringListStaticVariable("X86_64Cflags", x86_64Cflags)