diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2011-10-17 23:54:46 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2011-10-17 23:54:46 +0000 |
commit | 9b2b812fea4df160437e7b7d56e38f6335189ad0 (patch) | |
tree | aa3bfb402beebb9c71d8a7a64fb253eccdf0a8ac /lib/Object/COFFObjectFile.cpp | |
parent | c38c36a8c44bd32bdfc2e48ab3e447f6dc1547bd (diff) | |
download | external_llvm-9b2b812fea4df160437e7b7d56e38f6335189ad0.tar.gz external_llvm-9b2b812fea4df160437e7b7d56e38f6335189ad0.tar.bz2 external_llvm-9b2b812fea4df160437e7b7d56e38f6335189ad0.zip |
Object: Add isSymbolAbsolute and getSymbolSection.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142317 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Object/COFFObjectFile.cpp')
-rw-r--r-- | lib/Object/COFFObjectFile.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/Object/COFFObjectFile.cpp b/lib/Object/COFFObjectFile.cpp index 0859bca40a..13356520d7 100644 --- a/lib/Object/COFFObjectFile.cpp +++ b/lib/Object/COFFObjectFile.cpp @@ -268,6 +268,28 @@ error_code COFFObjectFile::isSymbolInternal(DataRefImpl Symb, return object_error::success; } +error_code COFFObjectFile::isSymbolAbsolute(DataRefImpl Symb, + bool &Result) const { + const coff_symbol *symb = toSymb(Symb); + Result = symb->SectionNumber == COFF::IMAGE_SYM_ABSOLUTE; + return object_error::success; +} + +error_code COFFObjectFile::getSymbolSection(DataRefImpl Symb, + section_iterator &Result) const { + const coff_symbol *symb = toSymb(Symb); + if (symb->SectionNumber <= COFF::IMAGE_SYM_UNDEFINED) + Result = end_sections(); + else { + const coff_section *sec; + if (error_code ec = getSection(symb->SectionNumber, sec)) return ec; + DataRefImpl Sec; + Sec.p = reinterpret_cast<uintptr_t>(sec); + Result = section_iterator(SectionRef(Sec, this)); + } + return object_error::success; +} + error_code COFFObjectFile::getSectionNext(DataRefImpl Sec, SectionRef &Result) const { const coff_section *sec = toSec(Sec); |