llvm.org GIT mirror llvm / bd1e605
objdump: Don't print a (always 0) size for MachO symbols. Only common symbol on MachO and COFF have a size. For COFF we already had a custom format. For MachO, there is no native objdump and we were printing it as ELF. Now we only print the sizes for symbols that actually have them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240422 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 5 years ago
3 changed file(s) with 18 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
2929
3030 macho-i386: trivial-object-test.macho-i386: file format Mach-O 32-bit i386
3131 macho-i386: SYMBOL TABLE:
32 macho-i386: 00000000 g F __TEXT,__text 00000000 _main
33 macho-i386: 00000000 *UND* 00000000 _SomeOtherFunction
34 macho-i386: 00000000 *UND* 00000000 _puts
32 macho-i386: 00000000 g F __TEXT,__text _main
33 macho-i386: 00000000 *UND* _SomeOtherFunction
34 macho-i386: 00000000 *UND* _puts
3535
3636 ELF-shared: shared-object-test.elf-i386: file format
3737 ELF-shared: SYMBOL TABLE:
0 RUN: llvm-objdump -macho -t %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s
11
22 CHECK: SYMBOL TABLE:
3 CHECK: 000000000000003b l F __TEXT,__cstring 00000000 L_.str
4 CHECK: 0000000000000068 l F __TEXT,__eh_frame 00000000 EH_frame0
5 CHECK: 0000000000000000 g F __TEXT,__text 00000000 _main
6 CHECK: 0000000000000080 g F __TEXT,__eh_frame 00000000 _main.eh
7 CHECK: 0000000000000000 *UND* 00000000 _printf
3 CHECK: 000000000000003b l F __TEXT,__cstring L_.str
4 CHECK: 0000000000000068 l F __TEXT,__eh_frame EH_frame0
5 CHECK: 0000000000000000 g F __TEXT,__text _main
6 CHECK: 0000000000000080 g F __TEXT,__eh_frame _main.eh
7 CHECK: 0000000000000000 *UND* _printf
10841084 continue;
10851085 if (error(Symbol.getType(Type)))
10861086 continue;
1087 uint64_t Size = Symbol.getSize();
10881087 if (error(Symbol.getSection(Section)))
10891088 continue;
10901089 StringRef Name;
11001099 bool Common = Flags & SymbolRef::SF_Common;
11011100 bool Hidden = Flags & SymbolRef::SF_Hidden;
11021101
1103 if (Common) {
1104 uint32_t Alignment = Symbol.getAlignment();
1105 Address = Size;
1106 Size = Alignment;
1107 }
1102 if (Common)
1103 Address = Symbol.getSize();
1104
11081105 if (Address == UnknownAddressOrSize)
11091106 Address = 0;
1110 if (Size == UnknownAddressOrSize)
1111 Size = 0;
11121107 char GlobLoc = ' ';
11131108 if (Type != SymbolRef::ST_Unknown)
11141109 GlobLoc = Global ? 'g' : 'l';
11501145 SectionName = "";
11511146 outs() << SectionName;
11521147 }
1153 outs() << '\t'
1154 << format("%08" PRIx64 " ", Size);
1148
1149 outs() << '\t';
1150 if (Common)
1151 outs() << format("%08" PRIx64 " ", Symbol.getAlignment());
1152 else if (isa(o))
1153 outs() << format("%08" PRIx64 " ", Symbol.getSize());
1154
11551155 if (Hidden) {
11561156 outs() << ".hidden ";
11571157 }