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.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/llvm/Object/ObjectFile.h b/include/llvm/Object/ObjectFile.h
index fa21417027..8298b63420 100644
--- a/include/llvm/Object/ObjectFile.h
+++ b/include/llvm/Object/ObjectFile.h
@@ -354,12 +354,21 @@ 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;