Check dladdr return value (#7061)
author오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Fri, 30 Aug 2019 07:32:17 +0000 (16:32 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Fri, 30 Aug 2019 07:32:17 +0000 (16:32 +0900)
Check dladdr return value and log if fail to load

Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
runtimes/libs/nnapi/v1.1/include/NeuralNetworksLoadHelpers.h
runtimes/libs/nnapi/v1.2/include/NeuralNetworksLoadHelpers.h

index fe9c8e2..201465f 100644 (file)
@@ -113,8 +113,15 @@ inline void* loadFunction(const char* name) {
   else {
 #ifdef _GNU_SOURCE
     Dl_info info;
-    dladdr(fn, &info);
-    NNAPI_LOG("nnapi function '%s' is loaded from '%s' ", name, info.dli_fname);
+    if (dladdr(fn, &info))
+    {
+      NNAPI_LOG("nnapi function '%s' is loaded from '%s' ", name, info.dli_fname);
+    }
+    else
+    {
+      NNAPI_LOG("nnapi function '%s' is failed to load", name);
+    }
+
 #endif // _GNU_SOURCE
   }
   return fn;
index da9ba88..1c482b5 100644 (file)
@@ -111,8 +111,14 @@ inline void* loadFunction(const char* name) {
   else {
 #ifdef _GNU_SOURCE
     Dl_info info;
-    dladdr(fn, &info);
-    NNAPI_LOG("nnapi function '%s' is loaded from '%s' ", name, info.dli_fname);
+    if (dladdr(fn, &info))
+    {
+      NNAPI_LOG("nnapi function '%s' is loaded from '%s' ", name, info.dli_fname);
+    }
+    else
+    {
+      NNAPI_LOG("nnapi function '%s' is failed to load", name);
+    }
 #endif // _GNU_SOURCE
   }
   return fn;