Skip to content

Commit

Permalink
Add getOffset to ELFSectionRef
Browse files Browse the repository at this point in the history
Differential revision: https://reviews.llvm.org/D26074

llvm-svn: 285558
  • Loading branch information
eleviant777 committed Oct 31, 2016
1 parent abdcfc1 commit 93d66c1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions llvm/include/llvm/Object/ELFObjectFile.h
Expand Up @@ -59,6 +59,7 @@ class ELFObjectFileBase : public ObjectFile {

virtual uint32_t getSectionType(DataRefImpl Sec) const = 0;
virtual uint64_t getSectionFlags(DataRefImpl Sec) const = 0;
virtual uint64_t getSectionOffset(DataRefImpl Sec) const = 0;

virtual ErrorOr<int64_t> getRelocationAddend(DataRefImpl Rel) const = 0;

Expand Down Expand Up @@ -90,6 +91,10 @@ class ELFSectionRef : public SectionRef {
uint64_t getFlags() const {
return getObject()->getSectionFlags(getRawDataRefImpl());
}

uint64_t getOffset() const {
return getObject()->getSectionOffset(getRawDataRefImpl());
}
};

class elf_section_iterator : public section_iterator {
Expand Down Expand Up @@ -245,6 +250,7 @@ template <class ELFT> class ELFObjectFile : public ELFObjectFileBase {

uint32_t getSectionType(DataRefImpl Sec) const override;
uint64_t getSectionFlags(DataRefImpl Sec) const override;
uint64_t getSectionOffset(DataRefImpl Sec) const override;
StringRef getRelocationTypeName(uint32_t Type) const;

/// \brief Get the relocation section that contains \a Rel.
Expand Down Expand Up @@ -380,6 +386,11 @@ uint32_t ELFObjectFile<ELFT>::getSectionType(DataRefImpl Sec) const {
return getSection(Sec)->sh_type;
}

template <class ELFT>
uint64_t ELFObjectFile<ELFT>::getSectionOffset(DataRefImpl Sec) const {
return getSection(Sec)->sh_offset;
}

template <class ELFT>
uint64_t ELFObjectFile<ELFT>::getSymbolValueImpl(DataRefImpl Symb) const {
const Elf_Sym *ESym = getSymbol(Symb);
Expand Down

0 comments on commit 93d66c1

Please sign in to comment.