Intel Control-flow Enforcement Technology (CET) provides new instructions endbr32/64 for the indirect branch control. They are NOPs on i686 and new targets. We need to check for that in case it crashes on older targets.
Fixes #58737
Differential D137317
[X86][CET] Add Diags for targets pre to i686 for `-fcf-protection` pengfei on Nov 3 2022, 12:55 AM. Authored by
Details Intel Control-flow Enforcement Technology (CET) provides new instructions endbr32/64 for the indirect branch control. They are NOPs on i686 and new targets. We need to check for that in case it crashes on older targets. Fixes #58737
Diff Detail
Event TimelineComment Actions Seems fine, though looking at llvm::X86::CPUKind, why do you choose llvm::X86::CK_PentiumPro as the lower bounds? Surely llvm::X86::CK_Pentium2 doesn't support CET? Does the backend already have an equivalent CPU target check that could be reused by clang? Comment Actions My understanding was that the CET encodings reuse some encodings that have been equivalent to multibyte NOPs since PentiumPro. I think the intent was that a CET mitigated binary would still run on a CPU that didn't support CET. Comment Actions Makes sense; consider adding that additional information as context to the commit message @pengfei . |