Fix the printing of n_type.

Despite the name, n_type contains the type of the symbol, but also if it is
extern or private extern.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203154 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2014-03-06 20:13:41 +00:00
parent 7ed86b085e
commit abb1fadc79
2 changed files with 25 additions and 13 deletions

View File

@ -189,7 +189,8 @@ MACHO-I386-NEXT: ]
MACHO-I386-NEXT: Symbols [
MACHO-I386-NEXT: Symbol {
MACHO-I386-NEXT: Name: _main (1)
MACHO-I386-NEXT: Type: 0xF
MACHO-I386-NEXT: Extern
MACHO-I386-NEXT: Type: Section (0xE)
MACHO-I386-NEXT: Section: __text (0x1)
MACHO-I386-NEXT: RefType: UndefinedNonLazy (0x0)
MACHO-I386-NEXT: Flags [ (0x0)
@ -231,7 +232,8 @@ MACHO-X86-64-NEXT: ]
MACHO-X86-64-NEXT: Symbols [
MACHO-X86-64-NEXT: Symbol {
MACHO-X86-64-NEXT: Name: _main (1)
MACHO-X86-64-NEXT: Type: 0xF
MACHO-X86-64-NEXT: Extern
MACHO-X86-64-NEXT: Type: Section (0xE)
MACHO-X86-64-NEXT: Section: __text (0x1)
MACHO-X86-64-NEXT: RefType: UndefinedNonLazy (0x0)
MACHO-X86-64-NEXT: Flags [ (0x0)
@ -306,7 +308,8 @@ MACHO-PPC-NEXT: ]
MACHO-PPC-NEXT: Symbols [
MACHO-PPC-NEXT: Symbol {
MACHO-PPC-NEXT: Name: _f (4)
MACHO-PPC-NEXT: Type: 0xF
MACHO-PPC-NEXT: Extern
MACHO-PPC-NEXT: Type: Section (0xE)
MACHO-PPC-NEXT: Section: __text (0x1)
MACHO-PPC-NEXT: RefType: UndefinedNonLazy (0x0)
MACHO-PPC-NEXT: Flags [ (0x0)
@ -371,7 +374,8 @@ MACHO-PPC-NEXT: ]
MACHO-PPC-NEXT: Symbols [
MACHO-PPC-NEXT: Symbol {
MACHO-PPC-NEXT: Name: _b (1)
MACHO-PPC-NEXT: Type: 0xF
MACHO-PPC-NEXT: Extern
MACHO-PPC-NEXT: Type: Section (0xE)
MACHO-PPC-NEXT: Section: __data (0x3)
MACHO-PPC-NEXT: RefType: UndefinedNonLazy (0x0)
MACHO-PPC-NEXT: Flags [ (0x0)
@ -461,7 +465,8 @@ MACHO-PPC64-NEXT: ]
MACHO-PPC64-NEXT: Symbols [
MACHO-PPC64-NEXT: Symbol {
MACHO-PPC64-NEXT: Name: _f (4)
MACHO-PPC64-NEXT: Type: 0xF
MACHO-PPC64-NEXT: Extern
MACHO-PPC64-NEXT: Type: Section (0xE)
MACHO-PPC64-NEXT: Section: __text (0x1)
MACHO-PPC64-NEXT: RefType: UndefinedNonLazy (0x0)
MACHO-PPC64-NEXT: Flags [ (0x0)
@ -526,7 +531,8 @@ MACHO-PPC64-NEXT: ]
MACHO-PPC64-NEXT: Symbols [
MACHO-PPC64-NEXT: Symbol {
MACHO-PPC64-NEXT: Name: _b (1)
MACHO-PPC64-NEXT: Type: 0xF
MACHO-PPC64-NEXT: Extern
MACHO-PPC64-NEXT: Type: Section (0xE)
MACHO-PPC64-NEXT: Section: __data (0x3)
MACHO-PPC64-NEXT: RefType: UndefinedNonLazy (0x0)
MACHO-PPC64-NEXT: Flags [ (0x0)
@ -691,7 +697,8 @@ MACHO-ARM-NEXT: ]
MACHO-ARM-NEXT: Symbols [
MACHO-ARM-NEXT: Symbol {
MACHO-ARM-NEXT: Name: _f (4)
MACHO-ARM-NEXT: Type: 0xF
MACHO-ARM-NEXT: Extern
MACHO-ARM-NEXT: Type: Section (0xE)
MACHO-ARM-NEXT: Section: __text (0x1)
MACHO-ARM-NEXT: RefType: UndefinedNonLazy (0x0)
MACHO-ARM-NEXT: Flags [ (0x0)
@ -700,7 +707,8 @@ MACHO-ARM-NEXT: Value: 0x10
MACHO-ARM-NEXT: }
MACHO-ARM-NEXT: Symbol {
MACHO-ARM-NEXT: Name: _h (1)
MACHO-ARM-NEXT: Type: 0xF
MACHO-ARM-NEXT: Extern
MACHO-ARM-NEXT: Type: Section (0xE)
MACHO-ARM-NEXT: Section: __text (0x1)
MACHO-ARM-NEXT: RefType: UndefinedNonLazy (0x0)
MACHO-ARM-NEXT: Flags [ (0x0)
@ -825,7 +833,8 @@ MACHO-ARM-NEXT: ]
MACHO-ARM-NEXT: Symbols [
MACHO-ARM-NEXT: Symbol {
MACHO-ARM-NEXT: Name: _b (10)
MACHO-ARM-NEXT: Type: 0xF
MACHO-ARM-NEXT: Extern
MACHO-ARM-NEXT: Type: Section (0xE)
MACHO-ARM-NEXT: Section: __data (0x6)
MACHO-ARM-NEXT: RefType: UndefinedNonLazy (0x0)
MACHO-ARM-NEXT: Flags [ (0x0)

View File

@ -125,12 +125,10 @@ static const EnumEntry<unsigned> MachOSymbolFlags[] = {
static const EnumEntry<unsigned> MachOSymbolTypes[] = {
{ "Undef", 0x0 },
{ "External", 0x1 },
{ "Abs", 0x2 },
{ "Indirect", 0xA },
{ "PreboundUndef", 0xC },
{ "Section", 0xE },
{ "PrivateExternal", 0x10 }
{ "Section", 0xE }
};
namespace {
@ -395,7 +393,12 @@ void MachODumper::printSymbol(symbol_iterator SymI) {
if (Symbol.Type & MachO::N_STAB) {
W.printHex ("Type", "SymDebugTable", Symbol.Type);
} else {
W.printEnum("Type", Symbol.Type, makeArrayRef(MachOSymbolTypes));
if (Symbol.Type & MachO::N_PEXT)
W.startLine() << "PrivateExtern\n";
if (Symbol.Type & MachO::N_EXT)
W.startLine() << "Extern\n";
W.printEnum("Type", Symbol.Type & MachO::N_TYPE,
makeArrayRef(MachOSymbolTypes));
}
W.printHex ("Section", SectionName, Symbol.SectionIndex);
W.printEnum ("RefType", static_cast<uint16_t>(Symbol.Flags & 0xF),