The intended behavior on a too-large relative branch is an assembler crash.
We don't need to do the right thing, because the only branch that can't
be relaxed is J[ER]CXZ, and only hand-written code uses that.
Details
- Reviewers
niravd
Diff Detail
- Build Status
Buildable 541 Build 541: arc lint + arc unit
Event Timeline
Are you sure about the summary? An assert on user-input is never the intended behavior.
We can change it from an assert to report_fatal_error, but we can't actually distinguish at this point whether it was in fact a user error versus whether it was an internal bug.
I guess I agree that dumping core is a bit sad for the user error case. Would you prefer it always to say this instead?
clang -cc1as: fatal error: error in backend: Value does not fit in fixup
Yeah, that's better. Can we easily get at least the section as well? I really hate having to debug instances like this by running gdb :)
it looks like we need an MCAssembler on which to call getContext() and then Ctx->reportError(Fixup.getLoc(), "mumble").
Some of the other AsmBackends have started to have this plumbing added in.
However most of them actually guard the emission of the message with "if (Ctx)" because we usually don't have the context apparently, so you really can't get a nice source location anyway.
Without this change, we'll silently emit bogus code, so I think we should land it as-is, but do change it from assert to report_fatal_error. Are you ok with that?
this changes harms the .byte,.short, etc assembler directives. niravd will take a look