summaryrefslogtreecommitdiff
path: root/tools/llvm-readobj
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-03-19 04:47:47 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-03-19 04:47:47 +0000
commit6d191534f63b0ece222e2d6e418144b123c81c0c (patch)
tree72a8ca1b42f1f5c47cdeff5a5593c7b2ffcc8d58 /tools/llvm-readobj
parent92c5a193e0d17f4b70f507ff976aac6a44962041 (diff)
Object: Provide a richer means of describing auxiliary symbols
The current state of affairs has auxiliary symbols described as a big bag of bytes. This is less than satisfying, it detracts from the YAML file as being human readable. Instead, allow for symbols to optionally contain their auxiliary data. This allows us to have a much higher level way of describing things like weak symbols, function definitions and section definitions. This depends on D3105. Differential Revision: http://llvm-reviews.chandlerc.com/D3092 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204214 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-readobj')
-rw-r--r--tools/llvm-readobj/COFFDumper.cpp23
1 files changed, 5 insertions, 18 deletions
diff --git a/tools/llvm-readobj/COFFDumper.cpp b/tools/llvm-readobj/COFFDumper.cpp
index d2275f0aab8..cd40da7d6cc 100644
--- a/tools/llvm-readobj/COFFDumper.cpp
+++ b/tools/llvm-readobj/COFFDumper.cpp
@@ -946,12 +946,7 @@ void COFFDumper::printSymbol(const SymbolRef &Sym) {
W.printNumber("AuxSymbolCount", Symbol->NumberOfAuxSymbols);
for (unsigned I = 0; I < Symbol->NumberOfAuxSymbols; ++I) {
- if (Symbol->StorageClass == COFF::IMAGE_SYM_CLASS_EXTERNAL &&
- Symbol->getBaseType() == COFF::IMAGE_SYM_TYPE_NULL &&
- Symbol->getComplexType() == COFF::IMAGE_SYM_DTYPE_FUNCTION &&
- Symbol->SectionNumber != COFF::IMAGE_SYM_DEBUG &&
- Symbol->SectionNumber != COFF::IMAGE_SYM_ABSOLUTE &&
- Symbol->SectionNumber != COFF::IMAGE_SYM_UNDEFINED) {
+ if (Symbol->isFunctionDefinition()) {
const coff_aux_function_definition *Aux;
if (error(getSymbolAuxData(Obj, Symbol + I, Aux)))
break;
@@ -963,11 +958,7 @@ void COFFDumper::printSymbol(const SymbolRef &Sym) {
W.printHex("PointerToNextFunction", Aux->PointerToNextFunction);
W.printBinary("Unused", makeArrayRef(Aux->Unused));
- } else if (
- Symbol->StorageClass == COFF::IMAGE_SYM_CLASS_WEAK_EXTERNAL ||
- (Symbol->StorageClass == COFF::IMAGE_SYM_CLASS_EXTERNAL &&
- Symbol->SectionNumber == COFF::IMAGE_SYM_UNDEFINED &&
- Symbol->Value == 0)) {
+ } else if (Symbol->isWeakExternal()) {
const coff_aux_weak_external *Aux;
if (error(getSymbolAuxData(Obj, Symbol + I, Aux)))
break;
@@ -987,7 +978,7 @@ void COFFDumper::printSymbol(const SymbolRef &Sym) {
makeArrayRef(WeakExternalCharacteristics));
W.printBinary("Unused", makeArrayRef(Aux->Unused));
- } else if (Symbol->StorageClass == COFF::IMAGE_SYM_CLASS_FILE) {
+ } else if (Symbol->isFileRecord()) {
const coff_aux_file_record *Aux;
if (error(getSymbolAuxData(Obj, Symbol + I, Aux)))
break;
@@ -995,11 +986,7 @@ void COFFDumper::printSymbol(const SymbolRef &Sym) {
DictScope AS(W, "AuxFileRecord");
W.printString("FileName", StringRef(Aux->FileName));
- // C++/CLI creates external ABS symbols for non-const appdomain globals.
- // These are also followed by an auxiliary section definition.
- } else if (Symbol->StorageClass == COFF::IMAGE_SYM_CLASS_STATIC ||
- (Symbol->StorageClass == COFF::IMAGE_SYM_CLASS_EXTERNAL &&
- Symbol->SectionNumber == COFF::IMAGE_SYM_ABSOLUTE)) {
+ } else if (Symbol->isSectionDefinition()) {
const coff_aux_section_definition *Aux;
if (error(getSymbolAuxData(Obj, Symbol + I, Aux)))
break;
@@ -1026,7 +1013,7 @@ void COFFDumper::printSymbol(const SymbolRef &Sym) {
W.printNumber("AssocSection", AssocName, Aux->Number);
}
- } else if (Symbol->StorageClass == COFF::IMAGE_SYM_CLASS_CLR_TOKEN) {
+ } else if (Symbol->isCLRToken()) {
const coff_aux_clr_token *Aux;
if (error(getSymbolAuxData(Obj, Symbol + I, Aux)))
break;