ELFObjectFileBase(unsigned int Type, MemoryBufferRef Source);
virtual uint64_t getSymbolSize(DataRefImpl Symb) const = 0;
+ virtual uint8_t getSymbolOther(DataRefImpl Symb) const = 0;
public:
virtual ErrorOr<int64_t> getRelocationAddend(DataRefImpl Rel) const = 0;
uint64_t getSize() const {
return getObject()->getSymbolSize(getRawDataRefImpl());
}
+
+ uint8_t getOther() const {
+ return getObject()->getSymbolOther(getRawDataRefImpl());
+ }
};
class elf_symbol_iterator : public symbol_iterator {
uint32_t getSymbolAlignment(DataRefImpl Symb) const override;
uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override;
uint32_t getSymbolFlags(DataRefImpl Symb) const override;
- std::error_code getSymbolOther(DataRefImpl Symb, uint8_t &Res) const override;
+ uint8_t getSymbolOther(DataRefImpl Symb) const override;
std::error_code getSymbolType(DataRefImpl Symb,
SymbolRef::Type &Res) const override;
section_iterator getSymbolSection(const Elf_Sym *Symb) const;
}
template <class ELFT>
-std::error_code ELFObjectFile<ELFT>::getSymbolOther(DataRefImpl Symb,
- uint8_t &Result) const {
- Result = toELFSymIter(Symb)->st_other;
- return std::error_code();
+uint8_t ELFObjectFile<ELFT>::getSymbolOther(DataRefImpl Symb) const {
+ return toELFSymIter(Symb)->st_other;
}
template <class ELFT>
uint32_t getAlignment() const;
uint64_t getCommonSize() const;
std::error_code getType(SymbolRef::Type &Result) const;
- std::error_code getOther(uint8_t &Result) const;
/// @brief Get section this symbol is defined in reference to. Result is
/// end_sections() if it is undefined or is an absolute symbol.
SymbolRef::Type &Res) const = 0;
virtual std::error_code getSymbolSection(DataRefImpl Symb,
section_iterator &Res) const = 0;
- virtual std::error_code getSymbolOther(DataRefImpl Symb,
- uint8_t &Res) const {
- return object_error::invalid_file_type;
- }
// Same as above for SectionRef.
friend class SectionRef;
return getObject()->getSymbolType(getRawDataRefImpl(), Result);
}
-inline std::error_code SymbolRef::getOther(uint8_t &Result) const {
- return getObject()->getSymbolOther(getRawDataRefImpl(), Result);
-}
-
inline const ObjectFile *SymbolRef::getObject() const {
const SymbolicFile *O = BasicSymbolRef::getObject();
return cast<ObjectFile>(O);
int64_t Addend = 0;
if (Obj.hasRelocationAddend(RelI->getRawDataRefImpl()))
Addend = *Obj.getRelocationAddend(RelI->getRawDataRefImpl());
- symbol_iterator Symbol = RelI->getSymbol();
+ elf_symbol_iterator Symbol = RelI->getSymbol();
// Obtain the symbol name which is referenced in the relocation
StringRef TargetName;
} else {
// In the ELFv2 ABI, a function symbol may provide a local entry
// point, which must be used for direct calls.
- uint8_t SymOther;
- Symbol->getOther(SymOther);
+ uint8_t SymOther = Symbol->getOther();
Value.Addend += ELF::decodePPC64LocalEntryOffset(SymOther);
}
uint8_t *RelocTarget = Sections[Value.SectionID].Address + Value.Addend;