@@ -57,7 +57,7 @@ if (ENABLE_CHECK_HEAVY_BUILDS)
5757 # set CPU time limit to 1000 seconds
5858 set (RLIMIT_CPU 1000)
5959
60- # gcc10/gcc10/clang -fsanitize=memory is too heavy
60+ # -fsanitize=memory is too heavy
6161 if (SANITIZE STREQUAL "memory" )
6262 set (RLIMIT_DATA 10000000000) # 10G
6363 endif ()
@@ -170,18 +170,6 @@ else ()
170170 set (NO_WHOLE_ARCHIVE --no -whole-archive)
171171endif ()
172172
173- option (ENABLE_CURL_BUILD "Enable curl, azure, sentry build on by default except MacOS." ON )
174- if (OS_DARWIN)
175- # Disable the curl, azure, senry build on MacOS
176- set (ENABLE_CURL_BUILD OFF )
177- endif ()
178-
179- option (ENABLE_ISAL_LIBRARY "Enable ISA-L library ON by default except on aarch64." ON )
180- if (ARCH_AARCH64)
181- # Disable ISA-L libray on aarch64.
182- set (ENABLE_ISAL_LIBRARY OFF )
183- endif ()
184-
185173if (NOT CMAKE_BUILD_TYPE_UC STREQUAL "RELEASE" )
186174 # Can be lld or ld-lld or lld-13 or /path/to/lld.
187175 if (LINKER_NAME MATCHES "lld" )
@@ -292,7 +280,7 @@ set (CMAKE_C_STANDARD 11)
292280set (CMAKE_C_EXTENSIONS ON ) # required by most contribs written in C
293281set (CMAKE_C_STANDARD_REQUIRED ON )
294282
295- # Compiler-specific coverage flags e.g. -fcoverage-mapping for gcc
283+ # Compiler-specific coverage flags e.g. -fcoverage-mapping
296284option (WITH_COVERAGE "Profile the resulting binary/binaries" OFF )
297285
298286if (COMPILER_CLANG)
@@ -399,9 +387,9 @@ else()
399387endif ()
400388
401389option (ENABLE_GWP_ASAN "Enable Gwp-Asan" ON )
402- # We use mmap for allocations more heavily in debug builds,
403- # but GWP-ASan also wants to use mmap frequently,
404- # and due to a large number of memory mappings,
390+ # We use mmap for allocations more heavily in debug builds,
391+ # but GWP-ASan also wants to use mmap frequently,
392+ # and due to a large number of memory mappings,
405393# it does not work together well.
406394if ((NOT OS_LINUX AND NOT OS_ANDROID) OR (CMAKE_BUILD_TYPE_UC STREQUAL "DEBUG" ))
407395 set (ENABLE_GWP_ASAN OFF )
@@ -534,6 +522,26 @@ include (cmake/print_flags.cmake)
534522
535523if (ENABLE_RUST)
536524 add_subdirectory (rust )
525+
526+ # With LTO Rust adds few symbols with global visiblity, the most common is
527+ # rust_eh_personality. And this leads to linking errors because multiple
528+ # Rust libraries contains the same symbol.
529+ #
530+ # If it was shared library, that we could use version script for linker to
531+ # hide this symbols, but libraries are static.
532+ #
533+ # we could in theory compile everything to one library but this will be a
534+ # mess
535+ #
536+ # But this should be OK since CI has lots of other builds that are done
537+ # without LTO and it will find multiple definitions if there will be any.
538+ #
539+ # More information about this behaviour in Rust can be found here
540+ # - https://github.com/rust-lang/rust/issues/44322
541+ # - https://alanwu.space/post/symbol-hygiene/
542+ if (ENABLE_THINLTO)
543+ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--allow-multiple-definition" )
544+ endif ()
537545endif ()
538546
539547add_subdirectory (base )
0 commit comments