Skip to content

Commit c4b032d

Browse files
disable visibility hidden on old gcc (#1167)
1 parent f882188 commit c4b032d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmake/AwsCFlags.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,10 @@ function(aws_set_common_properties target)
257257
# We do this so that backtraces are more likely to show function names.
258258
# We mostly use backtraces to diagnose memory leaks.
259259
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
260-
set_target_properties(${target} PROPERTIES C_VISIBILITY_PRESET hidden CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN ON)
260+
# And dont hide symbols on anything pre GCC 5.0 (Visibility support was not great on older compilers and some libraries didnt annotate visibility -
261+
# looking at you jni, which does not annotate on gcc less than 4.2. Mixing no annotation and hidden symbols leads to unexpected failures.).
262+
if (NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0"))
263+
set_target_properties(${target} PROPERTIES C_VISIBILITY_PRESET hidden CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN ON)
264+
endif ()
261265
endif ()
262266
endfunction()

0 commit comments

Comments
 (0)