1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
llvm-mirror/lib/Object
Fangrui Song 72e7abe0f8 [DWARF] Refactor RelocVisitor and fix computation of SHT_RELA-typed relocation entries
Summary:
getRelocatedValue may compute incorrect value for SHT_RELA-typed relocation entries.

// DWARFDataExtractor.cpp
uint64_t DWARFDataExtractor::getRelocatedValue(uint32_t Size, uint32_t *Off,
...
  // This formula is correct for REL, but may be incorrect for RELA if the value
  // stored in the location (getUnsigned(Off, Size)) is not zero.
  return getUnsigned(Off, Size) + Rel->Value;

In this patch, we

* refactor these visit* functions to include a new parameter `uint64_t A`.
  Since these visit* functions are no longer used as visitors, rename them to resolve*.
  + REL: A is used as the addend. A is the value stored in the location where the
    relocation applies: getUnsigned(Off, Size)
  + RELA: The addend encoded in RelocationRef is used, e.g. getELFAddend(R)
* and add another set of supports* functions to check if a given relocation type is handled.
  DWARFObjInMemory uses them to fail early.

Reviewers: echristo, dblaikie

Reviewed By: echristo

Subscribers: mgorny, aprantl, aheejin, fedor.sergeev, llvm-commits

Tags: #llvm

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

llvm-svn: 356729
2019-03-22 02:43:11 +00:00
..
Archive.cpp [libObject][NFC] Include filename in error message 2019-02-06 20:51:04 +00:00
ArchiveWriter.cpp [libObject][NFC] Use sys::path::convert_to_slash. 2019-02-19 18:14:44 +00:00
Binary.cpp [Object] Add basic minidump support 2019-03-21 09:18:59 +00:00
CMakeLists.txt [DWARF] Refactor RelocVisitor and fix computation of SHT_RELA-typed relocation entries 2019-03-22 02:43:11 +00:00
COFFImportFile.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
COFFModuleDefinition.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
COFFObjectFile.cpp [COFF] Add new relocation types. 2019-01-27 19:53:36 +00:00
Decompressor.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ELF.cpp [ELF] Fix GCC8 warnings about "fall through", NFCI 2019-03-13 10:38:17 +00:00
ELFObjectFile.cpp Improve "llvm-nm -f sysv" output for Elf files 2019-03-08 22:00:50 +00:00
Error.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
IRObjectFile.cpp [Object] Fix reading objects created with -fembed-bitcode-marker 2019-03-21 21:01:31 +00:00
IRSymtab.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MachOObjectFile.cpp Fix Mach-O bind and rebase validation errors in libObject 2019-03-20 23:21:16 +00:00
MachOUniversal.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Minidump.cpp [Object] Add basic minidump support 2019-03-21 09:18:59 +00:00
ModuleSymbolTable.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Object.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ObjectFile.cpp [Object] Add basic minidump support 2019-03-21 09:18:59 +00:00
RecordStreamer.cpp [AsmPrinter] Remove hidden flag -print-schedule. 2019-02-04 12:51:26 +00:00
RecordStreamer.h [AsmPrinter] Remove hidden flag -print-schedule. 2019-02-04 12:51:26 +00:00
RelocationResolver.cpp [DWARF] Refactor RelocVisitor and fix computation of SHT_RELA-typed relocation entries 2019-03-22 02:43:11 +00:00
SymbolicFile.cpp [Object] Add basic minidump support 2019-03-21 09:18:59 +00:00
SymbolSize.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
WasmObjectFile.cpp [WebAssembly] Target features section 2019-03-20 20:26:45 +00:00
WindowsResource.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00