This is an archive of the discontinued LLVM Phabricator instance.

[llvm-objdump] -T: print symbol versions
ClosedPublic

Authored by MaskRay on Aug 15 2021, 4:43 PM.

Details

Summary

Similar to D94907 (llvm-nm -D).

The output will match GNU objdump 2.37.
Older versions don't use (version) for undefined symbols.

Diff Detail

Event Timeline

MaskRay created this revision.Aug 15 2021, 4:43 PM
MaskRay requested review of this revision.Aug 15 2021, 4:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 15 2021, 4:43 PM
MaskRay updated this revision to Diff 366532.Aug 15 2021, 4:54 PM

improve test - add a visibility test

MaskRay updated this revision to Diff 366535.Aug 15 2021, 5:35 PM

test warning

I assume this is compatible with whatever GNU objdump does (I've not checked myself)?

llvm/test/tools/llvm-objdump/ELF/dynsym-version.test
16

Probably worth a comment here pointing out the difference with the previous case.

MaskRay updated this revision to Diff 366677.Aug 16 2021, 10:59 AM
MaskRay marked an inline comment as done.
MaskRay edited the summary of this revision. (Show Details)

add one more space to match GNU objdump.
improve tests

I assume this is compatible with whatever GNU objdump does (I've not checked myself)?

It matches the latest GNU objdump.

% ~/Dev/binutils-gdb/out/debug/binutils/objdump -T =cat > /tmp/0
% fob -T =cat > /tmp/1  # llvm-objdump with this patch
% diff -u /tmp/0 /tmp/1
--- /tmp/0      2021-08-16 10:59:21.938459199 -0700
+++ /tmp/1      2021-08-16 10:55:47.165812330 -0700
@@ -1,5 +1,5 @@
 
-/usr/bin/cat:     file format elf64-x86-64
+/usr/bin/cat:  file format elf64-x86-64
 
 DYNAMIC SYMBOL TABLE:
 0000000000000000      DF *UND* 0000000000000000 (GLIBC_2.2.5) free
@@ -64,5 +64,3 @@
 000000000000b280  w   DO .bss  0000000000000008 (GLIBC_2.2.5) program_invocation_short_name
 000000000000b2a0 g    DO .bss  0000000000000008 (GLIBC_2.2.5) stderr
 000000000000b290 g    DO .bss  0000000000000004 (GLIBC_2.2.5) optind
-
-
jhenderson added inline comments.Aug 17 2021, 12:28 AM
llvm/test/tools/llvm-objdump/ELF/dynsym-version.test
102

Up to you whether you do this, but I see no harm in folding it in with the main case. This helps reduce the number of individual test cases.

103

If you choose not to merge things, I think you can drop the -DINDEX=1 right?

MaskRay updated this revision to Diff 366823.Aug 17 2021, 1:01 AM
MaskRay marked an inline comment as done.

simplify test

llvm/test/tools/llvm-objdump/ELF/dynsym-version.test
102

If in the future we ever compute the max width of the section & the version name, having separate tests can test the case when all version names are not greater than 12 bytes.

Using [[VERSION_NAME=v5hidden]] is an alternative, but that may make the test a bit complex.

jhenderson accepted this revision.Aug 17 2021, 1:04 AM

LGTM, thanks!

This revision is now accepted and ready to land.Aug 17 2021, 1:04 AM
This revision was landed with ongoing or failed builds.Aug 17 2021, 9:11 AM
This revision was automatically updated to reflect the committed changes.