From: Mehdi Amini Date: Mon, 1 Apr 2019 17:17:45 +0000 (-0700) Subject: Fix MacOS build X-Git-Tag: llvmorg-11-init~1466^2~2060 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b3a407fa68f8138c447aa953c572d7334ceb8817;p=platform%2Fupstream%2Fllvm.git Fix MacOS build This is making up for some differences in standard library and linker flags. It also get rid of the requirement to build with RTTI. -- PiperOrigin-RevId: 241348845 --- diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt index c0d1029..882c249 100644 --- a/mlir/CMakeLists.txt +++ b/mlir/CMakeLists.txt @@ -20,11 +20,18 @@ endfunction() # TODO: This is to handle the current static registration, but should be # factored out a bit. function(whole_archive_link target) - set(link_flags "-Llib -Wl,--whole-archive,") - FOREACH(LIB ${ARGN}) - string(CONCAT link_flags ${link_flags} "-l${LIB},") - ENDFOREACH(LIB) - string(CONCAT link_flags ${link_flags} "--no-whole-archive") + if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") + set(link_flags "-Llib -Wl,-all_load ") + FOREACH(LIB ${ARGN}) + string(CONCAT link_flags ${link_flags} "-l${LIB} ") + ENDFOREACH(LIB) + else() + set(link_flags "-Llib -Wl,--whole-archive,") + FOREACH(LIB ${ARGN}) + string(CONCAT link_flags ${link_flags} "-l${LIB},") + ENDFOREACH(LIB) + string(CONCAT link_flags ${link_flags} "--no-whole-archive") + endif() set_target_properties(${target} PROPERTIES LINK_FLAGS ${link_flags}) endfunction(whole_archive_link) diff --git a/mlir/lib/Transforms/LoopTiling.cpp b/mlir/lib/Transforms/LoopTiling.cpp index f7fef1a..d262a5d 100644 --- a/mlir/lib/Transforms/LoopTiling.cpp +++ b/mlir/lib/Transforms/LoopTiling.cpp @@ -368,7 +368,8 @@ void LoopTiling::getTileSizes(ArrayRef band, (*tileSizes)[i] = tSize; else // Set last tile size to cover the balance. - (*tileSizes)[i] = std::max(1UL, excessFactor / cumulProductOfTileSizes); + (*tileSizes)[i] = std::max( + 1U, static_cast(excessFactor / cumulProductOfTileSizes)); cumulProductOfTileSizes *= (*tileSizes)[i]; } if (avoidMaxMinBounds) diff --git a/mlir/tools/mlir-cpu-runner/CMakeLists.txt b/mlir/tools/mlir-cpu-runner/CMakeLists.txt index af448d1..1c59ae5 100644 --- a/mlir/tools/mlir-cpu-runner/CMakeLists.txt +++ b/mlir/tools/mlir-cpu-runner/CMakeLists.txt @@ -13,6 +13,6 @@ set(LIBS add_executable(mlir-cpu-runner mlir-cpu-runner.cpp ) - +llvm_update_compile_flags(mlir-cpu-runner) whole_archive_link(mlir-cpu-runner MLIRLLVMIR MLIRStandardOps MLIRTargetLLVMIR MLIRTransforms MLIRTranslation) target_link_libraries(mlir-cpu-runner MLIRIR ${LIBS}) diff --git a/mlir/tools/mlir-opt/CMakeLists.txt b/mlir/tools/mlir-opt/CMakeLists.txt index 8cb8551..def266d 100644 --- a/mlir/tools/mlir-opt/CMakeLists.txt +++ b/mlir/tools/mlir-opt/CMakeLists.txt @@ -13,6 +13,6 @@ set(LIBS add_executable(mlir-opt mlir-opt.cpp ) - +llvm_update_compile_flags(mlir-opt) whole_archive_link(mlir-opt ${LIBS}) target_link_libraries(mlir-opt MLIRIR ${LIBS} LLVMSupport) diff --git a/mlir/tools/mlir-translate/CMakeLists.txt b/mlir/tools/mlir-translate/CMakeLists.txt index 74e1897..330c9ad 100644 --- a/mlir/tools/mlir-translate/CMakeLists.txt +++ b/mlir/tools/mlir-translate/CMakeLists.txt @@ -14,6 +14,6 @@ set(LIBS add_executable(mlir-translate mlir-translate.cpp ) - +llvm_update_compile_flags(mlir-translate) whole_archive_link(mlir-translate ${LIBS}) target_link_libraries(mlir-translate MLIRIR ${LIBS} LLVMSupport)