Hi!
On Sun, 9 Apr 2017 18:22:00 +0200, Martin Jambor <[email protected]> wrote:
> On Wed, Apr 05, 2017 at 10:11:34AM +0200, Thomas Schwinge wrote:
> > I ran into a case where the libgomp hsa plugin wouldn't load. The
> > following patch helped me to quickly diagnose and then fix that. OK for
> > trunk?
>
> Yes, thanks.
Thanks, now finally, as posted, committed to trunk in r248277:
commit b7d6170b96407c80b3e21dd6a665ebff7715d62e
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri May 19 13:32:04 2017 +0000
libgomp hsa plugin: debug output for HSA runtime library loading failure
libgomp/
* plugin/plugin-hsa.c (DLSYM_FN, init_hsa_runtime_functions):
Debug output for failure.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248277
138bc75d-0d04-0410-961f-82ee72b054a4
---
libgomp/ChangeLog | 5 +++++
libgomp/plugin/plugin-hsa.c | 8 ++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git libgomp/ChangeLog libgomp/ChangeLog
index 083cb85..84d1c839 100644
--- libgomp/ChangeLog
+++ libgomp/ChangeLog
@@ -1,3 +1,8 @@
+2017-05-19 Thomas Schwinge <[email protected]>
+
+ * plugin/plugin-hsa.c (DLSYM_FN, init_hsa_runtime_functions):
+ Debug output for failure.
+
2017-05-12 Rainer Orth <[email protected]>
* testsuite/lib/libgomp.exp: Load scanlang.exp.
diff --git libgomp/plugin/plugin-hsa.c libgomp/plugin/plugin-hsa.c
index 9cc243d..90ca247 100644
--- libgomp/plugin/plugin-hsa.c
+++ libgomp/plugin/plugin-hsa.c
@@ -491,14 +491,14 @@ static struct hsa_context_info hsa_context;
#define DLSYM_FN(function) \
hsa_fns.function##_fn = dlsym (handle, #function); \
if (hsa_fns.function##_fn == NULL) \
- return false;
+ goto dl_fail;
static bool
init_hsa_runtime_functions (void)
{
void *handle = dlopen (hsa_runtime_lib, RTLD_LAZY);
if (handle == NULL)
- return false;
+ goto dl_fail;
DLSYM_FN (hsa_status_string)
DLSYM_FN (hsa_agent_get_info)
@@ -530,6 +530,10 @@ init_hsa_runtime_functions (void)
DLSYM_FN (hsa_ext_program_destroy)
DLSYM_FN (hsa_ext_program_finalize)
return true;
+
+ dl_fail:
+ HSA_DEBUG ("while loading %s: %s\n", hsa_runtime_lib, dlerror ());
+ return false;
}
/* Find kernel for an AGENT by name provided in KERNEL_NAME. */
Grüße
Thomas