Expose getFlags via ELFSectionRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240779 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2015-06-26 12:44:10 +00:00
parent db7a9f12bc
commit 5add4ddba8
2 changed files with 15 additions and 14 deletions

View File

@ -48,6 +48,7 @@ protected:
virtual uint64_t getSymbolSize(DataRefImpl Symb) const = 0;
virtual uint8_t getSymbolOther(DataRefImpl Symb) const = 0;
virtual uint32_t getSectionType(DataRefImpl Sec) const = 0;
virtual uint64_t getSectionFlags(DataRefImpl Sec) const = 0;
public:
virtual ErrorOr<int64_t> getRelocationAddend(DataRefImpl Rel) const = 0;
@ -59,8 +60,6 @@ public:
typedef iterator_range<elf_symbol_iterator> elf_symbol_iterator_range;
virtual elf_symbol_iterator_range getDynamicSymbolIterators() const = 0;
virtual uint64_t getSectionFlags(SectionRef Sec) const = 0;
elf_symbol_iterator_range symbols() const;
static inline bool classof(const Binary *v) { return v->isELF(); }
@ -79,6 +78,10 @@ public:
uint32_t getType() const {
return getObject()->getSectionType(getRawDataRefImpl());
}
uint64_t getFlags() const {
return getObject()->getSectionFlags(getRawDataRefImpl());
}
};
class ELFSymbolRef : public SymbolRef {
@ -187,6 +190,7 @@ protected:
SmallVectorImpl<char> &Result) const override;
uint32_t getSectionType(DataRefImpl Sec) const override;
uint64_t getSectionFlags(DataRefImpl Sec) const override;
uint64_t getROffset(DataRefImpl Rel) const;
StringRef getRelocationTypeName(uint32_t Type) const;
@ -279,8 +283,6 @@ public:
ErrorOr<int64_t> getRelocationAddend(DataRefImpl Rel) const override;
bool hasRelocationAddend(DataRefImpl Rel) const override;
uint64_t getSectionFlags(SectionRef Sec) const override;
uint8_t getBytesInAddress() const override;
StringRef getFileFormatName() const override;
unsigned getArch() const override;
@ -325,9 +327,8 @@ std::error_code ELFObjectFile<ELFT>::getSymbolName(DataRefImpl Symb,
}
template <class ELFT>
uint64_t ELFObjectFile<ELFT>::getSectionFlags(SectionRef Sec) const {
DataRefImpl DRI = Sec.getRawDataRefImpl();
return toELFShdrIter(DRI)->sh_flags;
uint64_t ELFObjectFile<ELFT>::getSectionFlags(DataRefImpl Sec) const {
return toELFShdrIter(Sec)->sh_flags;
}
template <class ELFT>