summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitriy Ivanov <dimitry@google.com>2015-04-29 19:34:51 -0700
committerDmitriy Ivanov <dimitry@google.com>2015-04-29 22:10:53 -0700
commit126b5efa9d2fa0956a12a66305d7a4dac7feb4f9 (patch)
treee5f7cfaa56da09ac96cedc189200ea347f2e0f5f
parent0b9e1c6051a6c75bf9040fd1da6109988900d0ac (diff)
downloadbionic-126b5efa9d2fa0956a12a66305d7a4dac7feb4f9.zip
bionic-126b5efa9d2fa0956a12a66305d7a4dac7feb4f9.tar.gz
bionic-126b5efa9d2fa0956a12a66305d7a4dac7feb4f9.tar.bz2
Adjust DT_MIPS_RLD_MAP2 value
DT_MIPS_RLD_MAP2 stores the difference between dynamic entry address and the address of the _r_debug (used by GDB) since the dynamic section and target address are on the different sides of the hole it needs to be adjusted accordingly Bug: http://b/20658994 Bug: http://b/18051137 Change-Id: I4c5e379e8a4c68f029467df6dc660f81a7013a09 (cherry picked from commit 18c935ceabb54a32aff42f99c6d20680ac333157)
-rw-r--r--tools/relocation_packer/src/elf_file.cc10
-rw-r--r--tools/relocation_packer/src/elf_traits.h4
2 files changed, 14 insertions, 0 deletions
diff --git a/tools/relocation_packer/src/elf_file.cc b/tools/relocation_packer/src/elf_file.cc
index 6ac9deb..d06bd63 100644
--- a/tools/relocation_packer/src/elf_file.cc
+++ b/tools/relocation_packer/src/elf_file.cc
@@ -472,6 +472,16 @@ void ElfFile<ELF>::AdjustDynamicSectionForHole(Elf_Scn* dynamic_section,
<< " d_val adjusted to " << dynamic->d_un.d_val;
}
+ // Special case: DT_MIPS_RLD_MAP2 stores the difference between dynamic
+ // entry address and the address of the _r_debug (used by GDB)
+ // since the dynamic section and target address are on the
+ // different sides of the hole it needs to be adjusted accordingly
+ if (tag == DT_MIPS_RLD_MAP2) {
+ dynamic->d_un.d_val += hole_size;
+ VLOG(1) << "dynamic[" << i << "] " << dynamic->d_tag
+ << " d_val adjusted to " << dynamic->d_un.d_val;
+ }
+
// Ignore DT_RELCOUNT and DT_RELACOUNT: (1) nobody uses them and
// technically (2) the relative relocation count is not changed.
diff --git a/tools/relocation_packer/src/elf_traits.h b/tools/relocation_packer/src/elf_traits.h
index 41b06c8..1c938fa 100644
--- a/tools/relocation_packer/src/elf_traits.h
+++ b/tools/relocation_packer/src/elf_traits.h
@@ -10,6 +10,10 @@
#include "elf.h"
#include "libelf.h"
+#if !defined(DT_MIPS_RLD_MAP2)
+#define DT_MIPS_RLD_MAP2 0x70000035
+#endif
+
// ELF is a traits structure used to provide convenient aliases for
// 32/64 bit Elf types and functions, depending on the target file.