[PATCH rdma-core 2/9] verbs: Do not include dynamic loading in static libraries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jason Gunthorpe <jgg@xxxxxxxxxxxx>

We don't support dlopening providers when statically linked as our
providers all dynamically link to libverbs. dlopening a copy of libibverbs
while the application includes a different version statically is a big
no-no.

Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
---
 libibverbs/dynamic_driver.c | 2 ++
 libibverbs/ibverbs.h        | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/libibverbs/dynamic_driver.c b/libibverbs/dynamic_driver.c
index 7a8f95b9e74f32..7fa4233251af50 100644
--- a/libibverbs/dynamic_driver.c
+++ b/libibverbs/dynamic_driver.c
@@ -31,6 +31,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
+#ifndef _STATIC_LIBRARY_BUILD_
 #define _GNU_SOURCE
 
 #include <dlfcn.h>
@@ -237,3 +238,4 @@ void load_drivers(void)
 		free(name);
 	}
 }
+#endif
diff --git a/libibverbs/ibverbs.h b/libibverbs/ibverbs.h
index 4ff4dc588410e6..5954cea30986a5 100644
--- a/libibverbs/ibverbs.h
+++ b/libibverbs/ibverbs.h
@@ -61,7 +61,14 @@ int ibverbs_get_device_list(struct list_head *list);
 int ibverbs_init(void);
 void ibverbs_device_put(struct ibv_device *dev);
 void ibverbs_device_hold(struct ibv_device *dev);
+
+#ifdef _STATIC_LIBRARY_BUILD_
+static inline void load_drivers(void)
+{
+}
+#else
 void load_drivers(void);
+#endif
 
 struct verbs_ex_private {
 	BITMAP_DECLARE(unsupported_ioctls, VERBS_OPS_NUM);
-- 
2.19.1




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux