diff options
author | Marshall Clow <mclow@qualcomm.com> | 2012-06-15 01:08:25 +0000 |
---|---|---|
committer | Marshall Clow <mclow@qualcomm.com> | 2012-06-15 01:08:25 +0000 |
commit | 71757ef3edd2d315203f4f153c5867afa14da660 (patch) | |
tree | 6578ad0d9df5ad94874c3a9b947272f6a77251db /llvm/lib/Object/COFFObjectFile.cpp | |
parent | 2af2b3071dbb0c608de99e1163338cd5b1e8e497 (diff) | |
download | bcm5719-llvm-71757ef3edd2d315203f4f153c5867afa14da660.tar.gz bcm5719-llvm-71757ef3edd2d315203f4f153c5867afa14da660.zip |
Adding acessors to COFFObjectFile so that clients can get at the (non-generic) bits
llvm-svn: 158484
Diffstat (limited to 'llvm/lib/Object/COFFObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/COFFObjectFile.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp index bd27a56e73b..061cc872de5 100644 --- a/llvm/lib/Object/COFFObjectFile.cpp +++ b/llvm/lib/Object/COFFObjectFile.cpp @@ -622,6 +622,28 @@ error_code COFFObjectFile::getSymbolName(const coff_symbol *symbol, return object_error::success; } +ArrayRef<uint8_t> COFFObjectFile::getSymbolAuxData( + const coff_symbol *symbol) const { + const uint8_t *aux = NULL; + + if ( symbol->NumberOfAuxSymbols > 0 ) { + // AUX data comes immediately after the symbol in COFF + aux = reinterpret_cast<const uint8_t *>(symbol + 1); +# ifndef NDEBUG + // Verify that the aux symbol points to a valid entry in the symbol table. + uintptr_t offset = uintptr_t(aux) - uintptr_t(base()); + if (offset < Header->PointerToSymbolTable + || offset >= Header->PointerToSymbolTable + + (Header->NumberOfSymbols * sizeof(coff_symbol))) + report_fatal_error("Aux Symbol data was outside of symbol table."); + + assert((offset - Header->PointerToSymbolTable) % sizeof(coff_symbol) + == 0 && "Aux Symbol data did not point to the beginning of a symbol"); + } +# endif + return ArrayRef<uint8_t>(aux, symbol->NumberOfAuxSymbols * sizeof(coff_symbol)); +} + error_code COFFObjectFile::getSectionName(const coff_section *Sec, StringRef &Res) const { StringRef Name; @@ -694,6 +716,15 @@ error_code COFFObjectFile::getRelocationType(DataRefImpl Rel, return object_error::success; } +const coff_section *COFFObjectFile::getCOFFSection(section_iterator &It) const { + return toSec(It->getRawDataRefImpl()); +} + +const coff_symbol *COFFObjectFile::getCOFFSymbol(symbol_iterator &It) const { + return toSymb(It->getRawDataRefImpl()); +} + + #define LLVM_COFF_SWITCH_RELOC_TYPE_NAME(enum) \ case COFF::enum: res = #enum; break; |