diff options
author | Matthew Smith <mgsmith@netgate.com> | 2018-09-07 17:14:30 -0500 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-09-11 08:42:47 +0000 |
commit | 0be66e160f480dd325882409bfefdf042dfe6d1c (patch) | |
tree | 4347bd73b153a62647ca1d2470a6461c46a8196c | |
parent | 58f50f1bb64e962e5628e2c1867e07f238036c7b (diff) |
remove libvlib from libvlibmemoryclient libs
On CentOS 7, having libvlibmemoryclient link libvlib causes
a SEGV when a program or library is run which links against
libvlibmemoryclient and dlopen() is called. This is because
dlopen() executes any functions with __attribute((constructor))
set. The VLIB_CLI_COMMAND macro creates CLI registration
functions that have this attribute set. So CLI registration
functions end up being run by applications which are clients
of the VPP API.
This doesn't occur on ubuntu 16.04, because ld seems to
omit shared libraries that were listed on the command line
if they are not used to resolve any symbols.
Removing the link to libvlib on vlibmemoryclient to fix this
problem results in another problem. Tests of libvcl_preload
fail when running 'make test'. This happens because
libvcl_preload calls dlopen but does not link against libdl.
When libvlibmemoryclient had libvlib linked, these errors
did not occur since libvlib links libdl. Adjusted the build
of libvcl_preload to explicitly link libdl.
Change-Id: I271ba2f9226ce1602e1f6c1525f3b093bb0345ed
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
-rw-r--r-- | src/vcl/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/vlibmemory/CMakeLists.txt | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/vcl/CMakeLists.txt b/src/vcl/CMakeLists.txt index e5642b53d5e..ba19ced27a6 100644 --- a/src/vcl/CMakeLists.txt +++ b/src/vcl/CMakeLists.txt @@ -32,7 +32,7 @@ add_vpp_library(vcl_ldpreload ldp.c LINK_LIBRARIES - vppinfra svm vlibmemoryclient rt pthread vppcom + vppinfra svm vlibmemoryclient rt pthread vppcom dl ) add_vpp_headers(vcl diff --git a/src/vlibmemory/CMakeLists.txt b/src/vlibmemory/CMakeLists.txt index ff0d25f6a1b..64fcb2d58fb 100644 --- a/src/vlibmemory/CMakeLists.txt +++ b/src/vlibmemory/CMakeLists.txt @@ -47,6 +47,6 @@ add_vpp_library (vlibmemoryclient ../vlibapi/api_shared.c ../vlibapi/node_serialize.c - LINK_LIBRARIES vppinfra svm vlib + LINK_LIBRARIES vppinfra svm ) add_dependencies(vlibmemoryclient vlibmemory_api_headers) |