If we can't handle a relocation type, report it as an error in the source, rather than asserting. I've added a more descriptive message and a test for the only case of this that I've been able to trigger.
Details
Diff Detail
Event Timeline
Hi Oliver,
I think this is a great idea, but there are too many new error messages and too few new tests. Can you add a test each?
cheers,
--renato
I haven't been able to trigger any of the others, as they are checked when the fixups are created (and we don't have the .reloc directive on AArch64 to create arbitrary fixups). The .byte directive is the only way I know of to trigger this at the moment.
Have you tried creating a few instructions with invalid ranges? I understand that this may break other things in the back-end before it gets to that part.
But following the adr example, you may find a way to break movz/movk or at least some load/store ones.
The ADR and MOVK/Z fixups are quite accurately checked during operand parsing, but I have managed to find a few cases where invalid ldr/str immediates get through to here.
This function only checks the type of relocation, not the range. I've found some cases where out-of-range relocations hit report_fatal_error in adjustFixupValue, but that's a separate issue (that I'll look at next).