[PATCH] D70692: IRGen: Call SetLLVMFunctionAttributes{, ForDefinition} on __cfi_check_fail.

Peter Collingbourne via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 25 15:24:12 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rG90b8bc003caa: IRGen: Call SetLLVMFunctionAttributes{,ForDefinition} on __cfi_check_fail. (authored by pcc).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70692

Files:
  clang/lib/CodeGen/CGExpr.cpp
  clang/test/CodeGen/cfi-check-fail-attrs.c


Index: clang/test/CodeGen/cfi-check-fail-attrs.c
===================================================================
--- /dev/null
+++ clang/test/CodeGen/cfi-check-fail-attrs.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -triple aarch64-unknown-linux -fsanitize-cfi-cross-dso -target-feature +reserve-x18 -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: define weak_odr hidden void @__cfi_check_fail{{.*}} [[ATTR:#[0-9]*]]
+
+// CHECK: attributes [[ATTR]] = {{.*}} "target-features"="+reserve-x18"
Index: clang/lib/CodeGen/CGExpr.cpp
===================================================================
--- clang/lib/CodeGen/CGExpr.cpp
+++ clang/lib/CodeGen/CGExpr.cpp
@@ -3200,6 +3200,9 @@
   llvm::Function *F = llvm::Function::Create(
       llvm::FunctionType::get(VoidTy, {VoidPtrTy, VoidPtrTy}, false),
       llvm::GlobalValue::WeakODRLinkage, "__cfi_check_fail", &CGM.getModule());
+
+  CGM.SetLLVMFunctionAttributes(GlobalDecl(), FI, F);
+  CGM.SetLLVMFunctionAttributesForDefinition(nullptr, F);
   F->setVisibility(llvm::GlobalValue::HiddenVisibility);
 
   StartFunction(GlobalDecl(), CGM.getContext().VoidTy, F, FI, Args,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70692.230980.patch
Type: text/x-patch
Size: 1124 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191125/06ff34ea/attachment-0001.bin>


More information about the cfe-commits mailing list