[PATCH] D62620: [llvm-objcopy] Fix SHT_GROUP ordering.
Jake Ehrlich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 30 11:41:49 PDT 2019
jakehehrlich added a comment.
Can we just sort in the layout code instead of sorting everything? Then we don't have to sort at all. I think we've largely been good about making operations stable so order should be maintained if just don't sort.
================
Comment at: llvm/tools/llvm-objcopy/ELF/Object.cpp:1640
void Object::sortSections() {
- // Put all sections in offset order. Maintain the ordering as closely as
- // possible while meeting that demand however.
+ // Use stable_sort to maintain the original ordering as closely as possible.
llvm::stable_sort(Sections, [](const SecPtr &A, const SecPtr &B) {
----------------
MaskRay wrote:
> @jakehehrlich I can't find a use site of `objcopy::elf::Object::Sections` that requires it to be sorted.
>
> I guess we can probably just delete this function and fix the 5 or 6 tests that check the section order.
The layout algorithm assumes that things are sorted by offset so we can't just delete this but we can sort a copy there instead.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62620/new/
https://reviews.llvm.org/D62620
More information about the llvm-commits
mailing list