Bionic: Mark PMD aligned text segments huge page eligible
To take advantage of file-backed huge pages for the text segments of key
shared libraries (go/android-hugepages), the dynamic linker must load
candidate ELF files at an appropriately aligned address and mark
executable segments with MADV_HUGEPAGE.
This patches uses segments' p_align values to determine when a file is
PMD aligned (2MB alignment), and performs load operations accordingly.
Bug: 158135888
Test: Verified PMD aligned libraries are backed with huge pages on
supporting kernel versions.
Change-Id: Ia2367fd5652f663d50103e18f7695c59dc31c7b9
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp
index 0b501a7..2a690e9 100644
--- a/linker/linker_main.cpp
+++ b/linker/linker_main.cpp
@@ -31,9 +31,10 @@
#include <link.h>
#include <sys/auxv.h>
+#include "linker.h"
+#include "linker_cfi.h"
#include "linker_debug.h"
#include "linker_debuggerd.h"
-#include "linker_cfi.h"
#include "linker_gdb_support.h"
#include "linker_globals.h"
#include "linker_phdr.h"