Skip to content

Commit

Permalink
Use -Wl,-z,ignore on illumos.
Browse files Browse the repository at this point in the history
  • Loading branch information
levlam committed Apr 29, 2021
1 parent f00d562 commit 3007094
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
9 changes: 3 additions & 6 deletions CMake/TdSetUpCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ function(td_set_up_compiler)
message(FATAL_ERROR "No C++14 support in the compiler. Please upgrade the compiler.")
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")

if (MSVC)
if (CMAKE_CXX_FLAGS_DEBUG MATCHES "/RTC1")
string(REPLACE "/RTC1" " " CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
Expand All @@ -60,7 +55,9 @@ function(td_set_up_compiler)
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections")
if (NOT ILLUMOS)
if (ILLUMOS)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,ignore")
else()
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL")
endif()
endif()
Expand Down
15 changes: 7 additions & 8 deletions CMake/illumos.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
if (CMAKE_SYSTEM_NAME STREQUAL "SunOS")
#
# Determine if the host is running an illumos distribution:
#
execute_process(COMMAND /usr/bin/uname -o OUTPUT_VARIABLE UNAME_O
OUTPUT_STRIP_TRAILING_WHITESPACE)
#
# Determine if the host is running an illumos distribution:
#
execute_process(COMMAND /usr/bin/uname -o OUTPUT_VARIABLE UNAME_O OUTPUT_STRIP_TRAILING_WHITESPACE)

if (UNAME_O STREQUAL "illumos")
set(ILLUMOS 1)
endif()
if (UNAME_O STREQUAL "illumos")
set(ILLUMOS 1)
endif()
endif()
2 changes: 1 addition & 1 deletion tdutils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ if (ANDROID)
target_link_libraries(tdutils PRIVATE log)
endif()

if (CMAKE_HOST_SYSTEM_NAME MATCHES "NetBSD")
if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
target_link_libraries(tdutils PUBLIC /usr/pkg/gcc5/i486--netbsdelf/lib/libatomic.so)
endif()

Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if (NOT CMAKE_CROSSCOMPILING OR EMSCRIPTEN)
add_executable(test-tdutils EXCLUDE_FROM_ALL ${TESTS_MAIN} ${TDUTILS_TEST_SOURCE})
add_executable(test-online EXCLUDE_FROM_ALL online.cpp)
add_executable(run_all_tests ${TESTS_MAIN} ${TD_TEST_SOURCE})
if (CLANG AND NOT CYGWIN AND NOT EMSCRIPTEN AND NOT (CMAKE_HOST_SYSTEM_NAME MATCHES "OpenBSD") AND NOT (CMAKE_SIZEOF_VOID_P EQUAL 4))
if (CLANG AND NOT CYGWIN AND NOT EMSCRIPTEN AND NOT (CMAKE_SYSTEM_NAME MATCHES "OpenBSD") AND NOT (CMAKE_SIZEOF_VOID_P EQUAL 4))
target_compile_options(test-tdutils PUBLIC -fsanitize=undefined -fno-sanitize=vptr)
target_compile_options(run_all_tests PUBLIC -fsanitize=undefined -fno-sanitize=vptr)
target_compile_options(test-online PUBLIC -fsanitize=undefined -fno-sanitize=vptr)
Expand Down

0 comments on commit 3007094

Please sign in to comment.