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
diff --git a/build/Android.bp b/build/Android.bp
index c3f71f3..8a54194 100644
--- a/build/Android.bp
+++ b/build/Android.bp
@@ -234,6 +234,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__"],