Compile libart.so and libart-compiler.so with 2MB section alignment.
Adds the appropriate linker flags for libart and libart-compiler to have
2MB section alignment. This allows the executable segment of these
libraries to be backed by transparent hugepages on supporting systems.
Bug: 158135888
Test: Verified ELF format
Change-Id: Ia6455418cf1fdd3a1a98d662bf381db4b58b8536
Merged-In: I5cf4483cd19677d13c7495b25a70b4bf11df04fe
diff --git a/build/Android.bp b/build/Android.bp
index 9236074..21858db 100644
--- a/build/Android.bp
+++ b/build/Android.bp
@@ -260,6 +260,19 @@
min_sdk_version: "S",
}
+// Used to generate binaries that can be backed by transparent hugepages.
+cc_defaults {
+ name: "art_hugepage_defaults",
+ arch: {
+ arm64: {
+ ldflags: ["-z max-page-size=0x200000"],
+ },
+ x86_64: {
+ ldflags: ["-z max-page-size=0x200000"],
+ },
+ },
+}
+
cc_defaults {
name: "art_pgo_defaults",
visibility: ["//art:__subpackages__"],
diff --git a/compiler/Android.bp b/compiler/Android.bp
index d1eae50..cb47d77 100644
--- a/compiler/Android.bp
+++ b/compiler/Android.bp
@@ -206,6 +206,7 @@
defaults: [
"libart-compiler-defaults",
"dex2oat-pgo-defaults",
+ "art_hugepage_defaults",
],
codegen: {
arm: {
diff --git a/runtime/Android.bp b/runtime/Android.bp
index 1867894..c85d75a 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -554,6 +554,7 @@
defaults: [
"libart_defaults",
"libart_nativeunwind_defaults",
+ "art_hugepage_defaults",
"art_pgo_defaults",
],
whole_static_libs: [