From 916add28cdd83fddfb7f0a1c274b25b9547c2ebb Mon Sep 17 00:00:00 2001 From: Jian Cai Date: Fri, 17 Jul 2020 16:38:54 -0700 Subject: compiler_wrapper: rename update_compiler_wrapper.sh Rename the script to install_compiler_wrapper.sh to avoid confusion with chromiumos-overlay/sys-devel/llvm/files/update_compiler_wrapper.sh. BUG=None. Test=None. Change-Id: I39bbc3dc4a63fa480c394f2e92c1723033cdc321 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2304726 Tested-by: Jian Cai Reviewed-by: Bob Haarman --- compiler_wrapper/README.md | 22 +++++++++------ compiler_wrapper/install_compiler_wrapper.sh | 40 ++++++++++++++++++++++++++++ compiler_wrapper/update_compiler_wrapper.sh | 40 ---------------------------- 3 files changed, 54 insertions(+), 48 deletions(-) create mode 100755 compiler_wrapper/install_compiler_wrapper.sh delete mode 100755 compiler_wrapper/update_compiler_wrapper.sh diff --git a/compiler_wrapper/README.md b/compiler_wrapper/README.md index 794e1635..e64f01b6 100644 --- a/compiler_wrapper/README.md +++ b/compiler_wrapper/README.md @@ -12,25 +12,31 @@ package, including the build script, and then build from there without a dependency on toolchain-utils itself. -## Update Chrome OS +## Update source files Copy over sources and `build.py` to Chrome OS: ``` -(chroot) /mnt/host/source/src/third_party/chromiumos-overlay/sys-devel/llvm/files/update_compiler_wrapper.sh +(chroot) /mnt/host/source/src/third_party/chromiumos-overlay/sys-devel/llvm/files/update\_compiler\_wrapper.sh ``` `build.py` is called by these ebuilds: -- third_party/chromiumos-overlay/sys-devel/llvm/llvm-9.0_pre361749_p20190714.ebuild -- third_party/chromiumos-overlay/sys-devel/gcc/gcc-*.ebuild +- third_party/chromiumos-overlay/sys-devel/llvm/llvm-11.0\_pre394483\_p20200618-r3.ebuild +- third_party/chromiumos-overlay/sys-devel/gcc/gcc-\*.ebuild +## Update compiler wrappers +``` +(chroot) /mnt/host/source/src/third|_party/toolchain-utils/compiler\_wrapper/install\_compiler\_wrapper.sh +``` Generated wrappers are stored here: - Sysroot wrapper with ccache: - `/usr/x86_64-pc-linux-gnu//gcc-bin/4.9.x/sysroot_wrapper.hardened.ccache` + `/usr/x86_64-pc-linux-gnu//gcc-bin/4.9.x/sysroot\_wrapper.hardened.ccache` - Sysroot wrapper without ccache: - `/usr/x86_64-pc-linux-gnu//gcc-bin/4.9.x/sysroot_wrapper.hardened.noccache` + `/usr/x86_64-pc-linux-gnu//gcc-bin/4.9.x/sysroot\_wrapper.hardened.noccache` - Clang host wrapper: - `/usr/bin/clang_host_wrapper` + `/usr/bin/clang\_host\_wrapper` - Gcc host wrapper: - `/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.x/host_wrapper` + `/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.x/host\_wrapper` + + diff --git a/compiler_wrapper/install_compiler_wrapper.sh b/compiler_wrapper/install_compiler_wrapper.sh new file mode 100755 index 00000000..479b112c --- /dev/null +++ b/compiler_wrapper/install_compiler_wrapper.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# Copyright 2020 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This script rebuilds and installs compiler wrappers + +if [[ ! -e /etc/cros_chroot_version ]]; then + echo "Please run this script inside chroot" + exit 1 +fi +set -e +cd "$(dirname "$(readlink -m "$0")")" +echo "Updated files:" +# Update the host wrapper +./build.py --config=cros.host --use_ccache=false --use_llvm_next=false --output_file=./clang_host_wrapper +sudo mv ./clang_host_wrapper /usr/bin/clang_host_wrapper +echo "/usr/bin/clang_host_wrapper" +sudo cp ../binary_search_tool/bisect_driver.py /usr/bin +echo "/usr/bin/clang_host_wrapper/bisect_driver.py" +# Update the target wrappers +for GCC in cross-x86_64-cros-linux-gnu/gcc cross-armv7a-cros-linux-gnueabihf/gcc cross-aarch64-cros-linux-gnu/gcc; do + if ! FILES="$(equery f ${GCC})"; then + if [[ $(equery l "${GCC}" 2>&1 | wc -c) -eq 0 ]]; then + echo "no ${GCC} package found; skipping" >&2 + continue + fi + # Something went wrong, and the equery above probably complained about it. + exit 1 + fi + ./build.py --config=cros.hardened --use_ccache=false --use_llvm_next=false --output_file=./sysroot_wrapper.hardened.noccache + sudo mv ./sysroot_wrapper.hardened.noccache "$(grep sysroot_wrapper.hardened.noccache <<< "${FILES}")" + grep sysroot_wrapper.hardened.noccache <<< "${FILES}" + ./build.py --config=cros.hardened --use_ccache=true --use_llvm_next=false --output_file=./sysroot_wrapper.hardened.ccache + sudo mv ./sysroot_wrapper.hardened.ccache "$(grep sysroot_wrapper.hardened.ccache <<< "${FILES}")" + grep sysroot_wrapper.hardened.ccache <<< "${FILES}" + sudo cp ../binary_search_tool/bisect_driver.py "$(grep bisect_driver.py <<< "${FILES}")" + grep bisect_driver.py <<< "${FILES}" +done diff --git a/compiler_wrapper/update_compiler_wrapper.sh b/compiler_wrapper/update_compiler_wrapper.sh deleted file mode 100755 index 479b112c..00000000 --- a/compiler_wrapper/update_compiler_wrapper.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# -# Copyright 2020 The Chromium OS Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# This script rebuilds and installs compiler wrappers - -if [[ ! -e /etc/cros_chroot_version ]]; then - echo "Please run this script inside chroot" - exit 1 -fi -set -e -cd "$(dirname "$(readlink -m "$0")")" -echo "Updated files:" -# Update the host wrapper -./build.py --config=cros.host --use_ccache=false --use_llvm_next=false --output_file=./clang_host_wrapper -sudo mv ./clang_host_wrapper /usr/bin/clang_host_wrapper -echo "/usr/bin/clang_host_wrapper" -sudo cp ../binary_search_tool/bisect_driver.py /usr/bin -echo "/usr/bin/clang_host_wrapper/bisect_driver.py" -# Update the target wrappers -for GCC in cross-x86_64-cros-linux-gnu/gcc cross-armv7a-cros-linux-gnueabihf/gcc cross-aarch64-cros-linux-gnu/gcc; do - if ! FILES="$(equery f ${GCC})"; then - if [[ $(equery l "${GCC}" 2>&1 | wc -c) -eq 0 ]]; then - echo "no ${GCC} package found; skipping" >&2 - continue - fi - # Something went wrong, and the equery above probably complained about it. - exit 1 - fi - ./build.py --config=cros.hardened --use_ccache=false --use_llvm_next=false --output_file=./sysroot_wrapper.hardened.noccache - sudo mv ./sysroot_wrapper.hardened.noccache "$(grep sysroot_wrapper.hardened.noccache <<< "${FILES}")" - grep sysroot_wrapper.hardened.noccache <<< "${FILES}" - ./build.py --config=cros.hardened --use_ccache=true --use_llvm_next=false --output_file=./sysroot_wrapper.hardened.ccache - sudo mv ./sysroot_wrapper.hardened.ccache "$(grep sysroot_wrapper.hardened.ccache <<< "${FILES}")" - grep sysroot_wrapper.hardened.ccache <<< "${FILES}" - sudo cp ../binary_search_tool/bisect_driver.py "$(grep bisect_driver.py <<< "${FILES}")" - grep bisect_driver.py <<< "${FILES}" -done -- cgit v1.2.3