Add a relocation to ObjectFileELF::ApplyRelocations and a test
Summary: pcm files can end up being processed by lldb with relocations to be made for the .debug_info section. When a R_AARCH64_ABS64 relocation was required lldb would hit an `assert(false)` and die. Add R_AARCH64_ABS64 relocations to the S+A 64 bit width code path. Add a test for R_AARCH64_ABS64 and R_AARCH64_ABS32 .rela.debug_info relocations in a pcm file. Reviewers: sas, xiaobai, davide, javed.absar, espindola Reviewed By: davide Subscribers: labath, zturner, emaste, mgorny, arichardson, kristof.beyls Differential Revision: https://reviews.llvm.org/D51566 llvm-svn: 346171
This commit is contained in:
@@ -2703,6 +2703,7 @@ unsigned ObjectFileELF::ApplyRelocations(
|
||||
}
|
||||
} else {
|
||||
switch (reloc_type(rel)) {
|
||||
case R_AARCH64_ABS64:
|
||||
case R_X86_64_64: {
|
||||
symbol = symtab->FindSymbolByID(reloc_symbol(rel));
|
||||
if (symbol) {
|
||||
@@ -2722,13 +2723,15 @@ unsigned ObjectFileELF::ApplyRelocations(
|
||||
if (symbol) {
|
||||
addr_t value = symbol->GetAddressRef().GetFileAddress();
|
||||
value += ELFRelocation::RelocAddend32(rel);
|
||||
if ((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)) ||
|
||||
(reloc_type(rel) == R_AARCH64_ABS32 && (value <= UINT32_MAX))) {
|
||||
((int64_t)value > INT32_MAX && (int64_t)value < INT32_MIN)) ||
|
||||
(reloc_type(rel) == R_AARCH64_ABS32 &&
|
||||
((int64_t)value > INT32_MAX && (int64_t)value < INT32_MIN))) {
|
||||
Log *log =
|
||||
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES);
|
||||
log->Printf("Failed to apply debug info relocations");
|
||||
break;
|
||||
}
|
||||
uint32_t truncated_addr = (value & 0xFFFFFFFF);
|
||||
DataBufferSP &data_buffer_sp = debug_data.GetSharedDataBuffer();
|
||||
|
||||
Reference in New Issue
Block a user