[PATCH] D122236: [RISCV] Fix crash for initial section alignment with .option norvc
Luís Marques via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 6 04:11:23 PDT 2022
luismarques added a comment.
> This patch makes sense to me and I think it is a correct fix.
> In LLVM MC, the `STI`'s feature bits is not mutable, it was determined by the command line before parsing the file. And to deal with directives like `.option rvc`, the Parser maintains an `STI` and replaces it with a new `STI` when the subtarget extensions were enabled or disabled. So we need to use `MCAlignFragment`'s `STI` which is generated using the replaced `STI` by the parser. Is my understanding correct?
I wouldn't focus too much on it being mutable or not. I think the important point is that because we aren't doing everything in a single pass we need to track the state of the flags at various points in the assembly file. Which we do, but apparently we weren't then using the saved state for those locations, just the global state. Being mutable (and not copying it) would only help if we were doing everything in a single pass. At least that was my interpretation of the issue. Sorry to nitpick your explanation, I just wanted to clarify that point :) Broadly speaking I would say your explanation is correct.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122236/new/
https://reviews.llvm.org/D122236
More information about the llvm-commits
mailing list