[PATCH] D18402: [AArch64] Better errors for out-of-range fixups

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 22 07:46:32 PST 2017


asb added a comment.

Hi all. Sorry for digging up an old review, but I've been looking at reporting fixup overflow errors for RISC-V, and this seems the most appropriate place to discuss how it's currently handled in AArch64. I agree with @rengolin's concerns with this approach - or at least, I think we can do this better. Right now, adjustFixupValue is always called twice. The second time it's called, the MCContext argument is null and the code relies on the fact that any errors should have been caught the first time round, and so this null pointer will never be dereferenced. I like having error checking alongside the value adjustments, but I propose that instead we achieve this by:

- Adding an MCContext argument to `MCAsmBackend::applyFixup`, and document that this function should report any errors in applying the fixup (should as the value being out of range).. This just requires a simple update to MCAssembler.cpp so it passes the context argument, and of course modifying `FootgtAsmBackend` for all targets to reflect the new argument
- For backends that report errors using `adjustFixupValue`, stop calling it from `processFixupValue` and instead just modify the `applyFixup` implementation to pass an MCContext rather than a nullptr

I just thought I'd quickly check in case I'm missing something obviously wrong with this approach.


Repository:
  rL LLVM

https://reviews.llvm.org/D18402





More information about the llvm-commits mailing list