diff --git a/CMakeLists.txt b/CMakeLists.txt index c62c560..ee3dfcb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,8 +159,6 @@ function(give_options_without_warnings target) -O3 -flto=$,thin,auto> -mavx -mavx2 - -fdata-sections - -ffunction-sections -funroll-loops -fomit-frame-pointer $<$:-s>) @@ -173,6 +171,10 @@ function(give_options_without_warnings target) $<$:-fstack-protector-all -fsanitize=undefined -fsanitize=address> $<$:-gsource-map>) + set(LINK_FLAGS_RELEASE + $<$:-Wl,--strip-all> + ${BUILD_FLAGS_RELEASE}) + if (CMAKE_C_COMPILER_LINKER_ID MATCHES GNU OR CMAKE_C_COMPILER_LINKER_ID MATCHES GNUgold) set(THINLTO_USAGE "-plugin-opt,") endif() @@ -194,7 +196,7 @@ function(give_options_without_warnings target) target_link_options(${target} PUBLIC ${BUILD_FLAGS} # -Wl,--no-undefined # TODO: use later for implementing no-libc - $<$:${BUILD_FLAGS_RELEASE}> + $<$:${LINK_FLAGS_RELEASE}> $<$:${BUILD_FLAGS_DEBUG}> -Bsymbolic-functions -Wl,--as-needed @@ -207,6 +209,9 @@ function(give_options_without_warnings target) target_link_options(${target} PUBLIC $<$:${BUILD_SHARED_LIBRARY_FLAGS_RELEASE}>) + elseif(CMAKE_BUILD_TYPE MATCHES Release) + target_compile_options(${target} PUBLIC + $<$:-mllvm=--enable-gvn-hoist>) endif() target_compile_definitions(${target} PRIVATE