[PATCH] D41527: [llvm-readobj] Support -needed-libs option for Mach-O files

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 23 05:40:17 PST 2017

davide added inline comments.

Comment at: tools/llvm-readobj/MachODumper.cpp:701
+  std::stable_sort(Libs.begin(), Libs.end());
phosek wrote:
> davide wrote:
> > phosek wrote:
> > > davide wrote:
> > > > Why you need this stable sort?
> > > I have followed the ELF implementation which also uses stable sort, I'm not sure why it's used there.
> > I'd rather not cargo cult this here unless we have a good reason to. We shouldn't need this call, should we?
> I think having a stable output order may be useful in some cases. Also if that's what we're already doing for ELF version, we should probably be consistent across all formats?
I think we should have a stable order of these *regardless*. I'm nervous about adding a call to `std::stable_sort()` unless we have a good reason for it, because it might hide bugs elsewhere in the reader.



More information about the llvm-commits mailing list