Skip to content

Commit

Permalink
Add a relocation for R_AARCH64_ABS32 in ObjectFileELF
Browse files Browse the repository at this point in the history
Summary:
.rela.debug_info relocations are being done via
ObjectFileELF::ApplyRelocations for aarch64. Currently, the switch case
that iterates over the relocation type is only implemented for a few
different types and `assert(false)`es over the rest.

Implement the relocation for R_AARCH64_ABS32 in ApplyRelocations

Reviewers: sas, xiaobai, javed.absar, espindola

Reviewed By: sas

Subscribers: emaste, arichardson, kristof.beyls

Differential Revision: https://reviews.llvm.org/D50369

Change by Nathan Lanza <lanza@fb.com>

llvm-svn: 339974
  • Loading branch information
sas committed Aug 17, 2018
1 parent 0094d31 commit 9e2fe8b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2697,15 +2697,20 @@ unsigned ObjectFileELF::ApplyRelocations(
break;
}
case R_X86_64_32:
case R_X86_64_32S: {
case R_X86_64_32S:
case R_AARCH64_ABS32: {
symbol = symtab->FindSymbolByID(reloc_symbol(rel));
if (symbol) {
addr_t value = symbol->GetAddressRef().GetFileAddress();
value += ELFRelocation::RelocAddend32(rel);
assert(
(reloc_type(rel) == R_X86_64_32 && (value <= UINT32_MAX)) ||
if ((reloc_type(rel) == R_X86_64_32 && (value <= UINT32_MAX)) ||
(reloc_type(rel) == R_X86_64_32S &&
((int64_t)value <= INT32_MAX && (int64_t)value >= INT32_MIN)));
((int64_t)value <= INT32_MAX && (int64_t)value >= INT32_MIN)) ||
(reloc_type(rel) == R_AARCH64_ABS32 && (value <= UINT32_MAX))) {
Log *log =
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES);
log->Printf("Failed to apply debug info relocations");
}
uint32_t truncated_addr = (value & 0xFFFFFFFF);
DataBufferSP &data_buffer_sp = debug_data.GetSharedDataBuffer();
uint32_t *dst = reinterpret_cast<uint32_t *>(
Expand Down

0 comments on commit 9e2fe8b

Please sign in to comment.