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

Jan André Reuter via Openmp-commits openmp-commits at lists.llvm.org
Tue Jun 2 02:19:59 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);
----------------
Thyre wrote:

Absolutely agreed on not printing `(null)`.
I thought about just having `dladdr failed in ompd_init`, but did not know about the static case. 
With this, I think not printing any warning is just fine.

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


More information about the Openmp-commits mailing list