[PATCH] D151385: test-release.sh: Add support for cross-compiling
Tom Stellard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 24 16:01:39 PDT 2023
tstellar created this revision.
tstellar added a reviewer: thieta.
Herald added a subscriber: kristof.beyls.
Herald added a reviewer: sscalpone.
Herald added a project: All.
tstellar requested review of this revision.
Herald added a project: LLVM.
To enable cross-compiling, pass a CMake toolchain file to the script using
the -toolchain-file option.
For example:
./test-release.sh -release 16.0.0 -final -toolchain-file `pwd`/aarch64-redhat-linux.cmake -triple aarch64-redhat-linux -use-ninja
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D151385
Files:
llvm/utils/release/aarch64-redhat-linux.cmake
llvm/utils/release/test-release.sh
Index: llvm/utils/release/test-release.sh
===================================================================
--- llvm/utils/release/test-release.sh
+++ llvm/utils/release/test-release.sh
@@ -9,6 +9,8 @@
#
# Download, build, and test the release candidate for an LLVM release.
#
+# dnf install -y file clang ninja-build cmake chrpath
+# CXX=/usr/lib64/ccache/clang++ ./test-release.sh -no-libunwind -no-lldb -no-polly -no-mlir -no-flang -release 16.0.0 -final -toolchain-file `pwd`/aarch64-redhat-linux.cmake -triple arch64-redhat-linux -use-ninja
#===------------------------------------------------------------------------===#
System=`uname -s`
@@ -46,6 +48,7 @@
ExtraConfigureFlags=""
ExportBranch=""
git_ref=""
+toolchain_file=""
do_bolt="no"
if [ "$System" = "Linux" ]; then
@@ -87,6 +90,7 @@
echo " -no-mlir Disable check-out & build MLIR"
echo " -no-flang Disable check-out & build Flang"
echo " -silent-log Don't output build logs to stdout"
+ echo " -toolchain-file FILE Path to toolchain file to use for cross-compiling stage3."
}
while [ $# -gt 0 ]; do
@@ -199,6 +203,20 @@
;;
-silent-log )
do_silent_log="yes"
+ ;;
+ -toolchain-file )
+ shift
+ toolchain_file="$1"
+ do_compare="no"
+ # Disable libunwind build due to configure error:
+ # Compiler doesn't support generation of unwind tables if exception support
+ # is disabled. Building libunwind DSO with runtime dependency on C++ ABI
+ # library is not supported.
+ do_libunwind="no"
+ # --sysroot option is not passed to libcxxabi builds.
+ do_libcxxabi="no"
+ do_libs="no"
+
;;
-help | --help | -h | --h | -\? )
usage
@@ -421,6 +439,9 @@
runtime_list="$runtimes"
fi
+ if [ "$Phase" -eq "3" ] && [ -n "$toolchain_file" ]; then
+ ExtraConfigureFlags="$ExtraConfigureFlags -DCMAKE_TOOLCHAIN_FILE=$toolchain_file"
+ fi
echo "# Using C compiler: $c_compiler"
echo "# Using C++ compiler: $cxx_compiler"
@@ -660,7 +681,10 @@
c_compiler=$llvmCore_phase3_destdir/usr/local/bin/clang
cxx_compiler=$llvmCore_phase3_destdir/usr/local/bin/clang++
echo "# Testing - built with clang"
- test_llvmCore 3 $Flavor $llvmCore_phase3_objdir
+ # Disable tests if we are cross-compiling
+ if [ -z "$toolchain_file" ]; then
+ test_llvmCore 3 $Flavor $llvmCore_phase3_objdir
+ fi
########################################################################
# Compare .o files between Phase2 and Phase3 and report which ones
Index: llvm/utils/release/aarch64-redhat-linux.cmake
===================================================================
--- /dev/null
+++ llvm/utils/release/aarch64-redhat-linux.cmake
@@ -0,0 +1,14 @@
+set(CMAKE_SYSTEM_NAME Linux)
+
+set(TRIPLE "aarch64-redhat-linux")
+
+set(COMMON_COMPILE_FLAGS "-target ${TRIPLE} --sysroot=/usr/${TRIPLE}/")
+set(COMMON_LINK_FLAGS "-fuse-ld=lld")
+
+set(CMAKE_CXX_FLAGS ${COMMON_COMPILE_FLAGS})
+set(CMAKE_C_FLAGS ${COMMON_COMPILE_FLAGS})
+set(CMAKE_EXE_LINKER_FLAGS ${COMMON_LINK_FLAGS})
+set(CMAKE_MODULE_LINKER_FLAGS ${COMMON_LINK_FLAGS})
+set(CMAKE_SHARED_LINKER_FLAGS ${COMMON_LINK_FLAGS})
+
+set(LLVM_HOST_TRIPLE ${TRIPLE} CACHE STRING "Host on which LLVM binaries will run")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151385.525362.patch
Type: text/x-patch
Size: 3448 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230524/062758a4/attachment.bin>
More information about the llvm-commits
mailing list