forked from OSchip/llvm-project
Make getOther ELF only.
No other format has this field. llvm-svn: 240774
This commit is contained in:
parent
c5fb508c9d
commit
eef7ffe2e9
|
@ -45,6 +45,7 @@ protected:
|
|||
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;
|
||||
|
@ -77,6 +78,10 @@ public:
|
|||
uint64_t getSize() const {
|
||||
return getObject()->getSymbolSize(getRawDataRefImpl());
|
||||
}
|
||||
|
||||
uint8_t getOther() const {
|
||||
return getObject()->getSymbolOther(getRawDataRefImpl());
|
||||
}
|
||||
};
|
||||
|
||||
class elf_symbol_iterator : public symbol_iterator {
|
||||
|
@ -130,7 +135,7 @@ protected:
|
|||
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;
|
||||
|
@ -380,10 +385,8 @@ uint64_t ELFObjectFile<ELFT>::getCommonSymbolSizeImpl(DataRefImpl 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>
|
||||
|
|
|
@ -151,7 +151,6 @@ public:
|
|||
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.
|
||||
|
@ -215,10 +214,6 @@ protected:
|
|||
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;
|
||||
|
@ -356,10 +351,6 @@ inline std::error_code SymbolRef::getType(SymbolRef::Type &Result) const {
|
|||
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);
|
||||
|
|
|
@ -1066,7 +1066,7 @@ relocation_iterator RuntimeDyldELF::processRelocationRef(
|
|||
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;
|
||||
|
@ -1312,8 +1312,7 @@ relocation_iterator RuntimeDyldELF::processRelocationRef(
|
|||
} 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;
|
||||
|
|
Loading…
Reference in New Issue