diff options
author | Nathan Lanza <nathan@lanza.io> | 2018-11-05 22:18:00 +0000 |
---|---|---|
committer | Nathan Lanza <nathan@lanza.io> | 2018-11-05 22:18:00 +0000 |
commit | 6868d2dd65d48e6e15dbfe99dc8b5fcbd042fd8f (patch) | |
tree | 3258229e59a12243bbdfd939a5478760870dc583 /lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | |
parent | def82a81af9c9df711a80f3f166623aafe37d4c8 (diff) | |
download | bcm5719-llvm-6868d2dd65d48e6e15dbfe99dc8b5fcbd042fd8f.tar.gz bcm5719-llvm-6868d2dd65d48e6e15dbfe99dc8b5fcbd042fd8f.zip |
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
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index ba8216527f3..fd1edcd6a64 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -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(); |