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
@@ -329,6 +329,7 @@ ElfLinker::Section *ElfLinker::addSection(const char *sname, const void *sdata,
assert(sname[strlen(sname) - 1] != ':');
assert(findSection(sname, false) == nullptr);
Section *sec = new Section(sname, sdata, slen, p2align);
sec->sort_id = nsections;
sections[nsections++] = sec;
return sec;
}