mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-27 15:02:16 +00:00
llvm-readobj: pretty-print special COFF section names
Print IMAGE_SYM_DEBUG and the like instead of (-2). llvm-svn: 218172
This commit is contained in:
parent
203d8801c7
commit
5aaced04a8
@ -21,7 +21,7 @@
|
||||
// CHECK-SCN: Symbols [
|
||||
// CHECK-SCN: Symbol {
|
||||
// CHECK-SCN: Name: .file
|
||||
// CHECK-SCN: Section: (-2)
|
||||
// CHECK-SCN: Section: IMAGE_SYM_DEBUG (-2)
|
||||
// CHECK-SCN: StorageClass: File
|
||||
// CHECK-SCN: AuxFileRecord {
|
||||
// CHECK-SCN: FileName: null-padded.asm
|
||||
@ -29,7 +29,7 @@
|
||||
// CHECK-SCN: }
|
||||
// CHECK-SCN: Symbol {
|
||||
// CHECK-SCN: Name: .file
|
||||
// CHECK-SCN: Section: (-2)
|
||||
// CHECK-SCN: Section: IMAGE_SYM_DEBUG (-2)
|
||||
// CHECK-SCN: StorageClass: File
|
||||
// CHECK-SCN: AuxFileRecord {
|
||||
// CHECK-SCN: FileName: eighteen-chars.asm
|
||||
@ -37,7 +37,7 @@
|
||||
// CHECK-SCN: }
|
||||
// CHECK-SCN: Symbol {
|
||||
// CHECK-SCN: Name: .file
|
||||
// CHECK-SCN: Section: (-2)
|
||||
// CHECK-SCN: Section: IMAGE_SYM_DEBUG (-2)
|
||||
// CHECK-SCN: StorageClass: File
|
||||
// CHECK-SCN: AuxFileRecord {
|
||||
// CHECK-SCN: FileName: multiple-auxiliary-entries.asm
|
||||
|
@ -48,7 +48,7 @@ weak_aliased_to_external = external2
|
||||
// CHECK-NEXT: Symbol {
|
||||
// CHECK: Name: global_aliased_to_external
|
||||
// CHECK-NEXT: Value: 0
|
||||
// CHECK-NEXT: Section: (0)
|
||||
// CHECK-NEXT: Section: IMAGE_SYM_UNDEFINED (0)
|
||||
// CHECK-NEXT: BaseType: Null (0x0)
|
||||
// CHECK-NEXT: ComplexType: Null (0x0)
|
||||
// CHECK-NEXT: StorageClass: External (0x2)
|
||||
@ -57,7 +57,7 @@ weak_aliased_to_external = external2
|
||||
// CHECK-NEXT: Symbol {
|
||||
// CHECK-NEXT: Name: external1
|
||||
// CHECK-NEXT: Value: 0
|
||||
// CHECK-NEXT: Section: (0)
|
||||
// CHECK-NEXT: Section: IMAGE_SYM_UNDEFINED (0)
|
||||
// CHECK-NEXT: BaseType: Null (0x0)
|
||||
// CHECK-NEXT: ComplexType: Null (0x0)
|
||||
// CHECK-NEXT: StorageClass: External (0x2)
|
||||
@ -84,7 +84,7 @@ weak_aliased_to_external = external2
|
||||
// CHECK-NEXT: Symbol {
|
||||
// CHECK-NEXT: Name: weak_aliased_to_external
|
||||
// CHECK-NEXT: Value: 0
|
||||
// CHECK-NEXT: Section: (0)
|
||||
// CHECK-NEXT: Section: IMAGE_SYM_UNDEFINED (0)
|
||||
// CHECK-NEXT: BaseType: Null (0x0)
|
||||
// CHECK-NEXT: ComplexType: Null (0x0)
|
||||
// CHECK-NEXT: StorageClass: WeakExternal (0x69)
|
||||
@ -97,7 +97,7 @@ weak_aliased_to_external = external2
|
||||
// CHECK-NEXT: Symbol {
|
||||
// CHECK-NEXT: Name: external2
|
||||
// CHECK-NEXT: Value: 0
|
||||
// CHECK-NEXT: Section: (0)
|
||||
// CHECK-NEXT: Section: IMAGE_SYM_UNDEFINED (0)
|
||||
// CHECK-NEXT: BaseType: Null (0x0)
|
||||
// CHECK-NEXT: ComplexType: Null (0x0)
|
||||
// CHECK-NEXT: StorageClass: External (0x2)
|
||||
|
@ -127,7 +127,7 @@ _main: # @main
|
||||
// CHECK: Symbol {
|
||||
// CHECK: Name: _printf
|
||||
// CHECK: Value: 0
|
||||
// CHECK: Section: (0)
|
||||
// CHECK: Section: IMAGE_SYM_UNDEFINED (0)
|
||||
// CHECK: BaseType: Null
|
||||
// CHECK: ComplexType: Null
|
||||
// CHECK: StorageClass: External
|
||||
|
@ -127,7 +127,7 @@ L_.str: # @.str
|
||||
// CHECK: Symbol {
|
||||
// CHECK: Name: _printf
|
||||
// CHECK: Value: 0
|
||||
// CHECK: Section: (0)
|
||||
// CHECK: Section: IMAGE_SYM_UNDEFINED (0)
|
||||
// CHECK: BaseType: Null
|
||||
// CHECK: ComplexType: Null
|
||||
// CHECK: StorageClass: External
|
||||
|
@ -17,7 +17,7 @@
|
||||
// CHECK: Symbol {
|
||||
// CHECK: Name: _b
|
||||
// CHECK-NEXT: Value: 4
|
||||
// CHECK-NEXT: Section: (0)
|
||||
// CHECK-NEXT: Section: IMAGE_SYM_UNDEFINED (0)
|
||||
// CHECK-NEXT: BaseType: Null
|
||||
// CHECK-NEXT: ComplexType: Null
|
||||
// CHECK-NEXT: StorageClass: External
|
||||
|
@ -6,7 +6,7 @@
|
||||
// CHECK: Symbol {
|
||||
// CHECK: Name: @feat.00
|
||||
// CHECK: Value: 123
|
||||
// CHECK: Section: (-1)
|
||||
// CHECK: Section: IMAGE_SYM_ABSOLUTE (-1)
|
||||
// CHECK: BaseType: Null (0x0)
|
||||
// CHECK: ComplexType: Null (0x0)
|
||||
// CHECK: StorageClass: External (0x2)
|
||||
|
@ -21,7 +21,7 @@
|
||||
// CHECK-SCN: Symbols [
|
||||
// CHECK-SCN: Symbol {
|
||||
// CHECK-SCN: Name: .file
|
||||
// CHECK-SCN: Section: (-2)
|
||||
// CHECK-SCN: Section: IMAGE_SYM_DEBUG (-2)
|
||||
// CHECK-SCN: StorageClass: File
|
||||
// CHECK-SCN: AuxFileRecord {
|
||||
// CHECK-SCN: FileName: null-padded.asm
|
||||
@ -29,7 +29,7 @@
|
||||
// CHECK-SCN: }
|
||||
// CHECK-SCN: Symbol {
|
||||
// CHECK-SCN: Name: .file
|
||||
// CHECK-SCN: Section: (-2)
|
||||
// CHECK-SCN: Section: IMAGE_SYM_DEBUG (-2)
|
||||
// CHECK-SCN: StorageClass: File
|
||||
// CHECK-SCN: AuxFileRecord {
|
||||
// CHECK-SCN: FileName: eighteen-chars.asm
|
||||
@ -37,7 +37,7 @@
|
||||
// CHECK-SCN: }
|
||||
// CHECK-SCN: Symbol {
|
||||
// CHECK-SCN: Name: .file
|
||||
// CHECK-SCN: Section: (-2)
|
||||
// CHECK-SCN: Section: IMAGE_SYM_DEBUG (-2)
|
||||
// CHECK-SCN: StorageClass: File
|
||||
// CHECK-SCN: AuxFileRecord {
|
||||
// CHECK-SCN: FileName: multiple-auxiliary-entries.asm
|
||||
|
@ -148,7 +148,7 @@ _main: # @main
|
||||
// CHECK: Symbol {
|
||||
// CHECK: Name: _printf
|
||||
// CHECK: Value: 0
|
||||
// CHECK: Section: (0)
|
||||
// CHECK: Section: IMAGE_SYM_UNDEFINED (0)
|
||||
// CHECK: BaseType: Null
|
||||
// CHECK: ComplexType: Null
|
||||
// CHECK: StorageClass: External
|
||||
@ -157,7 +157,7 @@ _main: # @main
|
||||
// CHECK: Symbol {
|
||||
// CHECK: Name: _puts
|
||||
// CHECK: Value: 0
|
||||
// CHECK: Section: (0)
|
||||
// CHECK: Section: IMAGE_SYM_UNDEFINED (0)
|
||||
// CHECK: BaseType: Null
|
||||
// CHECK: ComplexType: Null
|
||||
// CHECK: StorageClass: External
|
||||
|
@ -148,7 +148,7 @@ L_.str2:
|
||||
// CHECK: Symbol {
|
||||
// CHECK: Name: _printf
|
||||
// CHECK: Value: 0
|
||||
// CHECK: Section: (0)
|
||||
// CHECK: Section: IMAGE_SYM_UNDEFINED (0)
|
||||
// CHECK: BaseType: Null
|
||||
// CHECK: ComplexType: Null
|
||||
// CHECK: StorageClass: External
|
||||
@ -157,7 +157,7 @@ L_.str2:
|
||||
// CHECK: Symbol {
|
||||
// CHECK: Name: _puts
|
||||
// CHECK: Value: 0
|
||||
// CHECK: Section: (0)
|
||||
// CHECK: Section: IMAGE_SYM_UNDEFINED (0)
|
||||
// CHECK: BaseType: Null
|
||||
// CHECK: ComplexType: Null
|
||||
// CHECK: StorageClass: External
|
||||
|
@ -37,7 +37,7 @@ LBB0_2: # %return
|
||||
// CHECK: Symbol {
|
||||
// CHECK: Name: _test_weak
|
||||
// CHECK-NEXT: Value: 0
|
||||
// CHECK-NEXT: Section: (0)
|
||||
// CHECK-NEXT: Section: IMAGE_SYM_UNDEFINED (0)
|
||||
// CHECK-NEXT: BaseType: Null
|
||||
// CHECK-NEXT: ComplexType: Null
|
||||
// CHECK-NEXT: StorageClass: WeakExternal
|
||||
@ -51,7 +51,7 @@ LBB0_2: # %return
|
||||
// CHECK: Symbol {
|
||||
// CHECK: Name: .weak._test_weak.default
|
||||
// CHECK-NEXT: Value: 0
|
||||
// CHECK-NEXT: Section: (-1)
|
||||
// CHECK-NEXT: Section: IMAGE_SYM_ABSOLUTE (-1)
|
||||
// CHECK-NEXT: BaseType: Null
|
||||
// CHECK-NEXT: ComplexType: Null
|
||||
// CHECK-NEXT: StorageClass: External
|
||||
@ -61,7 +61,7 @@ LBB0_2: # %return
|
||||
// CHECK: Symbol {
|
||||
// CHECK: Name: _test_weak_alias
|
||||
// CHECK-NEXT: Value: 0
|
||||
// CHECK-NEXT: Section: (0)
|
||||
// CHECK-NEXT: Section: IMAGE_SYM_UNDEFINED (0)
|
||||
// CHECK-NEXT: BaseType: Null
|
||||
// CHECK-NEXT: ComplexType: Null
|
||||
// CHECK-NEXT: StorageClass: WeakExternal
|
||||
|
@ -76,7 +76,7 @@ CHECK-NEXT: Symbols [
|
||||
CHECK-NEXT: Symbol {
|
||||
CHECK-NEXT: Name: .file
|
||||
CHECK-NEXT: Value: 0
|
||||
CHECK-NEXT: Section: (-2)
|
||||
CHECK-NEXT: Section: IMAGE_SYM_DEBUG (-2)
|
||||
CHECK-NEXT: BaseType: Null (0x0)
|
||||
CHECK-NEXT: ComplexType: Null (0x0)
|
||||
CHECK-NEXT: StorageClass: File (0x67)
|
||||
|
@ -4,7 +4,7 @@ CHECK: Symbols [
|
||||
CHECK: Symbol {
|
||||
CHECK: Name: .file
|
||||
CHECK: Value: 0
|
||||
CHECK: Section: (-2)
|
||||
CHECK: Section: IMAGE_SYM_DEBUG (-2)
|
||||
CHECK: BaseType: Null (0x0)
|
||||
CHECK: ComplexType: Null (0x0)
|
||||
CHECK: StorageClass: File (0x67)
|
||||
|
@ -9,7 +9,7 @@ CHECK: Symbols [
|
||||
CHECK: Symbol {
|
||||
CHECK: Name: ?PerAppDomain@@$$Q3HA
|
||||
CHECK-NEXT: Value: 4
|
||||
CHECK-NEXT: Section: (-1)
|
||||
CHECK-NEXT: Section: IMAGE_SYM_ABSOLUTE (-1)
|
||||
CHECK-NEXT: BaseType: Null (0x0)
|
||||
CHECK-NEXT: ComplexType: Null (0x0)
|
||||
CHECK-NEXT: StorageClass: External (0x2)
|
||||
@ -27,7 +27,7 @@ CHECK-NEXT: }
|
||||
CHECK: Symbol {
|
||||
CHECK: Name: 04000001
|
||||
CHECK-NEXT: Value: 4
|
||||
CHECK-NEXT: Section: (-1)
|
||||
CHECK-NEXT: Section: IMAGE_SYM_ABSOLUTE (-1)
|
||||
CHECK-NEXT: BaseType: Null (0x0)
|
||||
CHECK-NEXT: ComplexType: Null (0x0)
|
||||
CHECK-NEXT: StorageClass: CLRToken (0x6B)
|
||||
|
@ -7,7 +7,7 @@ COFF: Symbols [
|
||||
COFF-NEXT: Symbol {
|
||||
COFF-NEXT: Name: @comp.id
|
||||
COFF-NEXT: Value: 14766605
|
||||
COFF-NEXT: Section: (-1)
|
||||
COFF-NEXT: Section: IMAGE_SYM_ABSOLUTE (-1)
|
||||
COFF-NEXT: BaseType: Null (0x0)
|
||||
COFF-NEXT: ComplexType: Null (0x0)
|
||||
COFF-NEXT: StorageClass: Static (0x3)
|
||||
@ -16,7 +16,7 @@ COFF-NEXT: }
|
||||
COFF-NEXT: Symbol {
|
||||
COFF-NEXT: Name: @feat.00
|
||||
COFF-NEXT: Value: 2147484049
|
||||
COFF-NEXT: Section: (-1)
|
||||
COFF-NEXT: Section: IMAGE_SYM_ABSOLUTE (-1)
|
||||
COFF-NEXT: BaseType: Null (0x0)
|
||||
COFF-NEXT: ComplexType: Null (0x0)
|
||||
COFF-NEXT: StorageClass: Static (0x3)
|
||||
|
@ -715,6 +715,24 @@ void COFFDumper::printSymbols() {
|
||||
|
||||
void COFFDumper::printDynamicSymbols() { ListScope Group(W, "DynamicSymbols"); }
|
||||
|
||||
static StringRef getSectionName(const llvm::object::COFFObjectFile *Obj,
|
||||
COFFSymbolRef Symbol,
|
||||
const coff_section *Section) {
|
||||
if (Section) {
|
||||
StringRef SectionName;
|
||||
Obj->getSectionName(Section, SectionName);
|
||||
return SectionName;
|
||||
}
|
||||
int32_t SectionNumber = Symbol.getSectionNumber();
|
||||
if (SectionNumber == llvm::COFF::IMAGE_SYM_DEBUG)
|
||||
return "IMAGE_SYM_DEBUG";
|
||||
if (SectionNumber == llvm::COFF::IMAGE_SYM_ABSOLUTE)
|
||||
return "IMAGE_SYM_ABSOLUTE";
|
||||
if (SectionNumber == llvm::COFF::IMAGE_SYM_UNDEFINED)
|
||||
return "IMAGE_SYM_UNDEFINED";
|
||||
return "";
|
||||
}
|
||||
|
||||
void COFFDumper::printSymbol(const SymbolRef &Sym) {
|
||||
DictScope D(W, "Symbol");
|
||||
|
||||
@ -730,9 +748,7 @@ void COFFDumper::printSymbol(const SymbolRef &Sym) {
|
||||
if (Obj->getSymbolName(Symbol, SymbolName))
|
||||
SymbolName = "";
|
||||
|
||||
StringRef SectionName = "";
|
||||
if (Section)
|
||||
Obj->getSectionName(Section, SectionName);
|
||||
StringRef SectionName = getSectionName(Obj, Symbol, Section);
|
||||
|
||||
W.printString("Name", SymbolName);
|
||||
W.printNumber("Value", Symbol.getValue());
|
||||
|
Loading…
x
Reference in New Issue
Block a user