diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-04-13 03:11:08 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-04-13 03:11:08 +0000 |
commit | b77944d5ff1cead1d247e73ccfc86fa1b5f9e3f2 (patch) | |
tree | 53d40abae26f29417f5ba93f94b09af506a79cbd /tools/llvm-objdump | |
parent | f4c3a5601aefe2e6500ff4af394196da55203e52 (diff) | |
download | llvm-b77944d5ff1cead1d247e73ccfc86fa1b5f9e3f2.tar.gz llvm-b77944d5ff1cead1d247e73ccfc86fa1b5f9e3f2.tar.bz2 llvm-b77944d5ff1cead1d247e73ccfc86fa1b5f9e3f2.tar.xz |
tools: teach objdump about FILE aux records
Add support for file auxiliary symbol entries in COFF symbol tables. A COFF
symbol table with a FILE entry is followed by sizeof(__FILE__) / 18 auxiliary
symbol records which contain the filename. Read them and form the original
filename that the record contains. Then display the name in the output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206126 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-objdump')
-rw-r--r-- | tools/llvm-objdump/llvm-objdump.cpp | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp index 729fcbaff4..095fdca2dd 100644 --- a/tools/llvm-objdump/llvm-objdump.cpp +++ b/tools/llvm-objdump/llvm-objdump.cpp @@ -669,11 +669,21 @@ static void PrintCOFFSymbolTable(const COFFObjectFile *coff) { const coff_symbol *symbol = 0; for (int i = 0, e = header->NumberOfSymbols; i != e; ++i) { if (aux_count--) { - // Figure out which type of aux this is. - if (symbol->isSectionDefinition()) { // Section definition. + switch (symbol->StorageClass) { + default: outs() << "AUX Unknown\n"; + case COFF::IMAGE_SYM_CLASS_STATIC: + // Section definition. Follows a symbol-table record that defines a + // section. Such a record has a symbol name that is the name of a + // section and has storage class STATIC (3). + if (symbol->Value) { + errs() << "invalid entry in Symbol Table"; + break; + } + const coff_aux_section_definition *asd; if (error(coff->getAuxSymbol<coff_aux_section_definition>(i, asd))) return; + outs() << "AUX " << format("scnlen 0x%x nreloc %d nlnno %d checksum 0x%x " , unsigned(asd->Length) @@ -683,8 +693,20 @@ static void PrintCOFFSymbolTable(const COFFObjectFile *coff) { << format("assoc %d comdat %d\n" , unsigned(asd->Number) , unsigned(asd->Selection)); - } else - outs() << "AUX Unknown\n"; + break; + case COFF::IMAGE_SYM_CLASS_FILE: + SmallString<261> FileName; + for (unsigned AI = i, AE = i + aux_count + 1; AI < AE; ++AI) { + const coff_aux_file *AF; + if (error(coff->getAuxSymbol<coff_aux_file>(AI, AF))) + return; + FileName.append(&AF->FileName[0], &AF->FileName[18]); + } + outs() << "AUX " << FileName << '\n'; + i = i + aux_count; + aux_count = 0; + break; + } } else { StringRef name; if (error(coff->getSymbol(i, symbol))) return; |