From 0627e8dc86edcb8c39693b84d4012b97b7a9753f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 11 Jun 2018 11:59:21 +0300 Subject: [PATCH] Resolve all symbols for routers at link time The routers should not have undefied references. Exceptions to this are the modules that use the maxscale_shutdown() function defined in gateway.cc. --- server/modules/routing/avrorouter/CMakeLists.txt | 6 ++---- server/modules/routing/cat/CMakeLists.txt | 2 +- server/modules/routing/cli/CMakeLists.txt | 1 + server/modules/routing/debugcli/CMakeLists.txt | 2 +- server/modules/routing/hintrouter/CMakeLists.txt | 2 +- server/modules/routing/maxinfo/CMakeLists.txt | 1 + server/modules/routing/readconnroute/CMakeLists.txt | 2 +- server/modules/routing/readwritesplit/CMakeLists.txt | 2 +- server/modules/routing/schemarouter/CMakeLists.txt | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/server/modules/routing/avrorouter/CMakeLists.txt b/server/modules/routing/avrorouter/CMakeLists.txt index bf6b4811b..644fc1208 100644 --- a/server/modules/routing/avrorouter/CMakeLists.txt +++ b/server/modules/routing/avrorouter/CMakeLists.txt @@ -5,15 +5,13 @@ if(AVRO_FOUND AND JANSSON_FOUND) # The common avrorouter functionality add_library(avro-common SHARED avro.cc ../binlogrouter/binlog_common.cc avro_client.cc avro_schema.cc avro_rbr.cc avro_file.cc avro_index.cc avro_converter.cc) - set_target_properties(avro-common PROPERTIES VERSION "1.0.0") - set_target_properties(avro-common PROPERTIES LINK_FLAGS -Wl,-z,defs) + set_target_properties(avro-common PROPERTIES VERSION "1.0.0" LINK_FLAGS -Wl,-z,defs) target_link_libraries(avro-common maxscale-common ${JANSSON_LIBRARIES} ${AVRO_LIBRARIES} maxavro lzma) install_module(avro-common core) # The actual avrorouter implementation add_library(avrorouter SHARED avro_main.cc) - set_target_properties(avrorouter PROPERTIES VERSION "1.0.0") - set_target_properties(avrorouter PROPERTIES LINK_FLAGS -Wl,-z,defs) + set_target_properties(avrorouter PROPERTIES VERSION "1.0.0" LINK_FLAGS -Wl,-z,defs) target_link_libraries(avrorouter avro-common) install_module(avrorouter core) diff --git a/server/modules/routing/cat/CMakeLists.txt b/server/modules/routing/cat/CMakeLists.txt index ca49bd564..2183bc598 100644 --- a/server/modules/routing/cat/CMakeLists.txt +++ b/server/modules/routing/cat/CMakeLists.txt @@ -1,4 +1,4 @@ add_library(cat SHARED cat.cc catsession.cc ../readwritesplit/rwbackend.cc) target_link_libraries(cat maxscale-common mysqlcommon) -set_target_properties(cat PROPERTIES VERSION "1.0.0") +set_target_properties(cat PROPERTIES VERSION "1.0.0" LINK_FLAGS -Wl,-z,defs) install_module(cat experimental) diff --git a/server/modules/routing/cli/CMakeLists.txt b/server/modules/routing/cli/CMakeLists.txt index aeda66272..f6fe940c5 100644 --- a/server/modules/routing/cli/CMakeLists.txt +++ b/server/modules/routing/cli/CMakeLists.txt @@ -1,4 +1,5 @@ add_library(cli SHARED cli.cc ../debugcli/debugcmd.cc) target_link_libraries(cli maxscale-common) set_target_properties(cli PROPERTIES VERSION "1.0.0") +# Can't add `LINK_FLAGS -Wl,-z,defs` as the module uses maxscale_shutdown() which is defined in gateway.cc install_module(cli core) diff --git a/server/modules/routing/debugcli/CMakeLists.txt b/server/modules/routing/debugcli/CMakeLists.txt index 5266d79ee..12ebf1407 100644 --- a/server/modules/routing/debugcli/CMakeLists.txt +++ b/server/modules/routing/debugcli/CMakeLists.txt @@ -1,5 +1,5 @@ add_library(debugcli SHARED debugcli.cc debugcmd.cc) target_link_libraries(debugcli maxscale-common) set_target_properties(debugcli PROPERTIES VERSION "1.1.1") +# Can't add `LINK_FLAGS -Wl,-z,defs` as the module uses maxscale_shutdown() which is defined in gateway.cc install_module(debugcli core) - diff --git a/server/modules/routing/hintrouter/CMakeLists.txt b/server/modules/routing/hintrouter/CMakeLists.txt index b7e9fad85..fd1c8bbca 100644 --- a/server/modules/routing/hintrouter/CMakeLists.txt +++ b/server/modules/routing/hintrouter/CMakeLists.txt @@ -5,5 +5,5 @@ add_library(hintrouter SHARED ) target_link_libraries(hintrouter maxscale-common) -set_target_properties(hintrouter PROPERTIES VERSION "1.0.0") +set_target_properties(hintrouter PROPERTIES VERSION "1.0.0" LINK_FLAGS -Wl,-z,defs) install_module(hintrouter core) diff --git a/server/modules/routing/maxinfo/CMakeLists.txt b/server/modules/routing/maxinfo/CMakeLists.txt index 246b4ae2a..a4aa731c2 100644 --- a/server/modules/routing/maxinfo/CMakeLists.txt +++ b/server/modules/routing/maxinfo/CMakeLists.txt @@ -1,4 +1,5 @@ add_library(maxinfo SHARED maxinfo.cc maxinfo_parse.cc maxinfo_error.cc maxinfo_exec.cc) set_target_properties(maxinfo PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${MAXSCALE_LIBDIR} VERSION "1.0.0") +# Can't add `LINK_FLAGS -Wl,-z,defs` as the module uses maxscale_shutdown() which is defined in gateway.cc target_link_libraries(maxinfo maxscale-common) install_module(maxinfo core) diff --git a/server/modules/routing/readconnroute/CMakeLists.txt b/server/modules/routing/readconnroute/CMakeLists.txt index f60039745..19c9308cf 100644 --- a/server/modules/routing/readconnroute/CMakeLists.txt +++ b/server/modules/routing/readconnroute/CMakeLists.txt @@ -1,4 +1,4 @@ add_library(readconnroute SHARED readconnroute.cc) target_link_libraries(readconnroute maxscale-common) -set_target_properties(readconnroute PROPERTIES VERSION "1.1.0") +set_target_properties(readconnroute PROPERTIES VERSION "1.1.0" LINK_FLAGS -Wl,-z,defs) install_module(readconnroute core) diff --git a/server/modules/routing/readwritesplit/CMakeLists.txt b/server/modules/routing/readwritesplit/CMakeLists.txt index 7e898984f..031633058 100644 --- a/server/modules/routing/readwritesplit/CMakeLists.txt +++ b/server/modules/routing/readwritesplit/CMakeLists.txt @@ -7,5 +7,5 @@ rwsplit_select_backends.cc rwsplit_session_cmd.cc rwbackend.cc) target_link_libraries(readwritesplit maxscale-common mysqlcommon) -set_target_properties(readwritesplit PROPERTIES VERSION "1.0.2") +set_target_properties(readwritesplit PROPERTIES VERSION "1.0.2" LINK_FLAGS -Wl,-z,defs) install_module(readwritesplit core) diff --git a/server/modules/routing/schemarouter/CMakeLists.txt b/server/modules/routing/schemarouter/CMakeLists.txt index 71ec116f1..805a42458 100644 --- a/server/modules/routing/schemarouter/CMakeLists.txt +++ b/server/modules/routing/schemarouter/CMakeLists.txt @@ -1,5 +1,5 @@ add_library(schemarouter SHARED schemarouter.cc schemarouterinstance.cc schemaroutersession.cc shard_map.cc) target_link_libraries(schemarouter maxscale-common mysqlcommon) add_dependencies(schemarouter pcre2) -set_target_properties(schemarouter PROPERTIES VERSION "1.0.0") +set_target_properties(schemarouter PROPERTIES VERSION "1.0.0" LINK_FLAGS -Wl,-z,defs) install_module(schemarouter core)