aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/MachOObjectFile.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-06-24 19:57:32 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-06-24 19:57:32 +0000
commit6bf322101bebac03b63fb068fcd3158f795bcee3 (patch)
treeb9ffab2e507529dc20e5e3dae22cd40f11e2ed0e /llvm/lib/Object/MachOObjectFile.cpp
parent54565cf02b2f40d34605b8e74f886419829ac396 (diff)
downloadllvm-6bf322101bebac03b63fb068fcd3158f795bcee3.zip
llvm-6bf322101bebac03b63fb068fcd3158f795bcee3.tar.gz
llvm-6bf322101bebac03b63fb068fcd3158f795bcee3.tar.bz2
Make computeSymbolSizes never fail.
On ELF that was already the case since getting the size of a symbol never fails. On MachO and COFF we could fail trying to get the section of a symbol. But we don't really need the section, just the section number to know if two symbols are in the same section or not. llvm-svn: 240580
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
-rw-r--r--llvm/lib/Object/MachOObjectFile.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index cb98f05..62a0d60 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -483,6 +483,12 @@ std::error_code MachOObjectFile::getSymbolSection(DataRefImpl Symb,
return std::error_code();
}
+unsigned MachOObjectFile::getSymbolSectionID(SymbolRef Sym) const {
+ MachO::nlist_base Entry =
+ getSymbolTableEntryBase(this, Sym.getRawDataRefImpl());
+ return Entry.n_sect - 1;
+}
+
void MachOObjectFile::moveSectionNext(DataRefImpl &Sec) const {
Sec.d.a++;
}
@@ -559,6 +565,10 @@ bool MachOObjectFile::isSectionBSS(DataRefImpl Sec) const {
SectionType == MachO::S_GB_ZEROFILL);
}
+unsigned MachOObjectFile::getSectionID(SectionRef Sec) const {
+ return Sec.getRawDataRefImpl().d.a;
+}
+
bool MachOObjectFile::isSectionVirtual(DataRefImpl Sec) const {
// FIXME: Unimplemented.
return false;