This is an archive of the discontinued LLVM Phabricator instance.

[llvm-nm] Add --format=just-symbols and make --just-symbol-name its alias
ClosedPublic

Authored by MaskRay on Mar 12 2021, 5:22 PM.

Details

Summary

https://sourceware.org/bugzilla/show_bug.cgi?id=27487 binutils will have
--format=just-symbols/-j as well.

Arbitrarily prefer -j to --format=sysv. Previously --format=sysv -j prints
in the sysv format while -j takes precedence over other formats.

Diff Detail

Event Timeline

MaskRay created this revision.Mar 12 2021, 5:22 PM
MaskRay requested review of this revision.Mar 12 2021, 5:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 12 2021, 5:22 PM
jhenderson added inline comments.Mar 15 2021, 1:18 AM
llvm/tools/llvm-nm/llvm-nm.cpp
777–781

By making -j an output format, the code here could change in behaviour, if I understand it correctly, so the --print-file-name option will not be respected anymore. It probably doesn't matter too much, but perhaps we should treat -j as the same output format as bsd/posix here (speaking of which, feel free to fold the two semantically identical cases together here whilst you're at it).

MaskRay updated this revision to Diff 330720.Mar 15 2021, 10:41 AM
MaskRay marked an inline comment as done.

Test
llvm-nm -j %t.o %t.o
and
llvm-nm -j -A %t.o %t.o
do not change behavior (untested previously).

jhenderson accepted this revision.Mar 16 2021, 2:09 AM

LGTM, with one nit.

llvm/test/tools/llvm-nm/just-symbols.test
32

Should we have a MULTI2-NOT: {{.}} here too?

This revision is now accepted and ready to land.Mar 16 2021, 2:09 AM
MaskRay updated this revision to Diff 331026.Mar 16 2021, 10:05 AM
MaskRay marked an inline comment as done.

Add a -NOT: {{.}}

This revision was landed with ongoing or failed builds.Mar 16 2021, 10:07 AM
This revision was automatically updated to reflect the committed changes.
llvm/docs/CommandGuide/llvm-nm.rst