diff --git a/cmake/ctest.cmake b/cmake/ctest.cmake index 5bc1ce5f8320d..03ead796ea0ed 100644 --- a/cmake/ctest.cmake +++ b/cmake/ctest.cmake @@ -17,6 +17,7 @@ MACRO(MY_ADD_TESTS) FOREACH(name ${ARG_UNPARSED_ARGUMENTS}) ADD_EXECUTABLE(${name}-t "${name}-t.${ARG_EXT}") + SET_TARGET_PROPERTIES(${name}-t PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF) TARGET_LINK_LIBRARIES(${name}-t mytap ${ARG_LINK_LIBRARIES}) MY_ADD_TEST(${name}) ENDFOREACH() diff --git a/configure.cmake b/configure.cmake index 7d345645b85d4..08c6a6f09204a 100644 --- a/configure.cmake +++ b/configure.cmake @@ -22,7 +22,7 @@ INCLUDE (CheckFunctionExists) INCLUDE (CheckCCompilerFlag) INCLUDE (CheckCSourceRuns) INCLUDE (CheckSymbolExists) - +INCLUDE (CheckIPOSupported) # WITH_PIC options.Not of much use, PIC is taken care of on platforms # where it makes sense anyway. @@ -41,7 +41,12 @@ IF(UNIX) ENDIF() ENDIF() - +# With INTERPROCEDURAL OPTMIZATION +CHECK_IPO_SUPPORTED(RESULT IPO_SUPPORTED LANGUAGES C CXX) +IF(IPO_SUPPORTED) + SET(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) +ENDIF() +ADD_FEATURE_INFO(INTERPROCEDURAL_OPTIMIZATION IPO_SUPPORTED "Support Interprocedural Optmization (LTO)") # System type affects version_compile_os variable IF(NOT SYSTEM_TYPE) diff --git a/plugin/metadata_lock_info/CMakeLists.txt b/plugin/metadata_lock_info/CMakeLists.txt index 6b1f5108bf18d..842f0df711450 100644 --- a/plugin/metadata_lock_info/CMakeLists.txt +++ b/plugin/metadata_lock_info/CMakeLists.txt @@ -1,3 +1,6 @@ SET(METADATA_LOCK_INFO_SOURCES metadata_lock_info.cc) MYSQL_ADD_PLUGIN(metadata_lock_info ${METADATA_LOCK_INFO_SOURCES} RECOMPILE_FOR_EMBEDDED) + +# mdl elements need extern defination +SET_TARGET_PROPERTIES(metadata_lock_info PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF) diff --git a/sql/mdl.h b/sql/mdl.h index fad81ce9249d8..3c38c7bc83a34 100644 --- a/sql/mdl.h +++ b/sql/mdl.h @@ -1100,7 +1100,7 @@ class MDL_context MDL_context &operator=(MDL_context &rhs); /* not implemented */ /* metadata_lock_info plugin */ - friend int i_s_metadata_lock_info_fill_row(MDL_ticket*, void*); + friend int i_s_metadata_lock_info_fill_row(MDL_ticket*, void*, bool); #ifndef DBUG_OFF public: /** diff --git a/sql/set_var.h b/sql/set_var.h index c8da3c1c1697a..6c9ee3dcaf087 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -463,7 +463,7 @@ inline bool IS_SYSVAR_AUTOSIZE(void *ptr) bool fix_delay_key_write(sys_var *self, THD *thd, enum_var_type type); sql_mode_t expand_sql_mode(sql_mode_t sql_mode); -const char *sql_mode_string_representation(uint bit_number); +const char *sql_mode_string_representation_for_bit(uint bit_number); bool sql_mode_string_representation(THD *thd, sql_mode_t sql_mode, LEX_CSTRING *ls); int default_regex_flags_pcre(THD *thd); diff --git a/sql/sql_mode.cc b/sql/sql_mode.cc index 6e62fa8fa24cc..90a8b5c54f984 100644 --- a/sql/sql_mode.cc +++ b/sql/sql_mode.cc @@ -28,7 +28,7 @@ void Sql_mode_dependency::push_dependency_warnings(THD *thd) const push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, "Expression depends on the @@%s value %s", - "sql_mode", sql_mode_string_representation(i)); + "sql_mode", sql_mode_string_representation_for_bit(i)); } } } diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index cb35386f883c5..33951e34f1b8e 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -3766,7 +3766,7 @@ static const char *sql_mode_names[]= }; -const char *sql_mode_string_representation(uint bit_number) +const char *sql_mode_string_representation_for_bit(uint bit_number) { DBUG_ASSERT(bit_number < array_elements(sql_mode_names)); return sql_mode_names[bit_number]; diff --git a/storage/archive/CMakeLists.txt b/storage/archive/CMakeLists.txt index 5c7b6aa4aab19..f7a88ffb10a77 100644 --- a/storage/archive/CMakeLists.txt +++ b/storage/archive/CMakeLists.txt @@ -16,3 +16,7 @@ SET(ARCHIVE_SOURCES azio.c ha_archive.cc ha_archive.h) MYSQL_ADD_PLUGIN(archive ${ARCHIVE_SOURCES} STORAGE_ENGINE LINK_LIBRARIES ${ZLIB_LIBRARIES}) + + +# Unresolved symbols need be extern +SET_TARGET_PROPERTIES(archive PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF) diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index 31f7d2eb9e51b..a84ff98b292c8 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -413,6 +413,8 @@ IF(NOT TARGET connect) RETURN() ENDIF() +SET_TARGET_PROPERTIES(connect PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF) + IF(MSVC AND (CMAKE_CXX_FLAGS MATCHES "/MP")) # domdoc.cpp uses compiler directive #import which is not compatible # with the /MP option, resulting in compiler error C2813. diff --git a/storage/example/CMakeLists.txt b/storage/example/CMakeLists.txt index 5b59d1b1118db..4414decc243f6 100644 --- a/storage/example/CMakeLists.txt +++ b/storage/example/CMakeLists.txt @@ -15,3 +15,6 @@ SET(EXAMPLE_SOURCES ha_example.cc) MYSQL_ADD_PLUGIN(example ${EXAMPLE_SOURCES} STORAGE_ENGINE MODULE_ONLY COMPONENT Test) + +# Unresolved symbols need be extern - same list as ha_test_sql_discover +SET_TARGET_PROPERTIES(example PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF) diff --git a/storage/perfschema/unittest/pfs_server_stubs.cc b/storage/perfschema/unittest/pfs_server_stubs.cc index 1ec84c2538efb..82b0ad3b18c30 100644 --- a/storage/perfschema/unittest/pfs_server_stubs.cc +++ b/storage/perfschema/unittest/pfs_server_stubs.cc @@ -50,7 +50,7 @@ void sql_print_warning(const char *format, ...) /* Do not pollute the unit test output with annoying messages. */ } -class sys_var { public: enum where { AUTO }; }; +class sys_var { public: enum where { CONFIG, COMMAND_LINE, AUTO, SQL, COMPILE_TIME, ENV }; }; void set_sys_var_value_origin(void *, enum sys_var::where, const char *) { } diff --git a/storage/test_sql_discovery/CMakeLists.txt b/storage/test_sql_discovery/CMakeLists.txt index 2039b08123c54..4eff5383a085a 100644 --- a/storage/test_sql_discovery/CMakeLists.txt +++ b/storage/test_sql_discovery/CMakeLists.txt @@ -1,2 +1,6 @@ MYSQL_ADD_PLUGIN(test_sql_discovery test_sql_discovery.cc STORAGE_ENGINE COMPONENT Test) + +# missing symbols needs to be defined as extern? +SET_TARGET_PROPERTIES(test_sql_discovery PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF) + diff --git a/unittest/strings/strings-t.c b/unittest/strings/strings-t.c index 0e3b97c261c5a..5859e11021e0a 100644 --- a/unittest/strings/strings-t.c +++ b/unittest/strings/strings-t.c @@ -1545,6 +1545,9 @@ test_strnncollsp_char() return failed; } +static void my_init() {}; +static int my_end(int infoflag) { return 0; }; +static const char *my_progname= NULL; int main(int ac, char **av) {