[PATCH] D122490: [RISCV] Generate EF_RISCV_RVC when .option rvc

Kito Cheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 09:06:25 PDT 2022


kito-cheng added a comment.

@luismarques I didn't read all comment before the sync-up meeting, so I guess I miss the context where you already discussed here, I agree the behavior is kind of weird for `.option rvc`, that will setting `EF_RISCV_RVC` if `.option rvc` is appeared in file no matter `.option norvc` is here or not.

And that's also cause some problem on the linker relaxation side, as @StephenFan mention, psABI spec say: "When linking objects which specify EF_RISCV_RVC, the linker is permitted to use RVC instructions such as C.JAL in the relaxation process", so according the definition if user just want to a specific region having c extension, oh, that corrupt whole file, linker might create C instruction in the file other than the specific region, although the most usage is disable C extension for specific region for now, but that might break that.

So I would suggest LLVM *DO NOT* follow this behavior and gonna to deprecate `.option rvc`/`.option norvc`, and recommend user using `.option arch, +c`/`.option arch, -c` instead.

But I guess the problem is we didn't have `.option arch, +c` implementation for LLVM, and also we didn't merge the PR[1] in riscv-asm-manual yet.

@StephenFan do you or other PLCT folks could help on implement that for LLVM?

@luismarques @asb did you help to review  ``.option arch,` stuffs, I think we could push that forward together :)

[1] https://github.com/riscv-non-isa/riscv-asm-manual/pull/67


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122490/new/

https://reviews.llvm.org/D122490



More information about the llvm-commits mailing list