[PATCH] D112735: export unique symbol list for xcoff with llvm-nm new option "--export-symbols"
Digger Lin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 28 12:23:40 PST 2022
DiggerLin marked 10 inline comments as done.
DiggerLin added inline comments.
================
Comment at: llvm/docs/CommandGuide/llvm-nm.rst:278
+
+.. option:: --no-rsrc
+
----------------
MaskRay wrote:
> Is this option from AIX nm? Or you just think it useful?
yes, the option is for aix only.
================
Comment at: llvm/tools/llvm-nm/llvm-nm.cpp:270
+static bool compareSymbolNameVisibility(const NMSymbol &A, const NMSymbol &B) {
+ return std::make_tuple(A.Name, A.Visibility) <
+ std::make_tuple(B.Name, B.Visibility);
----------------
MaskRay wrote:
> Can two symbols with the same name have different visibilities?
>
> In ELF, it can't. If you want to make the result stable on all platforms, use stable_sort.
yes, in the aix, it is possible that same name have different visibilities in different object files of archive file.
================
Comment at: llvm/tools/llvm-nm/llvm-nm.cpp:1694
+ // Skip Shared object file.
+ if (Obj->getFlags() & XCOFF::F_SHROBJ)
+ return;
----------------
MaskRay wrote:
> Don't shared objects have exported symbols as well? Why are them skipped?
yes, in aix , we skip export symbol list from shared objects.
================
Comment at: llvm/tools/llvm-nm/llvm-nm.cpp:1755
+
+ Regex r("^__[0-9]+__");
+ if (SymName.startswith("__sinit") || SymName.startswith("__sterm") ||
----------------
MaskRay wrote:
> Regex library is large and slow. Try avoiding it.
>
> The pattern is simple. You may just open coding the pattern.
this is not std::Regex, it is llvm specific Regex, and the code is easy to understand, if I write my own code, the reviewer maybe take some time to understand.
but I changed as suggestion anyway.
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