[clang] [llvm] [RISCV][Zicfilp] Enable Zicfilp CFI compiler behaviors by looking at module flags (PR #152121)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 4 10:25:55 PST 2025


topperc wrote:

> Whether modeling per-Module behavior with TM.STI is not suitable, since TM.STI is never intended to be in sync with and serve only one specific Module?

TM.STI is set based on what arguments are passed to the -mcpu and -mattr `cl::opt` in LLVM. clang does not always set these in the LTO step of an LTO build. If it does set them it would only be based on the command line of the LTO command not based on the individual Modules that are part of the LTO build. This means different Modules in the LTO build could have been built with different CFI settings and the attributes on their individual functions would be different.

If all the Modules in the LTO build need to have the same CFI setting, I think it needs to be a Module flag. That's what we use for target-abi for example.

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


More information about the llvm-commits mailing list