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 | 321731539e9fd4b20a69c7e14a42ccc694476b14 (patch) | |
tree | c4f872ecaa8f0de6787b5b6000dc1e5be3334744 /llvm/lib/Object/COFFObjectFile.cpp | |
parent | 017597540e645ee69b336802d30c0e52f8a575d9 (diff) | |
download | bcm5719-llvm-321731539e9fd4b20a69c7e14a42ccc694476b14.tar.gz bcm5719-llvm-321731539e9fd4b20a69c7e14a42ccc694476b14.zip |
Object: Add isSymbolAbsolute and getSymbolSection.
llvm-svn: 142317
Diffstat (limited to 'llvm/lib/Object/COFFObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/COFFObjectFile.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp index 0859bca40ad..13356520d7b 100644 --- a/llvm/lib/Object/COFFObjectFile.cpp +++ b/llvm/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); |