[Openmp-commits] [openmp] [OpenMP] Improve dladdr error handling in ompd_init() (PR #201043)

via Openmp-commits openmp-commits at lists.llvm.org
Mon Jun 8 05:47:19 PDT 2026


================
@@ -87,8 +87,10 @@ void ompd_init() {
   Dl_info dl_info;
   int ret = dladdr((void *)ompd_init, &dl_info);
   if (!ret) {
-    fprintf(stderr, "%s\n", dlerror());
-  } else if (strrchr(dl_info.dli_fname, '/')) {
+    const char *err = dlerror();
+    if (err)
+      fprintf(stderr, "dladdr failed in ompd_init: %s\n", err);
----------------
jprotze wrote:

Given that this code is only ever executed, if `OMP_DEBUG` is enabled, it would be more useful to tell the user what to do in this case: "The OpenMP runtime could not determine the location of libompd.so. If the debugger fails to load the library, make sure to add the directory containing a compatible libompd.so to your LD_LIBRARY_PATH"

https://github.com/llvm/llvm-project/pull/201043


More information about the Openmp-commits mailing list