summaryrefslogtreecommitdiff
path: root/include/llvm/Object/ObjectFile.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Object/ObjectFile.h')
-rw-r--r--include/llvm/Object/ObjectFile.h37
1 files changed, 0 insertions, 37 deletions
diff --git a/include/llvm/Object/ObjectFile.h b/include/llvm/Object/ObjectFile.h
index 157a32b8c6..3533669b8b 100644
--- a/include/llvm/Object/ObjectFile.h
+++ b/include/llvm/Object/ObjectFile.h
@@ -145,7 +145,6 @@ public:
/// Returns the symbol virtual address (i.e. address at which it will be
/// mapped).
error_code getAddress(uint64_t &Result) const;
- error_code getFileOffset(uint64_t &Result) const;
/// @brief Get the alignment of this symbol as the actual value (not log 2).
error_code getAlignment(uint32_t &Result) const;
error_code getSize(uint64_t &Result) const;
@@ -348,42 +347,6 @@ inline error_code SymbolRef::getAddress(uint64_t &Result) const {
return getObject()->getSymbolAddress(getRawDataRefImpl(), Result);
}
-inline error_code SymbolRef::getFileOffset(uint64_t &Result) const {
- uint64_t Address;
- if (error_code EC = getAddress(Address))
- return EC;
- if (Address == UnknownAddressOrSize) {
- Result = UnknownAddressOrSize;
- return object_error::success;
- }
-
- const ObjectFile *Obj = getObject();
- section_iterator SecI(Obj->section_begin());
- if (error_code EC = getSection(SecI))
- return EC;
-
- if (SecI == Obj->section_end()) {
- Result = UnknownAddressOrSize;
- return object_error::success;
- }
-
- uint64_t SectionAddress;
- if (error_code EC = SecI->getAddress(SectionAddress))
- return EC;
-
- uint64_t OffsetInSection = Address - SectionAddress;
-
- StringRef SecContents;
- if (error_code EC = SecI->getContents(SecContents))
- return EC;
-
- // FIXME: this is a hack.
- uint64_t SectionOffset = (uint64_t)SecContents.data() - (uint64_t)Obj->base();
-
- Result = SectionOffset + OffsetInSection;
- return object_error::success;
-}
-
inline error_code SymbolRef::getAlignment(uint32_t &Result) const {
return getObject()->getSymbolAlignment(getRawDataRefImpl(), Result);
}