aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/COFFObjectFile.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-04-02 22:52:46 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-04-02 22:52:46 +0000
commitaf9129468e4ac0ea5b2f17564b27a20485ba9484 (patch)
treec50425c9dba56e7cca31032ac7b6713afdb3c916 /llvm/lib/Object/COFFObjectFile.cpp
parent4da0a0c87b1c36ad7c59537240b885c8da683378 (diff)
downloadllvm-af9129468e4ac0ea5b2f17564b27a20485ba9484.zip
llvm-af9129468e4ac0ea5b2f17564b27a20485ba9484.tar.gz
llvm-af9129468e4ac0ea5b2f17564b27a20485ba9484.tar.bz2
Fix a nomenclature error in llvm-nm.
What llvm-nm prints depends on the file format. On ELF for example, if the file is relocatable, it prints offsets. If it is not, it prints addresses. Since it doesn't really need to care what it is that it is printing, use the generic term value. Fix or implement getSymbolValue to keep llvm-nm working. llvm-svn: 205479
Diffstat (limited to 'llvm/lib/Object/COFFObjectFile.cpp')
-rw-r--r--llvm/lib/Object/COFFObjectFile.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp
index 43913e4..2784f5c 100644
--- a/llvm/lib/Object/COFFObjectFile.cpp
+++ b/llvm/lib/Object/COFFObjectFile.cpp
@@ -253,8 +253,15 @@ error_code COFFObjectFile::getSymbolSection(DataRefImpl Ref,
}
error_code COFFObjectFile::getSymbolValue(DataRefImpl Ref,
- uint64_t &Val) const {
- report_fatal_error("getSymbolValue unimplemented in COFFObjectFile");
+ uint64_t &Result) const {
+ const coff_symbol *Symb = toSymb(Ref);
+
+ if (Symb->SectionNumber == COFF::IMAGE_SYM_UNDEFINED)
+ Result = UnknownAddressOrSize;
+ else
+ Result = Symb->Value;
+
+ return object_error::success;
}
void COFFObjectFile::moveSectionNext(DataRefImpl &Ref) const {