[PATCH] D112735: export unique symbol list for xcoff with llvm-objdump new option "--export-unique-symbol"

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 2 08:31:17 PDT 2021


jhenderson added a comment.

As I already explained, I believe most of the functionality you need is already present in llvm-nm:

> export the symbols of the xcoff archive or object files. (export the extern and extern weak symbol)

Assuming you mean print, llvm-nm already prints all symbols or a subset of symbols (you can use the --extern-only and/or potentially the --dynamic option (if needed - I don't know if XCOFF has a dynamic/static symbol distinction) to achieve this in llvm-nm.

> delete the duplicate export symbols (which has same symbol name and visibility)

This functionality doesn't exist in llvm-nm yet to my knowledge, but would be fine, and probably simpler, to add there under a new option (e.g. --unique), since it already has lists of symbols to enable sorting. It would be trivial to uniquify that list.

> sort the export symbols.

llvm-nm already provides various options for sorting, so it is unlikely you'd need to add anything here.

> print out the unique and sorted export symbols (print the symbol name and visibility).

Printing out the visibility would be new, but I think is generic to at least ELF and XCOFF, so it would be easy to add a new column to llvm-nm's output, behind some option (e.g. --show-visibility).

You could then enable all the new options at once with a new XCOFF-specific llvm-nm option: --xcoff-unique-exports.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112735/new/

https://reviews.llvm.org/D112735



More information about the llvm-commits mailing list