================ @@ -0,0 +1,31 @@ +// RUN: %clang_cc1 %s -triple arm64e-apple-ios13 -fptrauth-calls -fptrauth-intrinsics -disable-llvm-passes -emit-llvm -o- | FileCheck %s +// RUN: %clang_cc1 -xc++ %s -triple arm64e-apple-ios13 -fptrauth-calls -fptrauth-intrinsics -disable-llvm-passes -emit-llvm -o- | FileCheck %s --check-prefixes=CHECK,CXX + +#ifdef __cplusplus +extern "C" { +#endif + +void f(void); + +#ifdef __cplusplus + +// CXX-LABEL: define internal void @__cxx_global_var_init() +// CXX: store ptr getelementptr inbounds (i32, ptr ptrauth (ptr @f, i32 0), i64 2), ptr @_ZL2fp, align 8 + +__attribute__((used)) +void (*const fp)(void) = (void (*)(void))((int *)&f + 2); // Error in C mode. ---------------- ahatanak wrote:
In C++, the global constructor can initialize the variable. https://github.com/llvm/llvm-project/pull/93906 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits