diff options
author | Chris Bieneman <beanz@apple.com> | 2016-08-11 00:19:51 +0000 |
---|---|---|
committer | Chris Bieneman <beanz@apple.com> | 2016-08-11 00:19:51 +0000 |
commit | f7250e52a73ad735e46a4874e9789822931cc1cf (patch) | |
tree | 37faa3f0b59edbc7cc3b376d3675caddba754f5a /tools/driver | |
parent | b0f2f6f050858b565fdc6732a796314d28388d98 (diff) |
[Order Files] Don't use empty order files
LD64 does optimization on symbol layouts that gets disabled whenever an order file is passed (even if it is empty). This change prevents disabling that optimization, and still enables iterative generation and usage of order files.
If the order file is empty it does not setup the order file flags, instead it sets the empty order file as a configuration dependency. When the order file changes it will then trigger a re-configuration that adds the linker flag.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278306 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/driver')
-rw-r--r-- | tools/driver/CMakeLists.txt | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/driver/CMakeLists.txt b/tools/driver/CMakeLists.txt index e03b3fa395..0d9a55b2b4 100644 --- a/tools/driver/CMakeLists.txt +++ b/tools/driver/CMakeLists.txt @@ -101,8 +101,15 @@ if(LD64_EXECUTABLE AND CLANG_ORDER_FILE) # 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) + + # Passing an empty order file disables some linker layout optimizations. + # To work around this and enable workflows for re-linking when the order file + # changes we check during configuration if the file is empty, and make it a + # configuration dependency. + file(READ ${CLANG_ORDER_FILE} ORDER_FILE LIMIT 20) + if("${ORDER_FILE}" STREQUAL "\n") + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CLANG_ORDER_FILE}) + elseif(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() |