Closed bjorn3 closed 4 months ago
This probably should be treated as a breaking change. What do you think about trying to avoid that by detecting if it needs to be reversed? Too magical?
let need_reverse = |relocs: &[Relocation]| {
let Some(first) = relocs.first() else { return false; };
let Some(last) = relocs.last() else { return false; };
first.offset < last.offset
};
if need_reverse(§ion.relocations) {
for reloc in section.relocations.iter().rev() {
write_reloc(reloc)?;
}
} else {
for reloc in §ion.relocations {
write_reloc(reloc)?;
}
}
Also, out of interest, I checked that just swapping the ARM64_RELOC_GOT_LOAD_PAGE21
/ ARM64_RELOC_GOT_LOAD_PAGEOFF12
pairs is enough for the cg_clif tests to pass. I think it is safer to reverse everything though.
Too magical?
Maybe? I applied your suggestion anyway.
Would it be possible to get a patch release for this? That would allow me to fix cg_clif on arm64 macOS quicker as I wouldn't need to get a Cranelift PR for bumping the object version merged and wait a couple of weeks for the next Cranelift release.
Yes, I'll do a release tomorrow.
Released 0.36.1
This prevents a crash of Apple's new linker.