[PATCH] D73174: [llvm-readobj] - Refine --needed-libs implementation and add a test.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 24 01:59:32 PST 2020


jhenderson accepted this revision.
jhenderson added a comment.
This revision is now accepted and ready to land.

LGTM.



================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:2474
 
-  llvm::stable_sort(Libs);
+  llvm::sort(Libs);
 
----------------
grimar wrote:
> jhenderson wrote:
> > What's the reasoning for this change? Won't this potentially change the behaviour where two DT_NEEDED entries have the same string?
> We have a `std::vector<std::string>` here and sorting it to print below.
> What is the point to use `stable_sort`?
> If we have "aaa", "bbb", "aaa" then we might end up with one of the following:
> 
> 1) "aaa" (1), "aaa" (2), "bbb"
> 2) "aaa" (2), "aaa" (1), "bbb"
> 
> May be I am missing something, but what is the difference? :)
Good point!


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

https://reviews.llvm.org/D73174





More information about the llvm-commits mailing list