https://github.com/tru updated https://github.com/llvm/llvm-project/pull/150960

>From f40dea1d635f757d4791c649e94cb18d748837b9 Mon Sep 17 00:00:00 2001
From: Felix Weiglhofer <9267733+fw...@users.noreply.github.com>
Date: Mon, 28 Jul 2025 16:24:54 +0200
Subject: [PATCH] opencl: Ensure printf symbol is not mangled. (#150210)

Fixes #122453.

(cherry picked from commit a22d010002baf761f84d0a8fa5fcaaf6f3b1455f)
---
 clang/lib/Headers/opencl-c-base.h | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Headers/opencl-c-base.h 
b/clang/lib/Headers/opencl-c-base.h
index 2b7f5043e09e4..6206a347852be 100644
--- a/clang/lib/Headers/opencl-c-base.h
+++ b/clang/lib/Headers/opencl-c-base.h
@@ -697,7 +697,16 @@ template <typename _Tp> struct 
__remove_address_space<__constant _Tp> {
 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
 // OpenCL v1.2 s6.12.13, v2.0 s6.13.13 - printf
 
-int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 
2)));
+#ifdef __OPENCL_CPP_VERSION__
+#define CLINKAGE extern "C"
+#else
+#define CLINKAGE
+#endif
+
+CLINKAGE int printf(__constant const char *st, ...)
+    __attribute__((format(printf, 1, 2)));
+
+#undef CLINKAGE
 #endif
 
 #ifdef cl_intel_device_side_avc_motion_estimation

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

Reply via email to