aboutsummaryrefslogtreecommitdiff
path: root/src/common/linux/dump_symbols.cc
diff options
context:
space:
mode:
authorrmcilroy@chromium.org <rmcilroy@chromium.org>2015-06-19 16:30:42 +0000
committerrmcilroy@chromium.org <rmcilroy@chromium.org>2015-06-19 16:30:42 +0000
commit8785c0cb8fc1ccfb20c143026c5fbb8361354c09 (patch)
treec928423f412adfc0c186dbeb9ce9a742102f305d /src/common/linux/dump_symbols.cc
parentupdate more ignore files (diff)
downloadbreakpad-8785c0cb8fc1ccfb20c143026c5fbb8361354c09.tar.xz
Update breakpad for Android packed relocations.
Shared libraries containing Android packed relocations have a load bias that differs from the start address in /proc/$$/maps. Current breakpad assumes that the load bias and mapping start address are the same. Fixed by changing the client to detect the presence of Android packed relocations in the address space of a loaded library, and adjusting the stored mapping start address of any that are packed so that it contains the linker's load bias. For this to work properly, it is important that the non-packed library is symbolized for breakpad. Either packed or non-packed libraries may be run on the device; the client detects which has been loaded by the linker. BUG=499747 R=primiano@chromium.org, rmcilroy@chromium.org Review URL: https://codereview.chromium.org/1189823002. Patch from Simon Baldwin <simonb@chromium.org>. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1459 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/linux/dump_symbols.cc')
-rw-r--r--src/common/linux/dump_symbols.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc
index 0bcc18ab..1e96ca6a 100644
--- a/src/common/linux/dump_symbols.cc
+++ b/src/common/linux/dump_symbols.cc
@@ -95,6 +95,15 @@ using google_breakpad::scoped_ptr;
#define EM_AARCH64 183
#endif
+// Define SHT_ANDROID_REL and SHT_ANDROID_RELA if not defined by the host.
+// Sections with this type contain Android packed relocations.
+#ifndef SHT_ANDROID_REL
+#define SHT_ANDROID_REL (SHT_LOOS + 1)
+#endif
+#ifndef SHT_ANDROID_RELA
+#define SHT_ANDROID_RELA (SHT_LOOS + 2)
+#endif
+
//
// FDWrapper
//
@@ -611,6 +620,28 @@ bool LoadSymbols(const string& obj_file,
bool found_debug_info_section = false;
bool found_usable_info = false;
+ // Reject files that contain Android packed relocations. The pre-packed
+ // version of the file should be symbolized; the packed version is only
+ // intended for use on the target system.
+ if (FindElfSectionByName<ElfClass>(".rel.dyn", SHT_ANDROID_REL,
+ sections, names,
+ names_end, elf_header->e_shnum)) {
+ fprintf(stderr, "%s: file contains a \".rel.dyn\" section "
+ "with type SHT_ANDROID_REL\n", obj_file.c_str());
+ fprintf(stderr, "Files containing Android packed relocations "
+ "may not be symbolized.\n");
+ return false;
+ }
+ if (FindElfSectionByName<ElfClass>(".rela.dyn", SHT_ANDROID_RELA,
+ sections, names,
+ names_end, elf_header->e_shnum)) {
+ fprintf(stderr, "%s: file contains a \".rela.dyn\" section "
+ "with type SHT_ANDROID_RELA\n", obj_file.c_str());
+ fprintf(stderr, "Files containing Android packed relocations "
+ "may not be symbolized.\n");
+ return false;
+ }
+
if (options.symbol_data != ONLY_CFI) {
#ifndef NO_STABS_SUPPORT
// Look for STABS debugging information, and load it if present.