mirror of
https://github.com/ziglang/zig.git
synced 2024-11-14 16:13:24 +00:00
use unstable sort in relocatable writeSyntheticSections
unstable sort is always better if you have no ties
This commit is contained in:
parent
336466c9df
commit
3deb9ab30a
@ -382,11 +382,12 @@ fn writeSyntheticSections(elf_file: *Elf) !void {
|
||||
const SortRelocs = struct {
|
||||
pub fn lessThan(ctx: void, lhs: elf.Elf64_Rela, rhs: elf.Elf64_Rela) bool {
|
||||
_ = ctx;
|
||||
assert(lhs.r_offset != rhs.r_offset);
|
||||
return lhs.r_offset < rhs.r_offset;
|
||||
}
|
||||
};
|
||||
|
||||
mem.sort(elf.Elf64_Rela, relocs.items, {}, SortRelocs.lessThan);
|
||||
mem.sortUnstable(elf.Elf64_Rela, relocs.items, {}, SortRelocs.lessThan);
|
||||
|
||||
log.debug("writing {s} from 0x{x} to 0x{x}", .{
|
||||
elf_file.getShString(shdr.sh_name),
|
||||
|
Loading…
Reference in New Issue
Block a user