bionic: Introduce ElfReader::ReadPadSegmentNote()

ReadPadSegmentNote() finds the elf note of type
NT_ANDROID_TYPE_PAD_SEGMENT and checks that the desc value
is 1, to decided whether the LOAD segment mappings should
be extended (padded) to avoid gaps.

Cache the result of this operation in ElfReader and soinfo
for use in the subsequent patch which handles the extension
of the segment mappings.

Test: atest -c linker-unit-tests [Later patch]
Test: m && launch_cvd
Bug: 316403210
Change-Id: I32c05cce741d221c3f92835ea09d932c40bdf8b1
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
diff --git a/linker/linker_soinfo.h b/linker/linker_soinfo.h
index 622719d..a5d31d5 100644
--- a/linker/linker_soinfo.h
+++ b/linker/linker_soinfo.h
@@ -364,6 +364,11 @@
   bool memtag_heap() const { return memtag_dynamic_entries()->memtag_heap; }
   bool memtag_stack() const { return memtag_dynamic_entries()->memtag_stack; }
 
+  void set_should_pad_segments(bool should_pad_segments) {
+   should_pad_segments_ = should_pad_segments;
+  }
+  bool should_pad_segments() const { return should_pad_segments_; }
+
  private:
   bool is_image_linked() const;
   void set_image_linked();
@@ -449,6 +454,9 @@
 
   // version >= 7
   memtag_dynamic_entries_t memtag_dynamic_entries_;
+
+  // Pad gaps between segments when memory mapping?
+  bool should_pad_segments_ = false;
 };
 
 // This function is used by dlvsym() to calculate hash of sym_ver