[PATCH 139/144] do not dlopen(libpocl.so) without ENABLE_ICD
authorAndreas Beckmann <anbe@debian.org>
Mon, 6 Dec 2021 17:03:05 +0000 (18:03 +0100)
committerAndreas Beckmann <anbe@debian.org>
Fri, 7 Jan 2022 23:55:22 +0000 (23:55 +0000)
Gbp-Pq: Name 0139-do-not-dlopen-libpocl.so-without-ENABLE_ICD.patch

tests/CMakeLists.txt
tests/runtime/test_dlopen.c

index fe8a207ab4bcab1bad8e00da1c238bb2ffa0b268..8b185a65f58e7972331e6823c711f5f1bd34a2ca 100644 (file)
@@ -37,11 +37,15 @@ if(ENABLE_HOST_CPU_DEVICES)
 endif()
 
 #######################################################################
-if (UNIX AND ENABLE_LOADABLE_DRIVERS)
+if(UNIX AND HAVE_DLFCN_H)
 
+if(ENABLE_ICD)
 add_test(NAME pocl_test_dlopen_libpocl COMMAND test_dlopen)
 set_tests_properties("pocl_test_dlopen_libpocl" PROPERTIES LABELS "internal;dlopen;vulkan")
 set_property(TEST "pocl_version_check" APPEND PROPERTY DEPENDS "pocl_test_dlopen_libpocl")
+endif()
+
+if(ENABLE_LOADABLE_DRIVERS)
 
 if(BUILD_BASIC)
   add_test(NAME pocl_test_dlopen_device_basic COMMAND test_dlopen basic)
@@ -85,7 +89,9 @@ if(ENABLE_VULKAN)
   set_property(TEST "pocl_version_check" APPEND PROPERTY DEPENDS "pocl_test_dlopen_device_vulkan")
 endif()
 
-endif ()
+endif()
+
+endif()
 #######################################################################
 
 add_subdirectory("kernel")
index f586c1f4ddaa9c4dafb06f36e16246c8aebcda98..b3b525e144fbc69a02a177c19beb7ebb23339e56 100644 (file)
@@ -43,6 +43,7 @@ main (int argc, char **argv)
               SHLIB_ORIGIN "/../../lib/CL/devices/%s/libpocl-devices-%s.so", argv[1],
               argv[1]);
 
+#ifdef ENABLE_ICD
   void *handle_libpocl = dlopen (libpocl, RTLD_NOW | RTLD_GLOBAL);
   if (!handle_libpocl)
     {
@@ -50,6 +51,7 @@ main (int argc, char **argv)
                libpocl, dlerror ());
       ret = 1;
     }
+#endif
 
   if (ret == 0 && argc > 1)
     {
@@ -64,8 +66,10 @@ main (int argc, char **argv)
         dlclose (handle_device);
     }
 
+#ifdef ENABLE_ICD
   if (handle_libpocl)
     dlclose (handle_libpocl);
+#endif
 
   return ret;
 }