[llvm] [RISCV] Force relocations if initial MCSubtargetInfo contains FeatureRelax (PR #77436)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 9 11:17:14 PST 2024


MaskRay wrote:

This addresses the issue when the initial `MCSubtargetInfo` contains `FeatureRelax`, there is a relaxable instruction in a norelax region, and we want to ensure that the relaxation instruction has an associated relocation (even if no `R_RISCV_RELAX`).

There is another interesting case (probably invalid) when the initial `MCSubtargetInfo` doesn't contain `FeatureRelax` and we have `.option relax` later. Perhaps we can call it invalid as `EF_RISCV_RELAX` is not set. Nevertheless, this isn't a case handled by our previous behavior. To handle the case, we probably should use a per-function approach like `RISCVAsmPrinter::emitDirectiveOptionArch`, but we don't have access to MCAsmBackend there.

https://github.com/llvm/llvm-project/pull/77436


More information about the llvm-commits mailing list