Use .long for pointers on 32-bit platforms

Placing a 32-bit pointer directly into a .quad results in either an
unsupported relocation error at link time (ARM) or an inability to
load the executable (x86).

Also, only attempt to read a module's CrashpadInfo if an info address
note was found.


Change-Id: I053af3d77eed70af66248be88547656d2b29878a
Reviewed-on: https://chromium-review.googlesource.com/922397
Reviewed-by: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Joshua Peraza 2018-02-15 11:45:36 -08:00 committed by Commit Bot
parent 4094c2628d
commit a4d7fb4cc3
2 changed files with 17 additions and 6 deletions

View File

@ -16,6 +16,7 @@
// of finding the instance of CrashpadInfo g_crashpad_info without requiring
// that symbol to be in the dynamic symbol table.
#include "build/build_config.h"
#include "util/misc/elf_note_types.h"
// namespace crashpad {
@ -41,6 +42,16 @@ name:
name_end:
.balign NOTE_ALIGN
desc:
#if defined(ARCH_CPU_64_BITS)
.quad CRASHPAD_INFO_SYMBOL
#else
#if defined(ARCH_CPU_LITTLE_ENDIAN)
.long CRASHPAD_INFO_SYMBOL
.long 0
#else
.long 0
.long CRASHPAD_INFO_SYMBOL
#endif // ARCH_CPU_LITTLE_ENDIAN
#endif // ARCH_CPU_64_BITS
desc_end:
.size CRASHPAD_NOTE_REFERENCE, .-CRASHPAD_NOTE_REFERENCE

View File

@ -58,13 +58,13 @@ bool ModuleSnapshotLinux::Initialize(
if (notes->NextNote(nullptr, nullptr, &desc) ==
ElfImageReader::NoteReader::Result::kSuccess) {
info_address = *reinterpret_cast<VMAddress*>(&desc[0]);
}
ProcessMemoryRange range;
if (range.Initialize(*elf_reader_->Memory())) {
auto info = std::make_unique<CrashpadInfoReader>();
if (info->Initialize(&range, info_address)) {
crashpad_info_ = std::move(info);
ProcessMemoryRange range;
if (range.Initialize(*elf_reader_->Memory())) {
auto info = std::make_unique<CrashpadInfoReader>();
if (info->Initialize(&range, info_address)) {
crashpad_info_ = std::move(info);
}
}
}