[PATCH] D55691: [Object] Rename getRelrRelocationType to getRelativeRelocationType
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 13 22:07:33 PST 2018
MaskRay created this revision.
MaskRay added reviewers: phosek, dberris.
Herald added a subscriber: llvm-commits.
The two utility functions were added in D47919 <https://reviews.llvm.org/D47919> to support SHT_RELR.
However, these are just relative relocations types and are't
necessarily be named Relr.
Repository:
rL LLVM
https://reviews.llvm.org/D55691
Files:
include/llvm/Object/ELF.h
lib/Object/ELF.cpp
lib/XRay/InstrumentationMap.cpp
Index: lib/XRay/InstrumentationMap.cpp
===================================================================
--- lib/XRay/InstrumentationMap.cpp
+++ lib/XRay/InstrumentationMap.cpp
@@ -87,13 +87,13 @@
if (ObjFile.getBinary()->isELF()) {
uint32_t RelrRelocationType = [](object::ObjectFile *ObjFile) {
if (const auto *ELFObj = dyn_cast<object::ELF32LEObjectFile>(ObjFile))
- return ELFObj->getELFFile()->getRelrRelocationType();
+ return ELFObj->getELFFile()->getRelativeRelocationType();
else if (const auto *ELFObj = dyn_cast<object::ELF32BEObjectFile>(ObjFile))
- return ELFObj->getELFFile()->getRelrRelocationType();
+ return ELFObj->getELFFile()->getRelativeRelocationType();
else if (const auto *ELFObj = dyn_cast<object::ELF64LEObjectFile>(ObjFile))
- return ELFObj->getELFFile()->getRelrRelocationType();
+ return ELFObj->getELFFile()->getRelativeRelocationType();
else if (const auto *ELFObj = dyn_cast<object::ELF64BEObjectFile>(ObjFile))
- return ELFObj->getELFFile()->getRelrRelocationType();
+ return ELFObj->getELFFile()->getRelativeRelocationType();
else
return static_cast<uint32_t>(0);
}(ObjFile.getBinary());
Index: lib/Object/ELF.cpp
===================================================================
--- lib/Object/ELF.cpp
+++ lib/Object/ELF.cpp
@@ -154,7 +154,7 @@
#undef ELF_RELOC
-uint32_t llvm::object::getELFRelrRelocationType(uint32_t Machine) {
+uint32_t llvm::object::getELFRelativeRelocationType(uint32_t Machine) {
switch (Machine) {
case ELF::EM_X86_64:
return ELF::R_X86_64_RELATIVE;
@@ -300,7 +300,7 @@
Elf_Rela Rela;
Rela.r_info = 0;
Rela.r_addend = 0;
- Rela.setType(getRelrRelocationType(), false);
+ Rela.setType(getRelativeRelocationType(), false);
std::vector<Elf_Rela> Relocs;
// Word type: uint32_t for Elf32, and uint64_t for Elf64.
Index: include/llvm/Object/ELF.h
===================================================================
--- include/llvm/Object/ELF.h
+++ include/llvm/Object/ELF.h
@@ -32,7 +32,7 @@
namespace object {
StringRef getELFRelocationTypeName(uint32_t Machine, uint32_t Type);
-uint32_t getELFRelrRelocationType(uint32_t Machine);
+uint32_t getELFRelativeRelocationType(uint32_t Machine);
StringRef getELFSectionTypeName(uint32_t Machine, uint32_t Type);
// Subclasses of ELFFile may need this for template instantiation
@@ -113,7 +113,7 @@
StringRef getRelocationTypeName(uint32_t Type) const;
void getRelocationTypeName(uint32_t Type,
SmallVectorImpl<char> &Result) const;
- uint32_t getRelrRelocationType() const;
+ uint32_t getRelativeRelocationType() const;
const char *getDynamicTagAsString(unsigned Arch, uint64_t Type) const;
const char *getDynamicTagAsString(uint64_t Type) const;
@@ -415,8 +415,8 @@
}
template <class ELFT>
-uint32_t ELFFile<ELFT>::getRelrRelocationType() const {
- return getELFRelrRelocationType(getHeader()->e_machine);
+uint32_t ELFFile<ELFT>::getRelativeRelocationType() const {
+ return getELFRelativeRelocationType(getHeader()->e_machine);
}
template <class ELFT>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55691.178180.patch
Type: text/x-patch
Size: 3173 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181214/65433bba/attachment.bin>
More information about the llvm-commits
mailing list