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

luxufan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 28 19:42:36 PDT 2022


StephenFan added a comment.
Herald added a subscriber: sunshaoce.

In D122490#3410911 <https://reviews.llvm.org/D122490#3410911>, @luismarques wrote:

> What about the attributes? I thought that the attributes were basically a more flexible and extensible version of the `Flags`. But with this behavior we get RVC in `Flags` but not in `Tag_RISCV_arch`. That seems a bit confusing and maybe error-prone, although it does also match the GNU behavior.

Yeah, the attributes were missing in this patch. I will update it.

> I'm not even sure in what cases this matters. `Flags` is documented as being "used by the linker to disallow linking ELF files with incompatible ABIs together" but C and non-C are always compatible with each other, assuming the target does support C.

RISC-V psabi says "When linking objects which specify EF_RISCV_RVC, the linker is permitted to use RVC instructions such as C.JAL in the relaxation process".

> To be clear, if no one else has any opinion about this I think I'd still be in favor of merging this, as we would match the GNU tools and I don't see much downside, but this seems like a weird and non-ideal corner case, whichever way we slice it.

I am still confused about when do we need the `RVC` flag ? For example, if we have both `.option rvc` and `option norvc` in an assembly file, should `RVC` flag be emitted ? Or if we use command line `-mattr=+c` to assemble file, but `option norvc` is specified in assembly file, should `RVC` flag be emitted ?


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