Update prebuilt Clang to r416183b from Android.
https://android.googlesource.com/platform/prebuilts/clang/host/
linux-x86/+/06a71ddac05c22edb2d10b590e1769b3f8619bef
clang 12.0.5 (based on r416183b) from build 7284624.
Change-Id: I277a316abcf47307562d8b748b84870f31a72866
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/linux-x64/clang/lib64/cmake/llvm/LLVMExternalProjectUtils.cmake b/linux-x64/clang/lib64/cmake/llvm/LLVMExternalProjectUtils.cmake
index 9a6adab..f68f384 100644
--- a/linux-x64/clang/lib64/cmake/llvm/LLVMExternalProjectUtils.cmake
+++ b/linux-x64/clang/lib64/cmake/llvm/LLVMExternalProjectUtils.cmake
@@ -45,16 +45,48 @@
"CMAKE_ARGS;TOOLCHAIN_TOOLS;RUNTIME_LIBRARIES;DEPENDS;EXTRA_TARGETS;PASSTHROUGH_PREFIXES;STRIP_TOOL"
${ARGN})
canonicalize_tool_name(${name} nameCanon)
+
+ foreach(arg ${ARG_CMAKE_ARGS})
+ if(arg MATCHES "^-DCMAKE_SYSTEM_NAME=")
+ string(REGEX REPLACE "^-DCMAKE_SYSTEM_NAME=(.*)$" "\\1" _cmake_system_name "${arg}")
+ endif()
+ endforeach()
+
+ # If CMAKE_SYSTEM_NAME is not set explicitly in the arguments passed to us,
+ # reflect CMake's own default.
+ if (NOT _cmake_system_name)
+ set(_cmake_system_name "${CMAKE_HOST_SYSTEM_NAME}")
+ endif()
+
if(NOT ARG_TOOLCHAIN_TOOLS)
- set(ARG_TOOLCHAIN_TOOLS clang lld)
- if(NOT APPLE AND NOT WIN32)
- list(APPEND ARG_TOOLCHAIN_TOOLS llvm-ar llvm-ranlib llvm-nm llvm-objcopy llvm-objdump llvm-strip)
+ set(ARG_TOOLCHAIN_TOOLS clang)
+ # AIX 64-bit XCOFF and big AR format is not yet supported in some of these tools.
+ if(NOT _cmake_system_name STREQUAL AIX)
+ list(APPEND ARG_TOOLCHAIN_TOOLS lld llvm-ar llvm-ranlib llvm-nm llvm-objdump)
+ if(_cmake_system_name STREQUAL Darwin)
+ list(APPEND ARG_TOOLCHAIN_TOOLS llvm-libtool-darwin llvm-lipo)
+ elseif(_cmake_system_name STREQUAL Windows)
+ list(APPEND ARG_TOOLCHAIN_TOOLS llvm-lib)
+ else()
+ # TODO: These tools don't fully support Mach-O format yet.
+ list(APPEND ARG_TOOLCHAIN_TOOLS llvm-objcopy llvm-strip)
+ endif()
endif()
endif()
foreach(tool ${ARG_TOOLCHAIN_TOOLS})
if(TARGET ${tool})
list(APPEND TOOLCHAIN_TOOLS ${tool})
- list(APPEND TOOLCHAIN_BINS $<TARGET_FILE:${tool}>)
+
+ # $<TARGET_FILE:tgt> only works on add_executable or add_library targets
+ # The below logic mirrors cmake's own implementation
+ get_target_property(target_type "${tool}" TYPE)
+ if(NOT target_type STREQUAL "OBJECT_LIBRARY" AND
+ NOT target_type STREQUAL "UTILITY" AND
+ NOT target_type STREQUAL "GLOBAL_TARGET" AND
+ NOT target_type STREQUAL "INTERFACE_LIBRARY")
+ list(APPEND TOOLCHAIN_BINS $<TARGET_FILE:${tool}>)
+ endif()
+
endif()
endforeach()
@@ -104,46 +136,52 @@
endforeach()
endforeach()
- foreach(arg ${ARG_CMAKE_ARGS})
- if(arg MATCHES "^-DCMAKE_SYSTEM_NAME=")
- string(REGEX REPLACE "^-DCMAKE_SYSTEM_NAME=(.*)$" "\\1" _cmake_system_name "${arg}")
- endif()
- endforeach()
-
if(ARG_USE_TOOLCHAIN AND NOT CMAKE_CROSSCOMPILING)
if(CLANG_IN_TOOLCHAIN)
if(_cmake_system_name STREQUAL Windows)
- set(compiler_args -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang-cl
- -DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang-cl)
+ set(compiler_args -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang-cl${CMAKE_EXECUTABLE_SUFFIX}
+ -DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang-cl${CMAKE_EXECUTABLE_SUFFIX}
+ -DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang-cl${CMAKE_EXECUTABLE_SUFFIX})
else()
- set(compiler_args -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
- -DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++)
+ set(compiler_args -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang${CMAKE_EXECUTABLE_SUFFIX}
+ -DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++${CMAKE_EXECUTABLE_SUFFIX}
+ -DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang${CMAKE_EXECUTABLE_SUFFIX})
endif()
endif()
if(lld IN_LIST TOOLCHAIN_TOOLS)
if(_cmake_system_name STREQUAL Windows)
- list(APPEND compiler_args -DCMAKE_LINKER=${LLVM_RUNTIME_OUTPUT_INTDIR}/lld-link)
- else()
- list(APPEND compiler_args -DCMAKE_LINKER=${LLVM_RUNTIME_OUTPUT_INTDIR}/ld.lld)
+ list(APPEND compiler_args -DCMAKE_LINKER=${LLVM_RUNTIME_OUTPUT_INTDIR}/lld-link${CMAKE_EXECUTABLE_SUFFIX})
+ elseif(NOT _cmake_system_name STREQUAL Darwin)
+ list(APPEND compiler_args -DCMAKE_LINKER=${LLVM_RUNTIME_OUTPUT_INTDIR}/ld.lld${CMAKE_EXECUTABLE_SUFFIX})
endif()
endif()
if(llvm-ar IN_LIST TOOLCHAIN_TOOLS)
- list(APPEND compiler_args -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar)
+ if(_cmake_system_name STREQUAL Windows)
+ list(APPEND compiler_args -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-lib${CMAKE_EXECUTABLE_SUFFIX})
+ else()
+ list(APPEND compiler_args -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar${CMAKE_EXECUTABLE_SUFFIX})
+ endif()
+ endif()
+ if(llvm-libtool-darwin IN_LIST TOOLCHAIN_TOOLS)
+ list(APPEND compiler_args -DCMAKE_LIBTOOL=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-libtool-darwin${CMAKE_EXECUTABLE_SUFFIX})
+ endif()
+ if(llvm-lipo IN_LIST TOOLCHAIN_TOOLS)
+ list(APPEND compiler_args -DCMAKE_LIPO=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-lipo${CMAKE_EXECUTABLE_SUFFIX})
endif()
if(llvm-ranlib IN_LIST TOOLCHAIN_TOOLS)
- list(APPEND compiler_args -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib)
+ list(APPEND compiler_args -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib${CMAKE_EXECUTABLE_SUFFIX})
endif()
if(llvm-nm IN_LIST TOOLCHAIN_TOOLS)
- list(APPEND compiler_args -DCMAKE_NM=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-nm)
+ list(APPEND compiler_args -DCMAKE_NM=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-nm${CMAKE_EXECUTABLE_SUFFIX})
endif()
if(llvm-objdump IN_LIST TOOLCHAIN_TOOLS)
- list(APPEND compiler_args -DCMAKE_OBJDUMP=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-objdump)
+ list(APPEND compiler_args -DCMAKE_OBJDUMP=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-objdump${CMAKE_EXECUTABLE_SUFFIX})
endif()
if(llvm-objcopy IN_LIST TOOLCHAIN_TOOLS)
- list(APPEND compiler_args -DCMAKE_OBJCOPY=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-objcopy)
+ list(APPEND compiler_args -DCMAKE_OBJCOPY=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-objcopy${CMAKE_EXECUTABLE_SUFFIX})
endif()
if(llvm-strip IN_LIST TOOLCHAIN_TOOLS AND NOT ARG_STRIP_TOOL)
- list(APPEND compiler_args -DCMAKE_STRIP=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-strip)
+ list(APPEND compiler_args -DCMAKE_STRIP=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-strip${CMAKE_EXECUTABLE_SUFFIX})
endif()
list(APPEND ARG_DEPENDS ${TOOLCHAIN_TOOLS})
endif()
@@ -178,6 +216,7 @@
-DCMAKE_LINKER=${CMAKE_LINKER}
-DCMAKE_AR=${CMAKE_AR}
-DCMAKE_RANLIB=${CMAKE_RANLIB}
+ -DCMAKE_LIPO=${CMAKE_LIPO}
-DCMAKE_NM=${CMAKE_NM}
-DCMAKE_OBJCOPY=${CMAKE_OBJCOPY}
-DCMAKE_OBJDUMP=${CMAKE_OBJDUMP}
@@ -232,6 +271,8 @@
-DLLVM_HOST_TRIPLE=${LLVM_HOST_TRIPLE}
-DLLVM_HAVE_LINK_VERSION_SCRIPT=${LLVM_HAVE_LINK_VERSION_SCRIPT}
-DLLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO=${LLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO}
+ -DLLVM_USE_RELATIVE_PATHS_IN_FILES=${LLVM_USE_RELATIVE_PATHS_IN_FILES}
+ -DLLVM_LIT_ARGS=${LLVM_LIT_ARGS}
-DLLVM_SOURCE_PREFIX=${LLVM_SOURCE_PREFIX}
-DPACKAGE_VERSION=${PACKAGE_VERSION}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}