From d57de8ba8b9bd1b9aefb3d96d586c04d0bab2004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 30 Sep 2022 11:37:09 +0300 Subject: [PATCH] install-wrappers: Install wrappers named -llvm-ar and -llvm-ranlib This is necessary for CMake to detect working IPO (LTO); if the compiler is named -{gcc,clang}, CMake expects to find matching tools named -llvm-{ar,ranlib} too. (The CMake module CheckIPOSupported and function check_ipo_supported expects to have CMAKE_LANG_COMPILER_AR and ..._RANLIB set to working tools; the Clang-FindBinUtils.cmake module looks for tools named llvm-ar/llvm-ranlib with the same prefix as the compiler.) --- install-wrappers.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/install-wrappers.sh b/install-wrappers.sh index 11ac963..eaf2413 100755 --- a/install-wrappers.sh +++ b/install-wrappers.sh @@ -88,11 +88,18 @@ for arch in $ARCHS; do for exec in clang clang++ gcc g++ c++ as; do ln -sf clang-target-wrapper$CTW_SUFFIX $arch-w64-$target_os-$exec$CTW_LINK_SUFFIX done - for exec in addr2line ar ranlib nm objcopy readelf strings strip; do + for exec in addr2line ar ranlib nm objcopy readelf strings strip llvm-ar llvm-ranlib; do if [ -n "$HOST" ]; then link_target=llvm-wrapper else - link_target=llvm-$exec + case $exec in + llvm-*) + link_target=$exec + ;; + *) + link_target=llvm-$exec + ;; + esac fi ln -sf $link_target$EXEEXT $arch-w64-$target_os-$exec$EXEEXT || true done