summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Leviant <evgeny.leviant@gmail.com>2016-10-31 11:03:01 +0000
committerEugene Leviant <evgeny.leviant@gmail.com>2016-10-31 11:03:01 +0000
commit93d66c18c9649a09cc42b3cd2923f2d6505f516b (patch)
treee1397888b7ab5c82fb0c796774606780f92b1afe
parentabdcfc18090f93a55bb35048b435028319599180 (diff)
downloadbcm5719-llvm-93d66c18c9649a09cc42b3cd2923f2d6505f516b.tar.gz
bcm5719-llvm-93d66c18c9649a09cc42b3cd2923f2d6505f516b.zip
Add getOffset to ELFSectionRef
Differential revision: https://reviews.llvm.org/D26074 llvm-svn: 285558
-rw-r--r--llvm/include/llvm/Object/ELFObjectFile.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/include/llvm/Object/ELFObjectFile.h b/llvm/include/llvm/Object/ELFObjectFile.h
index a023d5b3295..93b84a8d069 100644
--- a/llvm/include/llvm/Object/ELFObjectFile.h
+++ b/llvm/include/llvm/Object/ELFObjectFile.h
@@ -59,6 +59,7 @@ protected:
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;
@@ -90,6 +91,10 @@ public:
uint64_t getFlags() const {
return getObject()->getSectionFlags(getRawDataRefImpl());
}
+
+ uint64_t getOffset() const {
+ return getObject()->getSectionOffset(getRawDataRefImpl());
+ }
};
class elf_section_iterator : public section_iterator {
@@ -245,6 +250,7 @@ protected:
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.
@@ -381,6 +387,11 @@ uint32_t ELFObjectFile<ELFT>::getSectionType(DataRefImpl Sec) const {
}
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);
uint64_t Ret = ESym->st_value;
OpenPOWER on IntegriCloud