Description: Link tbbmalloc and its pure C test with the C++ linker driver
 With GCC 15 the openkylin toolchain enables _GLIBCXX_ASSERTIONS by default,
 so libstdc++ headers emit references to std::__glibcxx_assert_fail in the
 C++ sources compiled into the tbbmalloc target. Since the target forces
 LINKER_LANGUAGE C, libtbbmalloc.so is linked with the C driver (no
 libstdc++), the symbol stays unresolved in the shared library, and linking
 any pure C executable (e.g. test_malloc_pure_c) against it fails with
 "undefined reference to std::__glibcxx_assert_fail".
 .
 Link the tbbmalloc target with the C++ driver (LINKER_LANGUAGE CXX) so the
 shared library records a dependency on libstdc++, and link the pure C test
 test_malloc_pure_c with the C++ driver as well.
 Forwarded: https://github.com/uxlfoundation/oneTBB/issues/1735
 Author: tangxiaofeng <tangxiaofeng@kylinos.cn>
 Last-Update: 2026-09-04

--- onetbb-2022.3.0.orig/src/tbbmalloc/CMakeLists.txt
+++ onetbb-2022.3.0/src/tbbmalloc/CMakeLists.txt
@@ -72,7 +72,7 @@ set_target_properties(tbbmalloc PROPERTI
     DEFINE_SYMBOL ""
     VERSION ${TBBMALLOC_BINARY_VERSION}.${TBB_BINARY_MINOR_VERSION}
     SOVERSION ${TBBMALLOC_BINARY_VERSION}
-    LINKER_LANGUAGE C
+    LINKER_LANGUAGE CXX
 )
 
 tbb_handle_ipo(tbbmalloc)
--- onetbb-2022.3.0.orig/test/CMakeLists.txt
+++ onetbb-2022.3.0/test/CMakeLists.txt
@@ -675,6 +675,10 @@ if (TARGET TBB::tbbmalloc)
 
             enable_language(C)
             tbb_add_c_test(SUBDIR tbbmalloc NAME test_malloc_pure_c DEPENDENCIES TBB::tbbmalloc)
+            # Link the pure C test with the C++ driver so that references to
+            # std::__glibcxx_assert_fail (from _GLIBCXX_ASSERTIONS, enabled by
+            # default in the distro toolchain) resolve against libstdc++.
+            set_target_properties(test_malloc_pure_c PROPERTIES LINKER_LANGUAGE CXX)
         endif()
         # ----------------------------------------------------------------------------------------
         # Whitebox testing

