Handle when bias is different in elf headers.

The original code assumed that the load bias in the program headers
would be exactly the same as in eh_frame/eh_frame_hdr/debug_frame.

This isn't guaranteed, so add a section bias for use when creating
a DwarfSection. In addtion, make the load bias and section bias
a signed value. There is no reason that this value needs to be positive,
so don't force it to be.

Add a new offline test that has a different load bias in eh_frame than
in the executable load.

Add additional unit tests to verify the load bias values are set properly.

Clean up the tests in ElfInterfaceTest, making all tests names follow the
same convention.

Bug: 141888859
Bug: 142094469

Test: New units and old unit tests pass on host and taimen.
Change-Id: Ib878123ab5545f0f315c749cfe0d27b012d873ee
diff --git a/libunwindstack/Elf.cpp b/libunwindstack/Elf.cpp
index 3454913..c141b2e 100644
--- a/libunwindstack/Elf.cpp
+++ b/libunwindstack/Elf.cpp
@@ -53,7 +53,7 @@
 
   valid_ = interface_->Init(&load_bias_);
   if (valid_) {
-    interface_->InitHeaders(load_bias_);
+    interface_->InitHeaders();
     InitGnuDebugdata();
   } else {
     interface_.reset(nullptr);
@@ -77,9 +77,9 @@
 
   // Ignore the load_bias from the compressed section, the correct load bias
   // is in the uncompressed data.
-  uint64_t load_bias;
+  int64_t load_bias;
   if (gnu->Init(&load_bias)) {
-    gnu->InitHeaders(load_bias);
+    gnu->InitHeaders();
     interface_->SetGnuDebugdataInterface(gnu);
   } else {
     // Free all of the memory associated with the gnu_debugdata section.
@@ -124,7 +124,7 @@
   }
 
   // Adjust by the load bias.
-  if (*memory_address < load_bias_) {
+  if (load_bias_ > 0 && *memory_address < static_cast<uint64_t>(load_bias_)) {
     return false;
   }
 
@@ -229,7 +229,7 @@
 }
 
 bool Elf::IsValidPc(uint64_t pc) {
-  if (!valid_ || pc < load_bias_) {
+  if (!valid_ || (load_bias_ > 0 && pc < static_cast<uint64_t>(load_bias_))) {
     return false;
   }
 
@@ -299,7 +299,7 @@
   return interface.release();
 }
 
-uint64_t Elf::GetLoadBias(Memory* memory) {
+int64_t Elf::GetLoadBias(Memory* memory) {
   if (!IsValidElf(memory)) {
     return 0;
   }