[clang] [X86] Enhance kCFI type IDs with a 3-bit arity indicator. (PR #117121)

Sebastian Ă–sterlund via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 21 00:45:18 PST 2024


================
@@ -2196,8 +2197,32 @@ llvm::ConstantInt *CodeGenModule::CreateKCFITypeId(QualType T) {
   if (getCodeGenOpts().SanitizeCfiICallNormalizeIntegers)
     Out << ".normalized";
 
-  return llvm::ConstantInt::get(Int32Ty,
-                                static_cast<uint32_t>(llvm::xxHash64(OutName)));
+  uint32_t OutHash = static_cast<uint32_t>(llvm::xxHash64(OutName));
+  const auto &Triple = getTarget().getTriple();
+  if (Triple.isX86() && Triple.isArch64Bit() && Triple.isOSLinux()) {
----------------
sirmc wrote:

-> `if (FnType && Triple.isX86() && Triple.isArch64Bit() && Triple.isOSLinux())`

Just to make sure that FnType isn't a null pointer.

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


More information about the cfe-commits mailing list