[llvm] r354374 - Fix builds for older macOS deployment targets after r354365
Daniel Sanders via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 19 11:45:04 PST 2019
Author: dsanders
Date: Tue Feb 19 11:45:03 2019
New Revision: 354374
URL: http://llvm.org/viewvc/llvm-project?rev=354374&view=rev
Log:
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
Modified:
llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=354374&r1=354373&r2=354374&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Tue Feb 19 11:45:03 2019
@@ -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()
More information about the llvm-commits
mailing list