retdec
relocation.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_FILEFORMAT_TYPES_RELOCATION_TABLE_RELOCATION_H
8 #define RETDEC_FILEFORMAT_TYPES_RELOCATION_TABLE_RELOCATION_H
9 
10 #include <string>
11 #include <vector>
12 
13 namespace retdec {
14 namespace fileformat {
15 
20 {
21  private:
22  std::string name;
23  unsigned long long address = 0;
24  unsigned long long offsetInSection = 0;
25  unsigned long long linkToSection = 0;
26  unsigned long long linkToSymbol = 0;
27  unsigned long long addend = 0;
28  unsigned long long type = 0;
29  bool linkToSectionIsValid = false;
30  bool linkToSymbolIsValid = false;
31  std::vector<std::uint8_t> mask;
32  public:
35  std::string getName() const;
36  unsigned long long getAddress() const;
37  unsigned long long getSectionOffset() const;
38  bool getLinkToSection(unsigned long long &sectionIndex) const;
39  bool getLinkToSymbol(unsigned long long &symbolIndex) const;
40  unsigned long long getAddend() const;
41  unsigned long long getType() const;
42  std::vector<std::uint8_t> getMask() const;
44 
47  void setName(std::string relocationName);
48  void setAddress(unsigned long long relocationAddress);
49  void setSectionOffset(unsigned long long relocationOffsetInSection);
50  void setLinkToSection(unsigned long long relocationLinkToSection);
51  void setLinkToSymbol(unsigned long long relocationLinkToSymbol);
52  void setAddend(unsigned long long relocationAddend);
53  void setType(unsigned long long relocationType);
54  void setMask(const std::vector<std::uint8_t> &relocationMask);
56 
61  bool hasEmptyName() const;
63 };
64 
65 } // namespace fileformat
66 } // namespace retdec
67 
68 #endif
Definition: relocation.h:20
bool getLinkToSymbol(unsigned long long &symbolIndex) const
Definition: relocation.cpp:63
unsigned long long offsetInSection
offset of relocation in section at which to apply the relocation
Definition: relocation.h:24
void setAddress(unsigned long long relocationAddress)
Definition: relocation.cpp:113
std::vector< std::uint8_t > getMask() const
Definition: relocation.cpp:95
unsigned long long address
address at which to apply the relocation
Definition: relocation.h:23
void setSectionOffset(unsigned long long relocationOffsetInSection)
Definition: relocation.cpp:122
std::string name
relocation name
Definition: relocation.h:22
unsigned long long addend
addend of relocation
Definition: relocation.h:27
bool linkToSectionIsValid
true if link to section is valid
Definition: relocation.h:29
void invalidateLinkToSymbol()
Definition: relocation.cpp:193
void setLinkToSymbol(unsigned long long relocationLinkToSymbol)
Definition: relocation.cpp:141
unsigned long long getAddress() const
Definition: relocation.cpp:25
void invalidateLinkToSection()
Definition: relocation.cpp:181
unsigned long long getType() const
Definition: relocation.cpp:86
std::vector< std::uint8_t > mask
relocation mask
Definition: relocation.h:31
void setType(unsigned long long relocationType)
Definition: relocation.cpp:160
bool linkToSymbolIsValid
true if link to symbol is valid
Definition: relocation.h:30
unsigned long long getAddend() const
Definition: relocation.cpp:77
unsigned long long getSectionOffset() const
Definition: relocation.cpp:34
bool getLinkToSection(unsigned long long &sectionIndex) const
Definition: relocation.cpp:46
unsigned long long type
type of relocation
Definition: relocation.h:28
unsigned long long linkToSection
link to section at which relocation is applied
Definition: relocation.h:25
std::string getName() const
Definition: relocation.cpp:16
unsigned long long linkToSymbol
link to symbol which is used for calculating relocations
Definition: relocation.h:26
void setName(std::string relocationName)
Definition: relocation.cpp:104
void setMask(const std::vector< std::uint8_t > &relocationMask)
Definition: relocation.cpp:169
bool hasEmptyName() const
Definition: relocation.cpp:201
void setAddend(unsigned long long relocationAddend)
Definition: relocation.cpp:151
void setLinkToSection(unsigned long long relocationLinkToSection)
Definition: relocation.cpp:131
Definition: archive_wrapper.h:19