Various fixes for Solaris compiler.

Also, restrict symbol visibility in statically
built plugins, to minimize the chance for symbol 
name clashes with dynamic plugins.
This commit is contained in:
Vladislav Vaintroub 2012-02-03 11:46:40 +01:00
parent 15f20663db
commit 24e7faa54f
8 changed files with 32 additions and 13 deletions

View File

@ -305,16 +305,27 @@ FUNCTION(GET_DEPENDEND_OS_LIBS target result)
ENDFUNCTION()
MACRO(RESTRICT_SYMBOL_EXPORTS target)
SET(VISIBILITY_HIDDEN_FLAG)
IF(CMAKE_COMPILER_IS_GNUCXX AND UNIX)
CHECK_C_COMPILER_FLAG("-fvisibility=hidden" HAVE_VISIBILITY_HIDDEN)
IF(HAVE_VISIBILITY_HIDDEN)
SET(VISIBILITY_HIDDEN_FLAG "-fvisibility=hidden")
ENDIF()
ENDIF()
IF(CMAKE_C_COMPILER_ID MATCHES "SunPro")
SET(VISIBILITY_HIDDEN_FLAG "-xldscope=hidden")
ENDIF()
IF(VISIBILITY_HIDDEN_FLAG)
GET_TARGET_PROPERTY(COMPILE_FLAGS ${target} COMPILE_FLAGS)
IF(NOT COMPILE_FLAGS)
# Avoid COMPILE_FLAGS-NOTFOUND
SET(COMPILE_FLAGS)
ENDIF()
SET_TARGET_PROPERTIES(${target} PROPERTIES
COMPILE_FLAGS "${COMPILE_FLAGS} -fvisibility=hidden")
ENDIF()
COMPILE_FLAGS "${COMPILE_FLAGS} ${VISIBILITY_HIDDEN_FLAG}")
ENDIF()
ENDMACRO()

View File

@ -93,3 +93,8 @@ IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SIZEOF_VOID_P EQUAL 4
ENDIF()
ENDIF()
ENDIF()
IF(CMAKE_CXX_COMPILER_ID MATCHES "SunPro")
# Unnamed structs and unions
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -features=extensions")
ENDIF()

View File

@ -136,6 +136,7 @@ MACRO(MYSQL_ADD_PLUGIN)
SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_DEFINITONS "MYSQL_SERVER")
DTRACE_INSTRUMENT(${target})
ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES})
RESTRICT_SYMBOL_EXPORTS(${target})
IF(WITH_EMBEDDED_SERVER)
# Embedded library should contain PIC code and be linkable
# to shared libraries (on systems that need PIC)

View File

@ -279,7 +279,7 @@ public:
};
void advance_sj_state(JOIN *join, const table_map remaining_tables, uint idx,
extern void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx,
double *current_record_count, double *current_read_time,
POSITION *loose_scan_pos);
void restore_prev_sj_state(const table_map remaining_tables,

View File

@ -550,7 +550,7 @@ public:
BNL_JOIN_ALG, /* Block Nested Loop Join algorithm */
BNLH_JOIN_ALG, /* Block Nested Loop Hash Join algorithm */
BKA_JOIN_ALG, /* Batched Key Access Join algorithm */
BKAH_JOIN_ALG, /* Batched Key Access with Hash Table Join Algorithm */
BKAH_JOIN_ALG /* Batched Key Access with Hash Table Join Algorithm */
};
/*

View File

@ -1688,7 +1688,7 @@ void optimize_wo_join_buffering(JOIN *join, uint first_tab, uint last_tab,
double *outer_rec_count, double *reopt_cost);
Item_equal *find_item_equal(COND_EQUAL *cond_equal, Field *field,
bool *inherited_fl);
bool test_if_ref(COND *root_cond,
extern bool test_if_ref(Item *,
Item_field *left_item,Item *right_item);
inline bool optimizer_flag(THD *thd, uint flag)

View File

@ -254,8 +254,10 @@ ENDIF()
# On solaris, reduce symbol visibility, so loader does not mix
# the same symbols from builtin innodb and from shared one
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_COMPILER_IS_GNUCC)
# the same symbols from builtin innodb and from shared one.
# Only required for old GCC (3.4.3) that does not support hidden visibility
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_COMPILER_IS_GNUCC
AND NOT HAVE_VISIBILITY_HIDDEN)
SET(LINKER_SCRIPT "-Wl,-M${CMAKE_CURRENT_SOURCE_DIR}/plugin_exports")
ELSE()
SET(LINKER_SCRIPT)

View File

@ -57,7 +57,7 @@ Created 11/5/1995 Heikki Tuuri
/* prototypes for new functions added to ha_innodb.cc */
trx_t* innobase_get_trx();
inline void _increment_page_get_statistics(buf_block_t* block, trx_t* trx)
static inline void _increment_page_get_statistics(buf_block_t* block, trx_t* trx)
{
ulint block_hash;
ulint block_hash_byte;