src: make sort order deterministic, next try

We cannot compare pointers as they may point to qsort-local objects.
And we must make sure that cmp(a,b) always agrees with cmp(b,a).
This commit is contained in:
Markus F.X.J. Oberhumer
2023-08-30 16:41:59 +02:00
parent f4e5b29708
commit cfa8107ab9
5 changed files with 54 additions and 24 deletions
+1
View File
@@ -119,6 +119,7 @@ struct ElfLinker::Section : private noncopyable {
void *input = nullptr;
byte *output = nullptr;
unsigned size = 0;
unsigned sort_id = 0; // for qsort()
upx_uint64_t offset = 0;
unsigned p2align = 0; // log2
Section *next = nullptr;