MaskRay added a comment.

> OK, so we could just not make the symbols weak and end up failing at link 
> time if there's a mismatch. That sounds reasonable to me.

For `STB_WEAK SHN_ABS` `__kcfi_typeid_*`, there is no duplicate definition 
error. Is this behavior intentional?
Note: I don't think we should change lld to recognize some symbol prefix and 
enforce more rigid diagnostics.
An error must be implemented with existing ELF features.



================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:2273-2275
+    std::string Name = "__kcfi_typeid_" + F.getName().str();
+    if (!allowKCFIIdentifier(Name))
+      continue;
----------------
nickdesaulniers wrote:
> You could probably avoid re-checking `"__kcfi_typeid_"` repeatedly?
```
if (const llvm::MDNode *MD = F.getMetadata(llvm::LLVMContext::MD_kcfi_type))
  Type = ...
else
  continue;
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119296/new/

https://reviews.llvm.org/D119296

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to