src: make sort order deterministic
This commit is contained in:
parent
d65fea1147
commit
f4e5b29708
@ -575,7 +575,7 @@ PackMachBase<T>::compare_segment_command(void const *const aa, void const *const
|
||||
if (a->vmsize) return -1; // 'a' is first
|
||||
if (b->vmsize) return 1; // 'a' is last
|
||||
// What could remain?
|
||||
return 0;
|
||||
return aa < bb ? -1 : 1; // make sort order deterministic/stable
|
||||
}
|
||||
|
||||
// At 2013-02-03 part of the source for codesign was
|
||||
|
||||
@ -98,7 +98,8 @@ PackVmlinuxBase<T>::compare_Phdr(void const *aa, void const *bb)
|
||||
if (xa > xb) return 1;
|
||||
if (a->p_paddr < b->p_paddr) return -1; // ascending by .p_paddr
|
||||
if (a->p_paddr > b->p_paddr) return 1;
|
||||
return 0;
|
||||
// What could remain?
|
||||
return aa < bb ? -1 : 1; // make sort order deterministic/stable
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
||||
@ -703,6 +703,7 @@ class PeFile::ImportLinker final : public ElfLinkerAMD64 {
|
||||
int rc = strcmp(s1->name, s2->name);
|
||||
if (rc != 0)
|
||||
return rc;
|
||||
// What could remain?
|
||||
return p1 < p2 ? -1 : 1; // make sort order deterministic/stable
|
||||
}
|
||||
|
||||
@ -893,6 +894,7 @@ unsigned PeFile::processImports0(ord_mask_t ord_mask) // pass 1
|
||||
return rc;
|
||||
} else if ((u1->shname != nullptr) != (u2->shname != nullptr))
|
||||
return (u1->shname != nullptr) ? -1 : 1;
|
||||
// What could remain?
|
||||
return p1 < p2 ? -1 : 1; // make sort order deterministic/stable
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user