diff options
author | Daniel Sanders <daniel_l_sanders@apple.com> | 2019-02-19 19:45:03 +0000 |
---|---|---|
committer | Daniel Sanders <daniel_l_sanders@apple.com> | 2019-02-19 19:45:03 +0000 |
commit | daf777b2064680a563c1ea265fc9c026f79599d8 (patch) | |
tree | dfaa1fabfba32938e0b84e31f2326037711deab9 | |
parent | 64c7b060bc598d915866d3667f497329453a7a17 (diff) | |
download | bcm5719-llvm-daf777b2064680a563c1ea265fc9c026f79599d8.tar.gz bcm5719-llvm-daf777b2064680a563c1ea265fc9c026f79599d8.zip |
Fix builds for older macOS deployment targets after r354365
Surprisingly, check_symbol_exists is not sufficient. The macOS linker checks the
called functions against a compatibility list for the given deployment target
and check_symbol_exists doesn't trigger this check as it never calls the
function.
This fixes the GreenDragon bots where the deployment target is 10.9
llvm-svn: 354374
-rw-r--r-- | llvm/cmake/modules/HandleLLVMOptions.cmake | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake index f60b457679e..694fe946b9b 100644 --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -917,25 +917,31 @@ get_compile_definitions() option(LLVM_FORCE_ENABLE_STATS "Enable statistics collection for builds that wouldn't normally enable it" OFF) -check_symbol_exists(os_signpost_interval_begin "os/signpost.h" _signposts_available) -if(_signposts_available) - set(LLVM_ENABLE_SUPPORT_XCODE_SIGNPOSTS "WITH_ASSERTS" CACHE STRING - "Enable support for Xcode signposts. Can be WITH_ASSERTS, FORCE_ON, FORCE_OFF") - string(TOUPPER "${LLVM_ENABLE_SUPPORT_XCODE_SIGNPOSTS}" - uppercase_LLVM_ENABLE_SUPPORT_XCODE_SIGNPOSTS) - if( uppercase_LLVM_ENABLE_SUPPORT_XCODE_SIGNPOSTS STREQUAL "WITH_ASSERTS" ) - if( LLVM_ENABLE_ASSERTIONS ) +check_symbol_exists(os_signpost_interval_begin "os/signpost.h" macos_signposts_available) +if(macos_signposts_available) + check_cxx_source_compiles( + "#include <os/signpost.h> + int main() { os_signpost_interval_begin(nullptr, 0, \"\", \"\"); return 0; }" + macos_signposts_usable) + if(macos_signposts_usable) + set(LLVM_ENABLE_SUPPORT_XCODE_SIGNPOSTS "WITH_ASSERTS" CACHE STRING + "Enable support for Xcode signposts. Can be WITH_ASSERTS, FORCE_ON, FORCE_OFF") + string(TOUPPER "${LLVM_ENABLE_SUPPORT_XCODE_SIGNPOSTS}" + uppercase_LLVM_ENABLE_SUPPORT_XCODE_SIGNPOSTS) + if( uppercase_LLVM_ENABLE_SUPPORT_XCODE_SIGNPOSTS STREQUAL "WITH_ASSERTS" ) + if( LLVM_ENABLE_ASSERTIONS ) + set( LLVM_SUPPORT_XCODE_SIGNPOSTS 1 ) + endif() + elseif( uppercase_LLVM_ENABLE_SUPPORT_XCODE_SIGNPOSTS STREQUAL "FORCE_ON" ) set( LLVM_SUPPORT_XCODE_SIGNPOSTS 1 ) + elseif( uppercase_LLVM_ENABLE_SUPPORT_XCODE_SIGNPOSTS STREQUAL "FORCE_OFF" ) + # We don't need to do anything special to turn off signposts. + elseif( NOT DEFINED LLVM_ENABLE_SUPPORT_XCODE_SIGNPOSTS ) + # Treat LLVM_ENABLE_SUPPORT_XCODE_SIGNPOSTS like "FORCE_OFF" when it has not been + # defined. + else() + message(FATAL_ERROR "Unknown value for LLVM_ENABLE_SUPPORT_XCODE_SIGNPOSTS:" + " \"${LLVM_ENABLE_SUPPORT_XCODE_SIGNPOSTS}\"!") endif() - elseif( uppercase_LLVM_ENABLE_SUPPORT_XCODE_SIGNPOSTS STREQUAL "FORCE_ON" ) - set( LLVM_SUPPORT_XCODE_SIGNPOSTS 1 ) - elseif( uppercase_LLVM_ENABLE_SUPPORT_XCODE_SIGNPOSTS STREQUAL "FORCE_OFF" ) - # We don't need to do anything special to turn off signposts. - elseif( NOT DEFINED LLVM_ENABLE_SUPPORT_XCODE_SIGNPOSTS ) - # Treat LLVM_ENABLE_SUPPORT_XCODE_SIGNPOSTS like "FORCE_OFF" when it has not been - # defined. - else() - message(FATAL_ERROR "Unknown value for LLVM_ENABLE_SUPPORT_XCODE_SIGNPOSTS:" - " \"${LLVM_ENABLE_SUPPORT_XCODE_SIGNPOSTS}\"!") endif() endif() |