Title: Export unique symbol list with llvm-nm new option "--export-symbols"
authorzhijian <zhijian@ca.ibm.com>
Thu, 17 Feb 2022 16:37:33 +0000 (11:37 -0500)
committerzhijian <zhijian@ca.ibm.com>
Thu, 17 Feb 2022 16:37:33 +0000 (11:37 -0500)
commitfd3ba1f862f54811ff9f4663ff298ff02d9c3b70
treedcc0175d09c5a86181660b996655c94e05c78c73
parent0b57e6c46b707c0e7a123efe82abf3c1e7b5a503
Title: Export unique symbol list with llvm-nm new option "--export-symbols"

Summary:

the patch implement of following functionality.
1. export the symbols from archive or object files.
2. sort the export symbols. (based on same symbol name and visibility)
3. delete the duplicate export symbols (based on same symbol name and visibility)
4. print out the  unique and sorted export symbols (print the symbol name and visibility).

there are two new options are add in the patch
1. --export-symbols (enable the functionality of export unique symbol)
2. --no-rsrc (exclude the symbol name begin with "__rsrc" from be exporting from xcoff object file)

Export symbol list for xcoff object file has the same functionality as
The patch has the same functionality as
https://www.ibm.com/docs/en/xl-c-aix/13.1.0?topic=library-exporting-symbols-createexportlist-utility

Reviewers: James Henderson,Fangrui Song
Differential Revision: https://reviews.llvm.org/D112735
llvm/docs/CommandGuide/llvm-nm.rst
llvm/include/llvm/BinaryFormat/XCOFF.h
llvm/include/llvm/Object/XCOFFObjectFile.h
llvm/lib/Object/XCOFFObjectFile.cpp
llvm/test/tools/llvm-nm/XCOFF/export-symbols.test [new file with mode: 0644]
llvm/test/tools/llvm-nm/bitcode-export-sym.test [new file with mode: 0644]
llvm/tools/llvm-nm/Opts.td
llvm/tools/llvm-nm/llvm-nm.cpp