]> granicus.if.org Git - clang/commitdiff
[cmake] Revert r260742 (and r260744) to improve order file support.
authorChandler Carruth <chandlerc@gmail.com>
Wed, 17 Feb 2016 02:13:35 +0000 (02:13 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Wed, 17 Feb 2016 02:13:35 +0000 (02:13 +0000)
This appears to be passing '-Wl,-order_file' to Linux link commands,
which then causes the linker to silently, behind the scenes, write the
output to 'rder_file' instead of somewhere else. Will work with Chris to
figure out the proper support for this, but so far there are numerous
people who can't get Clang to update when they build because of this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261054 91177308-0d34-0410-b5e6-96231b3b80d8

CMakeLists.txt
tools/driver/CMakeLists.txt
utils/perf-training/CMakeLists.txt

index b218f6c2f31ae180d53042f8c2eafed7546ae1bc..be8a7aa522d338b64d628ee4e1c18ba22f5b9ded 100644 (file)
@@ -595,24 +595,18 @@ if( CLANG_INCLUDE_DOCS )
   add_subdirectory(docs)
 endif()
 
-# this line is needed as a cleanup to ensure that any CMakeCaches with the old
-# default value get updated to the new default.
-if(CLANG_ORDER_FILE STREQUAL "")
+if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/clang.order")
+  file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/clang.order")
+endif()
+
+if(CLANG_ORDER_FILE STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/clang.order")
   unset(CLANG_ORDER_FILE CACHE)
+  unset(CLANG_ORDER_FILE)
 endif()
 
-set(CLANG_ORDER_FILE ${CMAKE_CURRENT_BINARY_DIR}/clang.order CACHE FILEPATH
+set(CLANG_ORDER_FILE "" CACHE FILEPATH
   "Order file to use when compiling clang in order to improve startup time.")
 
-if(CLANG_ORDER_FILE AND NOT EXISTS ${CLANG_ORDER_FILE})
-  string(FIND "${CLANG_ORDER_FILE}" "${CMAKE_CURRENT_BINARY_DIR}" PATH_START)
-  if(PATH_START EQUAL 0)
-    file(WRITE ${CLANG_ORDER_FILE} "\n")
-  else()
-    message(FATAL_ERROR "Specified order file '${CLANG_ORDER_FILE}' does not exist.")
-  endif()
-endif()
-
 if (CLANG_BUILT_STANDALONE OR CMAKE_VERSION VERSION_EQUAL 3 OR
     CMAKE_VERSION VERSION_GREATER 3)
   # Generate a list of CMake library targets so that other CMake projects can
index d8bdd702482d3448ec4236a79ec98b6ec97af8f1..bb631db79c3f22337e58e355555b402267eca6ce 100644 (file)
@@ -87,24 +87,8 @@ if (APPLE)
   set(TOOL_INFO_BUILD_VERSION)
 endif()
 
-if(CLANG_ORDER_FILE)
-  include(CMakePushCheckState)
-
-  function(check_linker_flag flag out_var)
-    cmake_push_check_state()
-    set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}")
-    check_cxx_compiler_flag("" ${out_var})
-    cmake_pop_check_state()
-  endfunction()
-
-  # This is a test to ensure the actual order file works with the linker.
-  check_linker_flag("-Wl,-order_file,${CLANG_ORDER_FILE}"
-    LINKER_ORDER_FILE_WORKS)
-  
-  if(LINKER_ORDER_FILE_WORKS)
-    target_link_libraries(clang "-Wl,-order_file,${CLANG_ORDER_FILE}")
-    set_target_properties(clang PROPERTIES LINK_DEPENDS ${CLANG_ORDER_FILE})
-  endif()
+if(CLANG_ORDER_FILE AND EXISTS CLANG_ORDER_FILE)
+  target_link_libraries(clang "-Wl,-order_file,${CLANG_ORDER_FILE}")
 endif()
 
 if(WITH_POLLY AND LINK_POLLY_INTO_TOOLS)
index f8647a0e44f7fae908936400475b03e9ddd9ec71..32f7c84555b441a6451d8e09d4426ada7415aa18 100644 (file)
@@ -55,8 +55,9 @@ if(DTRACE)
     COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py clean ${CMAKE_CURRENT_BINARY_DIR} dtrace
     COMMENT "Clearing old dtrace data")
 
+
   add_custom_target(generate-order-file
-    COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py gen-order-file --binary $<TARGET_FILE:clang> --output ${CLANG_ORDER_FILE} ${CMAKE_CURRENT_BINARY_DIR}
+    COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py gen-order-file --binary $<TARGET_FILE:clang> --output ${CMAKE_CURRENT_BINARY_DIR}/clang.order ${CMAKE_CURRENT_BINARY_DIR}
     COMMENT "Generating order file"
     DEPENDS generate-dtrace-logs)
 endif()