Currently, llvm-readobj do not support GNU style dumper for symbol versioning sections. In this patch, I would like to implement dumper for .gnu.version section
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 29986 Build 29985: arc lint + arc unit
Event Timeline
Very cool. It looks like -V also prints a definition/needed section that this patch doesn't support yet. Is that coming in a later patch?
i.e.,
$ readelf -V ~/src/llvm-project/llvm/test/tools/llvm-readobj/Inputs/verdef.elf-x86-64 Version symbols section '.gnu.version' contains 8 entries: Addr: 000000000000024c Offset: 0x00024c Link: 1 (.dynsym) 000: 0 (*local*) 1 (*global*) 1 (*global*) 3 (VERSION2) 004: 1 (*global*) 2 (VERSION1) 2 (VERSION1) 3 (VERSION2) # This block is missing from this patch Version definition section '.gnu.version_d' contains 3 entries: Addr: 0x000000000000025c Offset: 0x00025c Link: 2 (.dynstr) 000000: Rev: 1 Flags: BASE Index: 1 Cnt: 1 Name: blah 0x001c: Rev: 1 Flags: none Index: 2 Cnt: 1 Name: VERSION1 0x0038: Rev: 1 Flags: none Index: 3 Cnt: 2 Name: VERSION2 0x0054: Parent 1: VERSION1 $ readelf -V ~/src/llvm-project/llvm/test/tools/llvm-readobj/Inputs/verneed.elf-x86-64 Version symbols section '.gnu.version' contains 4 entries: Addr: 0000000000010228 Offset: 0x000228 Link: 1 (.dynsym) 000: 0 (*local*) 2 (v3) 3 (v2) 4 (v1) # This block is missing from this patch Version needs section '.gnu.version_r' contains 2 entries: Addr: 0x0000000000010230 Offset: 0x000230 Link: 5 (.dynstr) 000000: Version: 1 File: verneed1.so.0 Cnt: 2 0x0020: Name: v2 Flags: none Version: 3 0x0030: Name: v3 Flags: none Version: 2 0x0010: Version: 1 File: verneed2.so.0 Cnt: 1 0x0040: Name: v1 Flags: none Version: 4
Thanks for reviewing! I have implemented prototype dumpers for them, and I would like to introduce them in next series of patches.
llvm/tools/llvm-readobj/ELFDumper.cpp | ||
---|---|---|
3358–3408 | Use uint64_t (or possibly size_t) here. ELF64 sections have section sizes of 64-bits. Various variables below will similarly need adjusting. | |
3373 | Does this behaviour hold if using --wide in GNU readelf? | |
3391 | Test case for hidden symbols? | |
3401 | What happens if the version name is longer than this? (Is that even possible?) |
llvm/test/tools/llvm-readobj/elf-hidden-versym.test | ||
---|---|---|
32–41 ↗ | (On Diff #193420) | Could you add less padding between the Name and other fields, and the values for those fields, please? Ditto in the other new test. |
llvm/tools/llvm-readobj/ELFDumper.cpp | ||
3375 | Entries is now a uin64_t, so VersymRow and VersymIndex below should be too. | |
3401 | I think it's okay to leave for now, but you might want to consider improving it in a future version, by using a column width that varies depending on name widths. |
llvm/tools/llvm-readobj/ELFDumper.cpp | ||
---|---|---|
3401 | Thanks, I will consider improve this behavior |
Does this behaviour hold if using --wide in GNU readelf?