From: Rafael Espindola Date: Mon, 6 Apr 2015 14:34:43 +0000 (+0000) Subject: Don't use -ffunction-sections -fdata-sections on debug builds. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=29072c8fab85f090d0482074c1d7bbb4565de8fd;p=oota-llvm.git Don't use -ffunction-sections -fdata-sections on debug builds. Unfortunately, on ELF there is not used attribute on the .o files, so there is no easy way to keep the dump function alive. If we are not gcing, we may as well produce non gcable files and avoid the cost. Linking a debug clang now takes 18.856225992 seconds, before it took 21.206897447. I will try avoiding --gc-sections -O3 on a followup patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234159 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake index 67f86a64526..f4f96501eba 100644 --- a/cmake/modules/HandleLLVMOptions.cmake +++ b/cmake/modules/HandleLLVMOptions.cmake @@ -486,7 +486,8 @@ endif() # But MinSizeRel seems to add that automatically, so maybe disable these # flags instead if LLVM_NO_DEAD_STRIP is set. if(NOT CYGWIN AND NOT WIN32) - if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND + NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") check_c_compiler_flag("-Werror -fno-function-sections" C_SUPPORTS_FNO_FUNCTION_SECTIONS) if (C_SUPPORTS_FNO_FUNCTION_SECTIONS) # Don't add -ffunction-section if it can be disabled with -fno-function-sections.