[PATCH] D58615: [llvm-objdump] Add `Version Definitions` dumper
Xing via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 25 08:17:16 PST 2019
Higuoxing added a comment.
In D58615#1409090 <https://reviews.llvm.org/D58615#1409090>, @jhenderson wrote:
> How many verdefs do you get in a typical file? I'm looking at the hard-coded indentation amount of Verdaux entries after the first, and thinking that that indentation doesn't look quite right, and would look worse the higher the index, due to the first column changing in width. I think it should line up with the previous name, but I don't think it currently does. Additionally, if I'm not mistaken the formatting will look something like:
>
> 1 0x01 0x075bcd15 foo
> 2 0x02 0x3ade68b1 VERSION_1
> ...
> 9 0xab 0x12345678 something
> 10 0xdc 0xabcdef90 something_else
>
>
> which doesn't look great. Assuming it's not unusual to have 10+ entries, could you do something that ensures the column width is consistent?
I think there could be an object file that has over 10 entries in its `verdef` section.
However, `gnu-objdump` has the same problem. I currently have no idea how to make it compatible with `gnu-objdump` and ensure the column width is consistent.
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Entry: 0x0000000000001000
Sections:
- Name: .gnu.version_d
Type: SHT_GNU_verdef
Flags: [ SHF_ALLOC ]
Address: 0x0000000000000230
Link: .dynstr
AddressAlign: 0x0000000000000004
Info: 0x0000000000000010
Entries:
- Version: 1
Flags: 1
VersionNdx: 1
Hash: 123456789
Names:
- VERSION_1
- Version: 1
Flags: 2
VersionNdx: 2
Hash: 987654321
Names:
- VERSION_2
- Version: 1
Flags: 2
VersionNdx: 3
Hash: 98765321
Names:
- VERSION_3
- Version: 1
Flags: 2
VersionNdx: 4
Hash: 98654321
Names:
- VERSION_4
- Version: 1
Flags: 2
VersionNdx: 5
Hash: 98765421
Names:
- VERSION_5
- Version: 1
Flags: 2
VersionNdx: 6
Hash: 989654321
Names:
- VERSION_6
- Version: 1
Flags: 2
VersionNdx: 7
Hash: 997654321
Names:
- VERSION_7
- Version: 1
Flags: 2
VersionNdx: 8
Hash: 997654321
Names:
- VERSION_8
- Version: 1
Flags: 2
VersionNdx: 9
Hash: 997654321
Names:
- VERSION_9
- Version: 1
Flags: 2
VersionNdx: 10
Hash: 997654321
Names:
- VERSION_10
- Version: 1
Flags: 2
VersionNdx: 11
Hash: 997654321
Names:
- VERSION_11
- Version: 1
Flags: 2
VersionNdx: 12
Hash: 997654321
Names:
- VERSION_12
- Version: 1
Flags: 2
VersionNdx: 13
Hash: 997654321
Names:
- VERSION_13
DynamicSymbols:
Global:
- Name: bar
...
================
Comment at: tools/llvm-objdump/ELFDump.cpp:314
+ outs() << VerdefIndex ++ << " "
+ << format("0x%02" PRIx16 " ", (uint16_t)Verdef->vd_flags)
+ << format("0x%08" PRIx32 " ", (uint32_t)Verdef->vd_hash);
----------------
jhenderson wrote:
> This only prints a width of 2, but the flags could require four digits. Are there never any flags beyond 0xff?
As for `vd_flags` field, its value can be 0x01(VER_FLG_BASE) or 0x02(VER_FLG_WEAK).
See, https://docs.oracle.com/cd/E19957-01/806-0641/chapter6-80869/index.html
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58615/new/
https://reviews.llvm.org/D58615
More information about the llvm-commits
mailing list