linker: LoadSegments: Preparatory work for 16KiB App Compat
Introduce should_use_16kib_app_compat_ to ElfReader and pipe it through
to soinfo.
Introduce seg_align and use align_up()/align_down to align the segment
start and end, as it offers more flexiblility than
page_start()/page_end().
Use should_use_16kib_app_compat_ to skip steps that won't be needed in
compatbility mode.
No functional change is introduced in this patch.
Bug: 339709616
Test: atest linker-unit-tests
Change-Id: Ice110c6e2ad54a2ca65e70eb119d9e2b7973a963
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
diff --git a/linker/linker_soinfo.h b/linker/linker_soinfo.h
index 9a13af2..1886f29 100644
--- a/linker/linker_soinfo.h
+++ b/linker/linker_soinfo.h
@@ -369,6 +369,11 @@
}
bool should_pad_segments() const { return should_pad_segments_; }
+ void set_should_use_16kib_app_compat(bool should_use_16kib_app_compat) {
+ should_use_16kib_app_compat_ = should_use_16kib_app_compat;
+ }
+ bool should_use_16kib_app_compat() const { return should_use_16kib_app_compat_; }
+
private:
bool is_image_linked() const;
void set_image_linked();
@@ -455,6 +460,9 @@
// Pad gaps between segments when memory mapping?
bool should_pad_segments_ = false;
+
+ // Use app compat mode when loading 4KiB max-page-size ELFs on 16KiB page-size devices?
+ bool should_use_16kib_app_compat_ = false;
};
// This function is used by dlvsym() to calculate hash of sym_ver