diff options
author | Chih-Hung Hsieh <chh@google.com> | 2021-09-20 19:41:46 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-09-20 19:41:46 +0000 |
commit | c2567cdcc24bd29c3804e1c3e30757739d0670f8 (patch) | |
tree | 97dfb2f67dc005acec3bd24ba5f1334be2f90c09 | |
parent | 62d7b3623cf52298dc4f25eeaabf8963119b0c12 (diff) | |
parent | 49872359c87765343a213dac2312130f2b78c634 (diff) | |
download | toolchain-utils-c2567cdcc24bd29c3804e1c3e30757739d0670f8.tar.gz |
Merging 48 commit(s) from Chromium's toolchain-utils am: 49872359c8
Original change: https://android-review.googlesource.com/c/platform/external/toolchain-utils/+/1831012
Change-Id: I334c9338d0a31a978d8a8f002d5518fed6e2c481
117 files changed, 3316 insertions, 1626 deletions
diff --git a/.style.yapf b/.style.yapf index 97f7d657..c4472bda 100644 --- a/.style.yapf +++ b/.style.yapf @@ -1,3 +1,4 @@ [style] -based_on_style = chromium +based_on_style = pep8 blank_line_before_module_docstring = true +indent_width = 2 diff --git a/OWNERS.toolchain b/OWNERS.toolchain index 48ecc260..67a4cd07 100644 --- a/OWNERS.toolchain +++ b/OWNERS.toolchain @@ -1,12 +1,12 @@ -cmtice@chromium.org +ajordanr@google.com +cjdb@google.com denik@chromium.org gbiv@chromium.org inglorion@chromium.org -jiancai@chromium.org llozano@chromium.org manojgupta@chromium.org -tcwang@chromium.org -zhizhouy@chromium.org +mbenfield@google.com +ryanbeltran@chromium.org # Temporary; see comment #2 on crbug.com/982498 llozano@google.com diff --git a/afdo_metadata/kernel_afdo.json b/afdo_metadata/kernel_afdo.json index 41f66412..3529ebb4 100644 --- a/afdo_metadata/kernel_afdo.json +++ b/afdo_metadata/kernel_afdo.json @@ -1,17 +1,17 @@ { "chromeos-kernel-3_18": { - "name": "R92-13929.0-1620639394" + "name": "R94-14092.5-1627896981" }, "chromeos-kernel-4_4": { - "name": "R92-13929.0-1620639137" + "name": "R94-14119.0-1627896842" }, "chromeos-kernel-4_14": { - "name": "R92-13943.0-1620639211" + "name": "R94-14119.0-1627896837" }, "chromeos-kernel-4_19": { - "name": "R92-13929.0-1620639571" + "name": "R94-14119.0-1627896728" }, "chromeos-kernel-5_4": { - "name": "R92-13929.0-1620639673" + "name": "R94-14119.0-1627896791" } } diff --git a/afdo_tools/bisection/afdo_prof_analysis.py b/afdo_tools/bisection/afdo_prof_analysis.py index 94e5366b..ce8afd64 100755 --- a/afdo_tools/bisection/afdo_prof_analysis.py +++ b/afdo_tools/bisection/afdo_prof_analysis.py @@ -24,9 +24,6 @@ from __future__ import division, print_function import argparse import json -# Pylint recommends we use "from chromite.lib import cros_logging as logging". -# Chromite specific policy message, we want to keep using the standard logging -# pylint: disable=cros-logging-import import logging import os import random diff --git a/afdo_tools/update_kernel_afdo b/afdo_tools/update_kernel_afdo index aa14b44a..4b41053f 100755 --- a/afdo_tools/update_kernel_afdo +++ b/afdo_tools/update_kernel_afdo @@ -36,13 +36,8 @@ outfile="$(realpath --relative-to="${tc_utils_dir}" \ # Convert toolchain_utils into the absolute path. abs_tc_utils_dir="$(realpath ${tc_utils_dir})" -# The most recent Monday, in Unix timestamp format. -if [ $(date +%a) = "Mon" ] -then - expected_time=$(date +%s -d 00:00:00) -else - expected_time=$(date +%s -d "last Monday") -fi +# Check profiles uploaded within the last week. +expected_time=$(date +%s -d "week ago") declare -A branch branch_number commit remote_repo=$(git -C "${tc_utils_dir}" remote) diff --git a/binary_search_tool/README.bisect.md b/binary_search_tool/README.bisect.md index bd9e0f14..32f4cba6 100644 --- a/binary_search_tool/README.bisect.md +++ b/binary_search_tool/README.bisect.md @@ -75,7 +75,9 @@ following arguments: * board: The board to bisect on. For example: daisy, falco, etc. * remote: The IP address of the physical machine you're using to test with. -* package: The package to bisect with. For example: chromeos-chrome +* package: The package to bisect with. For example: chromeos-chrome. +* use_flags: (Optional) Use flags for emerge. For example: "-thinlto -cfi". +* noreboot: (Optional) Do not reboot after updating the package. * dir: (Optional) the directory for your good/bad build trees. Defaults to $BISECT_DIR or /tmp/sysroot_bisect. This value will set $BISECT_DIR for all bisecting scripts. diff --git a/binary_search_tool/common/test_setup.sh b/binary_search_tool/common/test_setup.sh index 6e64e5c4..3ea73272 100755 --- a/binary_search_tool/common/test_setup.sh +++ b/binary_search_tool/common/test_setup.sh @@ -1,6 +1,8 @@ #!/bin/bash # -# Copyright 2016 Google Inc. All Rights Reserved. +# Copyright 2021 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 is a generic ChromeOS package/image test setup script. It is meant to # be used for either the object file or package bisection tools. This script @@ -98,8 +100,25 @@ if [[ "${BISECT_MODE}" == "OBJECT_MODE" ]]; then sudo rm -rf /build/${BISECT_BOARD}/var/cache/portage/* sudo rm -rf /build/${BISECT_BOARD}/tmp/portage/${BISECT_PACKAGE}* set +x + if [[ ${BISECT_PACKAGE} == *chromeos-chrome ]]; then + if [[ ${BISECT_USE_FLAGS} == *chrome_internal* && \ + ${BISECT_USE_FLAGS} != *-chrome_internal* ]]; then + # for the pre-upload check of the length of lines + chrome_build_dir="/var/cache/chromeos-chrome/chrome-src-internal/src/" + chrome_build_dir+="out_${BISECT_BOARD}" + else + # for the pre-upload check of the length of lines + chrome_build_dir="/var/cache/chromeos-chrome/chrome-src/src/" + chrome_build_dir+="out_${BISECT_BOARD}" + fi + set -x + sudo rm -rf ${chrome_build_dir} + set +x + fi + set -x CLEAN_DELAY=0 emerge-${BISECT_BOARD} -C ${BISECT_PACKAGE} - emerge-${BISECT_BOARD} ${BISECT_PACKAGE} + USE="${BISECT_USE_FLAGS}" emerge-${BISECT_BOARD} ${BISECT_PACKAGE} + set +x emerge_status=$? if [[ ${emerge_status} -ne 0 ]] ; then @@ -108,7 +127,7 @@ if [[ "${BISECT_MODE}" == "OBJECT_MODE" ]]; then fi echo - echo "DEPLOYING" + echo "DEPLOYING TO ${BISECT_REMOTE}" if [[ ${BISECT_PACKAGE} == *chromeos-kernel-* ]]; then cmd="/mnt/host/source/src/scripts/update_kernel.sh --board=${BISECT_BOARD} --remote=${BISECT_REMOTE}" @@ -117,17 +136,34 @@ if [[ "${BISECT_MODE}" == "OBJECT_MODE" ]]; then PORT=$(echo $1 | cut -d ":" -f2) cmd="/mnt/host/source/src/scripts/update_kernel.sh --board=${BISECT_BOARD} --remote=${IP} --ssh_port=${PORT}" fi + if [[ ${BISECT_REBOOT_OPTION} == false ]]; then + cmd+=" --noreboot" + fi set -x # exec the command to make sure it always exit after exec $cmd set +x fi - echo "cros deploy ${BISECT_REMOTE} ${BISECT_PACKAGE}" - cros deploy ${BISECT_REMOTE} ${BISECT_PACKAGE} --log-level=info - + if [[ ${BISECT_PACKAGE} == *chromeos-chrome ]]; then + # deploy_chrome needs to run inside chrome source tree + pushd ~/chrome_root + set -x + deploy_chrome --force --build-dir=${chrome_build_dir}/Release \ + --device=${BISECT_REMOTE} + set +x + popd + else + set -x + cros deploy ${BISECT_REMOTE} ${BISECT_PACKAGE} --log-level=info + set +x + fi deploy_status=$? + if [[ ${BISECT_REBOOT_OPTION} == false ]]; then + exit 0 + fi + if [[ ${deploy_status} -eq 0 ]] ; then echo "Deploy successful. Rebooting device..." reboot @@ -145,7 +181,8 @@ fi echo "BUILDING IMAGE" pushd ~/trunk/src/scripts -./build_image test --board=${BISECT_BOARD} --noenable_rootfs_verification --noeclean +USE="${BISECT_USE_FLAGS}" ./build_image test --board=${BISECT_BOARD} \ + --noenable_rootfs_verification --noeclean build_status=$? popd diff --git a/binary_search_tool/run_bisect.py b/binary_search_tool/run_bisect.py index ef1048bb..249b9cf5 100755 --- a/binary_search_tool/run_bisect.py +++ b/binary_search_tool/run_bisect.py @@ -12,6 +12,7 @@ import abc import argparse from argparse import RawTextHelpFormatter import os +import shlex import sys from binary_search_tool import binary_search_state @@ -141,8 +142,8 @@ class BisectPackage(Bisector): 'prune': True, 'file_args': True } - self.setup_cmd = ('%s %s %s' % (self.cros_pkg_setup, self.options.board, - self.options.remote)) + self.setup_cmd = ' '.join( + (self.cros_pkg_setup, self.options.board, self.options.remote)) self.ArgOverride(self.default_kwargs, self.overrides) def PreRun(self): @@ -192,9 +193,10 @@ class BisectObject(Bisector): if options.dir: os.environ['BISECT_DIR'] = options.dir self.options.dir = os.environ.get('BISECT_DIR', '/tmp/sysroot_bisect') - self.setup_cmd = ( - '%s %s %s %s' % (self.sysroot_wrapper_setup, self.options.board, - self.options.remote, self.options.package)) + self.setup_cmd = ' '.join( + (self.sysroot_wrapper_setup, self.options.board, self.options.remote, + self.options.package, str(self.options.reboot).lower(), + shlex.quote(self.options.use_flags))) self.ArgOverride(self.default_kwargs, overrides) @@ -253,8 +255,8 @@ class BisectAndroid(Bisector): if self.options.device_id: device_id = "ANDROID_SERIAL='%s'" % self.options.device_id - self.setup_cmd = ('%s %s %s %s' % (num_jobs, device_id, self.android_setup, - self.options.android_src)) + self.setup_cmd = ' '.join( + (num_jobs, device_id, self.android_setup, self.options.android_src)) self.ArgOverride(self.default_kwargs, overrides) @@ -344,6 +346,16 @@ def Main(argv): parser_object.add_argument('remote', help='Remote machine to test on') parser_object.add_argument('package', help='Package to emerge and test') parser_object.add_argument( + '--use_flags', + required=False, + default='', + help='Use flags passed to emerge') + parser_object.add_argument( + '--noreboot', + action='store_false', + dest='reboot', + help='Do not reboot after updating the package (default: False)') + parser_object.add_argument( '--dir', help=('Bisection directory to use, sets ' '$BISECT_DIR if provided. Defaults to ' diff --git a/binary_search_tool/sysroot_wrapper/README.md b/binary_search_tool/sysroot_wrapper/README.md index 89904a0b..77ce4b8f 100644 --- a/binary_search_tool/sysroot_wrapper/README.md +++ b/binary_search_tool/sysroot_wrapper/README.md @@ -8,7 +8,7 @@ The only script that you need to create for your triaging problem is the Before running the binary searcher tool you will need to run the setup script: ``` -./sysroot_wrapper/setup.sh ${board} ${remote_ip} ${package} +./sysroot_wrapper/setup.sh ${board} ${remote_ip} ${package} ${reboot_option} ${use_flags} ``` This setup script will ensure your `$BISECT_DIR` is properly populated and diff --git a/binary_search_tool/sysroot_wrapper/setup.sh b/binary_search_tool/sysroot_wrapper/setup.sh index f5907f59..6b9b48f1 100755 --- a/binary_search_tool/sysroot_wrapper/setup.sh +++ b/binary_search_tool/sysroot_wrapper/setup.sh @@ -1,6 +1,8 @@ #!/bin/bash -u # -# Copyright 2016 Google Inc. All Rights Reserved. +# Copyright 2021 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 is part of the ChromeOS object binary search triage process. # It should be the first script called by the user, after the user has set up @@ -23,6 +25,8 @@ bisect_dir=${BISECT_DIR:-/tmp/sysroot_bisect} BOARD=$1 REMOTE=$2 PACKAGE=$3 +REBOOT_OPTION=$4 +USE_FLAGS=$5 GOOD_BUILD=${bisect_dir}/good BAD_BUILD=${bisect_dir}/bad @@ -60,6 +64,8 @@ cat <<-EOF > ${COMMON_FILE} BISECT_BOARD=${BOARD} BISECT_REMOTE=${REMOTE} BISECT_PACKAGE=${PACKAGE} +BISECT_REBOOT_OPTION=${REBOOT_OPTION} +BISECT_USE_FLAGS="${USE_FLAGS}" BISECT_MODE="OBJECT_MODE" bisect_dir=${bisect_dir} diff --git a/buildbot_test_llvm.py b/buildbot_test_llvm.py index 968c67b8..1c7bb199 100755 --- a/buildbot_test_llvm.py +++ b/buildbot_test_llvm.py @@ -32,7 +32,7 @@ from cros_utils import buildbot_utils CROSTC_ROOT = '/usr/local/google/crostc' ROLE_ACCOUNT = 'mobiletc-prebuild' TOOLCHAIN_DIR = os.path.dirname(os.path.realpath(__file__)) -MAIL_PROGRAM = '~/var/bin/mail-sheriff' +MAIL_PROGRAM = '~/var/bin/mail-detective' VALIDATION_RESULT_DIR = os.path.join(CROSTC_ROOT, 'validation_result') START_DATE = datetime.date(2016, 1, 1) TEST_PER_DAY = 4 @@ -137,24 +137,23 @@ def Main(argv): # Common initializations command_executer.InitCommandExecuter() parser = argparse.ArgumentParser() - parser.add_argument( - '--chromeos_root', - dest='chromeos_root', - help='The chromeos root from which to run tests.') - parser.add_argument( - '--weekday', - default='', - dest='weekday', - help='The day of the week for which to run tests.') - parser.add_argument( - '--board', default='', dest='board', help='The board to test.') - parser.add_argument( - '--patch', - dest='patches', - default='', - help='The patches to use for the testing, ' - "seprate the patch numbers with ',' " - 'for more than one patches.') + parser.add_argument('--chromeos_root', + dest='chromeos_root', + help='The chromeos root from which to run tests.') + parser.add_argument('--weekday', + default='', + dest='weekday', + help='The day of the week for which to run tests.') + parser.add_argument('--board', + default='', + dest='board', + help='The board to test.') + parser.add_argument('--patch', + dest='patches', + default='', + help='The patches to use for the testing, ' + "seprate the patch numbers with ',' " + 'for more than one patches.') parser.add_argument( '--compiler', dest='compiler', diff --git a/buildbot_test_toolchains.py b/buildbot_test_toolchains.py index b5468941..6c3bfef4 100755 --- a/buildbot_test_toolchains.py +++ b/buildbot_test_toolchains.py @@ -39,7 +39,7 @@ NIGHTLY_TESTS_DIR = os.path.join(CROSTC_ROOT, 'nightly-tests') ROLE_ACCOUNT = 'mobiletc-prebuild' TOOLCHAIN_DIR = os.path.dirname(os.path.realpath(__file__)) TMP_TOOLCHAIN_TEST = '/tmp/toolchain-tests' -MAIL_PROGRAM = '~/var/bin/mail-sheriff' +MAIL_PROGRAM = '~/var/bin/mail-detective' PENDING_ARCHIVES_DIR = os.path.join(CROSTC_ROOT, 'pending_archives') NIGHTLY_TESTS_RESULTS = os.path.join(CROSTC_ROOT, 'nightly_test_reports') @@ -228,25 +228,25 @@ class ToolchainComparator(object): noschedv2_opts = '--noschedv2' if self._noschedv2 else '' command = ('{crosperf} --no_email={no_email} --results_dir={r_dir} ' '--logging_level=verbose --json_report=True {noschedv2_opts} ' - '{exp_file}').format( - crosperf=crosperf, - no_email=not self._test, - r_dir=self._reports_dir, - noschedv2_opts=noschedv2_opts, - exp_file=experiment_file) + '{exp_file}').format(crosperf=crosperf, + no_email=not self._test, + r_dir=self._reports_dir, + noschedv2_opts=noschedv2_opts, + exp_file=experiment_file) return self._ce.RunCommand(command) def _SendEmail(self): """Find email message generated by crosperf and send it.""" filename = os.path.join(self._reports_dir, 'msg_body.html') - if (os.path.exists(filename) and - os.path.exists(os.path.expanduser(MAIL_PROGRAM))): + if (os.path.exists(filename) + and os.path.exists(os.path.expanduser(MAIL_PROGRAM))): email_title = 'buildbot llvm test results' if USE_LLVM_NEXT_PATCH in self._patches_string: email_title = 'buildbot llvm_next test results' - command = ('cat %s | %s -s "%s, %s %s" -team -html' % - (filename, MAIL_PROGRAM, email_title, self._board, self._date)) + command = ( + 'cat %s | %s -s "%s, %s %s" -team -html' % + (filename, MAIL_PROGRAM, email_title, self._board, self._date)) self._ce.RunCommand(command) def _CopyJson(self): @@ -317,44 +317,41 @@ def Main(argv): # Common initializations command_executer.InitCommandExecuter() parser = argparse.ArgumentParser() - parser.add_argument( - '--remote', dest='remote', help='Remote machines to run tests on.') - parser.add_argument( - '--board', dest='board', default='x86-zgb', help='The target board.') - parser.add_argument( - '--chromeos_root', - dest='chromeos_root', - help='The chromeos root from which to run tests.') - parser.add_argument( - '--weekday', - default='', - dest='weekday', - help='The day of the week for which to run tests.') - parser.add_argument( - '--patch', - dest='patches', - help='The patches to use for the testing, ' - "seprate the patch numbers with ',' " - 'for more than one patches.') - parser.add_argument( - '--noschedv2', - dest='noschedv2', - action='store_true', - default=False, - help='Pass --noschedv2 to crosperf.') - parser.add_argument( - '--recipe', - dest='recipe', - default=True, - help='Use images generated from recipe rather than' - 'launching tryjob to get images.') - parser.add_argument( - '--test', - dest='test', - default=False, - help='Test this script on local desktop, ' - 'disabling mobiletc checking and email sending.' - 'Artifacts stored in /tmp/toolchain-tests') + parser.add_argument('--remote', + dest='remote', + help='Remote machines to run tests on.') + parser.add_argument('--board', + dest='board', + default='x86-zgb', + help='The target board.') + parser.add_argument('--chromeos_root', + dest='chromeos_root', + help='The chromeos root from which to run tests.') + parser.add_argument('--weekday', + default='', + dest='weekday', + help='The day of the week for which to run tests.') + parser.add_argument('--patch', + dest='patches', + help='The patches to use for the testing, ' + "seprate the patch numbers with ',' " + 'for more than one patches.') + parser.add_argument('--noschedv2', + dest='noschedv2', + action='store_true', + default=False, + help='Pass --noschedv2 to crosperf.') + parser.add_argument('--recipe', + dest='recipe', + default=True, + help='Use images generated from recipe rather than' + 'launching tryjob to get images.') + parser.add_argument('--test', + dest='test', + default=False, + help='Test this script on local desktop, ' + 'disabling mobiletc checking and email sending.' + 'Artifacts stored in /tmp/toolchain-tests') options = parser.parse_args(argv[1:]) if not options.board: @@ -372,9 +369,10 @@ def Main(argv): shutil.rmtree(TMP_TOOLCHAIN_TEST) os.mkdir(TMP_TOOLCHAIN_TEST) - fc = ToolchainComparator(options.board, options.remote, options.chromeos_root, - options.weekday, options.patches, options.recipe, - options.test, options.noschedv2) + fc = ToolchainComparator(options.board, options.remote, + options.chromeos_root, options.weekday, + options.patches, options.recipe, options.test, + options.noschedv2) return fc.DoAll() diff --git a/compiler-test.sh b/compiler-test.sh index 8083e2d2..fe552a51 100755 --- a/compiler-test.sh +++ b/compiler-test.sh @@ -10,9 +10,6 @@ # each compiler. It writes out these statistics when it is done. # # For a locally-built ChromeOS image, the debug directory is usually: -# ${chromeos_root}/chroot/build/${board}/usr/lib/debug (from outside -# chroot) -# or # /build/${board}/usr/lib/debug (from inside chroot) # # For a buildbot-built image you can usually download the debug tree @@ -44,7 +41,7 @@ fi cd ${DEBUG_TREE} for f in `find . -name "*.debug" -type f` ; do - at_producer=`readelf --debug-dump=info $f | head -25 | grep AT_producer `; + at_producer=`llvm-dwarfdump $f | head -25 | grep AT_producer `; if echo ${at_producer} | grep -q 'GNU C' ; then ((gcc_count++)) elif echo ${at_producer} | grep -q 'clang'; then diff --git a/compiler_wrapper/bundle.py b/compiler_wrapper/bundle.py index 27b422f3..6df82146 100755 --- a/compiler_wrapper/bundle.py +++ b/compiler_wrapper/bundle.py @@ -18,7 +18,18 @@ import sys def parse_args(): parser = argparse.ArgumentParser() - parser.add_argument('output_dir') + default_output_dir = os.path.normpath( + os.path.join( + os.path.dirname(os.path.realpath(__file__)), + '../../chromiumos-overlay/sys-devel/llvm/files/compiler_wrapper')) + parser.add_argument( + '--output_dir', + default=default_output_dir, + help='Output directory to place bundled files (default: %(default)s)') + parser.add_argument( + '--create', + action='store_true', + help='Create output_dir if it does not already exist') return parser.parse_args() @@ -57,6 +68,10 @@ def main(): args = parse_args() input_dir = os.path.dirname(__file__) change_id = read_change_id(input_dir) + if not args.create: + assert os.path.exists( + args.output_dir + ), f'Specified output directory ({args.output_dir}) does not exist' shutil.rmtree(args.output_dir, ignore_errors=True) os.makedirs(args.output_dir) copy_files(input_dir, args.output_dir) diff --git a/compiler_wrapper/ccache_flag_test.go b/compiler_wrapper/ccache_flag_test.go index 2b18c8ca..50205312 100644 --- a/compiler_wrapper/ccache_flag_test.go +++ b/compiler_wrapper/ccache_flag_test.go @@ -164,6 +164,8 @@ func withCCacheEnabledTestContext(t *testing.T, work func(ctx *testContext)) { func TestRusagePreventsCCache(t *testing.T) { withCCacheEnabledTestContext(t, func(ctx *testContext) { + ctx.NoteTestWritesToUmask() + ctx.env = append(ctx.env, "TOOLCHAIN_RUSAGE_OUTPUT="+filepath.Join(ctx.tempDir, "rusage.log")) cmd := ctx.must(callCompiler(ctx, ctx.cfg, ctx.newCommand(gccX86_64, mainCc))) diff --git a/compiler_wrapper/clang_flags.go b/compiler_wrapper/clang_flags.go index c69d1b3d..84149bf6 100644 --- a/compiler_wrapper/clang_flags.go +++ b/compiler_wrapper/clang_flags.go @@ -63,11 +63,8 @@ func processClangFlags(builder *commandBuilder) error { // Clang may use different options for the same or similar functionality. gccToClang := map[string]string{ - "-Wno-error=cpp": "-Wno-#warnings", - "-Wno-error=maybe-uninitialized": "-Wno-error=uninitialized", - "-Wno-error=unused-but-set-variable": "-Wno-error=unused-variable", - "-Wno-unused-but-set-variable": "-Wno-unused-variable", - "-Wunused-but-set-variable": "-Wunused-variable", + "-Wno-error=cpp": "-Wno-#warnings", + "-Wno-error=maybe-uninitialized": "-Wno-error=uninitialized", } // Note: not using builder.transformArgs as we need to add multiple arguments diff --git a/compiler_wrapper/clang_flags_test.go b/compiler_wrapper/clang_flags_test.go index bdc0bbaa..25c13c74 100644 --- a/compiler_wrapper/clang_flags_test.go +++ b/compiler_wrapper/clang_flags_test.go @@ -46,7 +46,7 @@ func TestClangPathGivenClangEnv(t *testing.T) { func TestAbsoluteClangPathBasedOnRootPath(t *testing.T) { withTestContext(t, func(ctx *testContext) { - ctx.cfg.rootRelPath = "somepath" + ctx.cfg.clangRootRelPath = "somepath" cmd := ctx.must(callCompiler(ctx, ctx.cfg, ctx.newCommand(filepath.Join(ctx.tempDir, clangX86_64), mainCc))) if err := verifyPath(cmd, filepath.Join(ctx.tempDir, "somepath/usr/bin/clang")); err != nil { @@ -57,7 +57,7 @@ func TestAbsoluteClangPathBasedOnRootPath(t *testing.T) { func TestRelativeClangPathBasedOnRootPath(t *testing.T) { withTestContext(t, func(ctx *testContext) { - ctx.cfg.rootRelPath = "somepath" + ctx.cfg.clangRootRelPath = "somepath" cmd := ctx.must(callCompiler(ctx, ctx.cfg, ctx.newCommand(clangX86_64, mainCc))) if err := verifyPath(cmd, "somepath/usr/bin/clang"); err != nil { @@ -68,7 +68,7 @@ func TestRelativeClangPathBasedOnRootPath(t *testing.T) { func TestRelativeClangPathWithDirBasedOnRootPath(t *testing.T) { withTestContext(t, func(ctx *testContext) { - ctx.cfg.rootRelPath = "somepath" + ctx.cfg.clangRootRelPath = "somepath" cmd := ctx.must(callCompiler(ctx, ctx.cfg, ctx.newCommand("test/x86_64-cros-linux-gnu-clang", mainCc))) if err := verifyPath(cmd, "test/somepath/usr/bin/clang"); err != nil { @@ -79,7 +79,7 @@ func TestRelativeClangPathWithDirBasedOnRootPath(t *testing.T) { func TestPathEnvClangPathBasedOnRootPath(t *testing.T) { withTestContext(t, func(ctx *testContext) { - ctx.cfg.rootRelPath = "somepath" + ctx.cfg.clangRootRelPath = "somepath" ctx.env = []string{"PATH=" + filepath.Join(ctx.tempDir, "/pathenv")} ctx.writeFile(filepath.Join(ctx.tempDir, "/pathenv/x86_64-cros-linux-gnu-clang"), "") cmd := ctx.must(callCompiler(ctx, ctx.cfg, @@ -93,7 +93,7 @@ func TestPathEnvClangPathBasedOnRootPath(t *testing.T) { func TestClangPathForClangHostWrapper(t *testing.T) { withTestContext(t, func(ctx *testContext) { ctx.cfg.isHostWrapper = true - ctx.cfg.rootRelPath = "somepath" + ctx.cfg.clangRootRelPath = "somepath" cmd := ctx.must(callCompiler(ctx, ctx.cfg, ctx.newCommand(clangX86_64, mainCc))) if err := verifyPath(cmd, filepath.Join(ctx.tempDir, "clang")); err != nil { @@ -128,7 +128,7 @@ func TestClangPathForAndroidWrapperWithSymlinks(t *testing.T) { func TestUseXclangPathAndCalcResourceDirByNestedClangCall(t *testing.T) { withTestContext(t, func(ctx *testContext) { - ctx.cfg.rootRelPath = "somepath" + ctx.cfg.clangRootRelPath = "somepath" ctx.cmdMock = func(cmd *command, stdin io.Reader, stdout io.Writer, stderr io.Writer) error { if ctx.cmdCount > 1 { return nil @@ -183,10 +183,7 @@ func TestConvertGccToClangFlags(t *testing.T) { in string out string }{ - {"-Wno-error=unused-but-set-variable", "-Wno-error=unused-variable"}, {"-Wno-error=maybe-uninitialized", "-Wno-error=uninitialized"}, - {"-Wno-unused-but-set-variable", "-Wno-unused-variable"}, - {"-Wunused-but-set-variable", "-Wunused-variable"}, {"-Wno-error=cpp", "-Wno-#warnings"}, {"-Xclang-only=-abc=xyz", "-abc=xyz"}, } @@ -302,7 +299,7 @@ func TestClangFallbackLinkerPathRelativeToRootDir(t *testing.T) { func TestClangLinkerPathRelativeToRootDir(t *testing.T) { withTestContext(t, func(ctx *testContext) { - ctx.cfg.rootRelPath = "somepath" + ctx.cfg.clangRootRelPath = "somepath" cmd := ctx.must(callCompiler(ctx, ctx.cfg, ctx.newCommand(clangX86_64, mainCc))) if err := verifyArgOrder(cmd, "-Bsomepath/bin"); err != nil { diff --git a/compiler_wrapper/command.go b/compiler_wrapper/command.go index e6ea6690..eb040b25 100644 --- a/compiler_wrapper/command.go +++ b/compiler_wrapper/command.go @@ -5,12 +5,14 @@ package main import ( + "context" "fmt" "io" "os" "os/exec" "path/filepath" "strings" + "time" ) type command struct { @@ -63,6 +65,26 @@ func runCmd(env env, cmd *command, stdin io.Reader, stdout io.Writer, stderr io. return execCmd.Run() } +func runCmdWithTimeout(env env, cmd *command, t time.Duration) error { + ctx, cancel := context.WithTimeout(context.Background(), t) + defer cancel() + cmdCtx := exec.CommandContext(ctx, cmd.Path, cmd.Args...) + cmdCtx.Env = mergeEnvValues(env.environ(), cmd.EnvUpdates) + cmdCtx.Dir = env.getwd() + cmdCtx.Stdin = env.stdin() + cmdCtx.Stdout = env.stdout() + cmdCtx.Stderr = env.stderr() + + if err := cmdCtx.Start(); err != nil { + return newErrorwithSourceLocf("exec error: %v", err) + } + err := cmdCtx.Wait() + if ctx.Err() == nil { + return err + } + return ctx.Err() +} + func resolveAgainstPathEnv(env env, cmd string) (string, error) { path, _ := env.getenv("PATH") for _, path := range strings.Split(path, ":") { @@ -134,7 +156,12 @@ func newCommandBuilder(env env, cfg *config, cmd *command) (*commandBuilder, err if err != nil { return nil, err } - rootPath := filepath.Join(filepath.Dir(absWrapperPath), cfg.rootRelPath) + var rootPath string + if compilerType == gccType { + rootPath = filepath.Join(filepath.Dir(absWrapperPath), cfg.gccRootRelPath) + } else { + rootPath = filepath.Join(filepath.Dir(absWrapperPath), cfg.clangRootRelPath) + } return &commandBuilder{ path: cmd.Path, args: createBuilderArgs( /*fromUser=*/ true, cmd.Args), @@ -200,8 +227,10 @@ func (builder *commandBuilder) clone() *commandBuilder { } } -func (builder *commandBuilder) wrapPath(path string) { - builder.args = append([]builderArg{{value: builder.path, fromUser: false}}, builder.args...) +func (builder *commandBuilder) wrapPath(path string, extraFlags ...string) { + newArgs := createBuilderArgs( /*fromUser=*/ false, extraFlags) + newArgs = append(newArgs, builderArg{value: builder.path, fromUser: false}) + builder.args = append(newArgs, builder.args...) builder.path = path } diff --git a/compiler_wrapper/compile_with_fallback_test.go b/compiler_wrapper/compile_with_fallback_test.go index a67f3eb9..f9da441a 100644 --- a/compiler_wrapper/compile_with_fallback_test.go +++ b/compiler_wrapper/compile_with_fallback_test.go @@ -221,6 +221,8 @@ func TestCompileWithFallbackExtraArgs(t *testing.T) { func TestCompileWithFallbackLogCommandAndErrors(t *testing.T) { withCompileWithFallbackTestContext(t, func(ctx *testContext) { + ctx.NoteTestReadsFromUmask() + ctx.env = append(ctx.env, "ANDROID_LLVM_FALLBACK_DISABLED_WARNINGS=-a -b") ctx.cmdMock = func(cmd *command, stdin io.Reader, stdout io.Writer, stderr io.Writer) error { switch ctx.cmdCount { diff --git a/compiler_wrapper/compiler_wrapper.go b/compiler_wrapper/compiler_wrapper.go index 9d7b76e5..7d949d34 100644 --- a/compiler_wrapper/compiler_wrapper.go +++ b/compiler_wrapper/compiler_wrapper.go @@ -6,11 +6,14 @@ package main import ( "bytes" + "context" "errors" "fmt" "io" "path/filepath" + "strconv" "strings" + "time" ) func callCompiler(env env, cfg *config, inputCmd *command) int { @@ -62,6 +65,39 @@ func calculateAndroidWrapperPath(mainBuilderPath string, absWrapperPath string) return "." + string(filepath.Separator) + basePart } +func runAndroidClangTidy(env env, cmd *command) error { + timeout, found := env.getenv("TIDY_TIMEOUT") + if !found { + return env.exec(cmd) + } + seconds, err := strconv.Atoi(timeout) + if err != nil || seconds == 0 { + return env.exec(cmd) + } + err = env.runWithTimeout(cmd, time.Duration(seconds)*time.Second) + if !errors.Is(err, context.DeadlineExceeded) { + return err + } + // When DeadllineExceeded, print warning messages. + // Note: This depends on Android build system's clang-tidy command line format. + // Last non-flag before "--" in cmd.Args is used as the source file name. + sourceFile := "unknown_file" + for _, arg := range cmd.Args { + if arg == "--" { + break + } + if strings.HasPrefix(arg, "-") { + continue + } + sourceFile = arg + } + warning := "%s:1:1: warning: clang-tidy aborted after %d seconds.\n" + fmt.Fprintf(env.stdout(), warning, sourceFile, seconds) + fmt.Fprintf(env.stdout(), "TIMEOUT: %s %s\n", cmd.Path, strings.Join(cmd.Args, " ")) + // Do not stop Android build. Just give a warning and return no error. + return nil +} + func callCompilerInternal(env env, cfg *config, inputCmd *command) (exitCode int, err error) { if err := checkUnsupportedFlags(inputCmd); err != nil { return 0, err @@ -81,7 +117,7 @@ func callCompilerInternal(env env, cfg *config, inputCmd *command) (exitCode int // Disable CCache for rusage logs // Note: Disabling Goma causes timeout related INFRA_FAILUREs in builders allowCCache := !rusageEnabled - gomaUsed := false + remoteBuildUsed := false workAroundKernelBugWithRetries := false if cfg.isAndroidWrapper { @@ -91,7 +127,9 @@ func callCompilerInternal(env env, cfg *config, inputCmd *command) (exitCode int mainBuilder.addPreUserArgs(mainBuilder.cfg.clangFlags...) mainBuilder.addPreUserArgs(mainBuilder.cfg.commonFlags...) mainBuilder.addPostUserArgs(mainBuilder.cfg.clangPostFlags...) - if gomaUsed, err = processGomaCccFlags(mainBuilder); err != nil { + inheritGomaFromEnv := true + // Android doesn't support rewrapper; don't try to use it. + if remoteBuildUsed, err = processGomaCccFlags(mainBuilder, inheritGomaFromEnv); err != nil { return 0, err } compilerCmd = mainBuilder.build() @@ -109,16 +147,16 @@ func callCompilerInternal(env env, cfg *config, inputCmd *command) (exitCode int } if tidyMode != tidyModeNone { allowCCache = false - clangCmdWithoutGomaAndCCache := mainBuilder.build() + clangCmdWithoutRemoteBuildAndCCache := mainBuilder.build() var err error switch tidyMode { case tidyModeTricium: if cfg.triciumNitsDir == "" { return 0, newErrorwithSourceLocf("tricium linting was requested, but no nits directory is configured") } - err = runClangTidyForTricium(env, clangCmdWithoutGomaAndCCache, cSrcFile, cfg.triciumNitsDir, tidyFlags, cfg.crashArtifactsDir) + err = runClangTidyForTricium(env, clangCmdWithoutRemoteBuildAndCCache, cSrcFile, cfg.triciumNitsDir, tidyFlags, cfg.crashArtifactsDir) case tidyModeAll: - err = runClangTidy(env, clangCmdWithoutGomaAndCCache, cSrcFile, tidyFlags) + err = runClangTidy(env, clangCmdWithoutRemoteBuildAndCCache, cSrcFile, tidyFlags) default: panic(fmt.Sprintf("Unknown tidy mode: %v", tidyMode)) } @@ -127,7 +165,7 @@ func callCompilerInternal(env env, cfg *config, inputCmd *command) (exitCode int return 0, err } } - if gomaUsed, err = processGomaCCacheFlags(allowCCache, mainBuilder); err != nil { + if remoteBuildUsed, err = processRemoteBuildAndCCacheFlags(allowCCache, mainBuilder); err != nil { return 0, err } compilerCmd = mainBuilder.build() @@ -144,7 +182,7 @@ func callCompilerInternal(env env, cfg *config, inputCmd *command) (exitCode int } return checkClangSyntax(env, clangCmd, gccCmd) } - gomaUsed, compilerCmd, err = calcGccCommand(rusageEnabled, mainBuilder) + remoteBuildUsed, compilerCmd, err = calcGccCommand(rusageEnabled, mainBuilder) if err != nil { return 0, err } @@ -190,6 +228,9 @@ func callCompilerInternal(env env, cfg *config, inputCmd *command) (exitCode int var err error if willLogRusage { err = env.run(compilerCmd, env.stdin(), env.stdout(), env.stderr()) + } else if cfg.isAndroidWrapper && mainBuilder.target.compilerType == clangTidyType { + // Only clang-tidy has timeout feature now. + err = runAndroidClangTidy(env, compilerCmd) } else { // Note: We return from this in non-fatal circumstances only if the // underlying env is not really doing an exec, e.g. commandRecordingEnv. @@ -245,7 +286,7 @@ func callCompilerInternal(env env, cfg *config, inputCmd *command) (exitCode int case err != nil: return exitCode, err default: - if !gomaUsed { + if !remoteBuildUsed { if err := commitRusage(exitCode); err != nil { return exitCode, fmt.Errorf("commiting rusage: %v", err) } @@ -273,11 +314,11 @@ func calcClangCommand(allowCCache bool, builder *commandBuilder) (bool, *command if err != nil { return false, nil, err } - gomaUsed, err := processGomaCCacheFlags(allowCCache, builder) + remoteBuildUsed, err := processRemoteBuildAndCCacheFlags(allowCCache, builder) if err != nil { - return gomaUsed, nil, err + return remoteBuildUsed, nil, err } - return gomaUsed, builder.build(), nil + return remoteBuildUsed, builder.build(), nil } func calcGccCommand(enableRusage bool, builder *commandBuilder) (bool, *command, error) { @@ -288,19 +329,20 @@ func calcGccCommand(enableRusage bool, builder *commandBuilder) (bool, *command, calcCommonPreUserArgs(builder) processGccFlags(builder) - gomaUsed := false + remoteBuildUsed := false if !builder.cfg.isHostWrapper { var err error - if gomaUsed, err = processGomaCCacheFlags(!enableRusage, builder); err != nil { - return gomaUsed, nil, err + if remoteBuildUsed, err = processRemoteBuildAndCCacheFlags(!enableRusage, builder); err != nil { + return remoteBuildUsed, nil, err } } - return gomaUsed, builder.build(), nil + return remoteBuildUsed, builder.build(), nil } func calcCommonPreUserArgs(builder *commandBuilder) { builder.addPreUserArgs(builder.cfg.commonFlags...) if !builder.cfg.isHostWrapper { + processLibGCCFlags(builder) processPieFlags(builder) processThumbCodeFlags(builder) processStackProtectorFlags(builder) @@ -309,19 +351,18 @@ func calcCommonPreUserArgs(builder *commandBuilder) { processSanitizerFlags(builder) } -func processGomaCCacheFlags(allowCCache bool, builder *commandBuilder) (gomaccUsed bool, err error) { - - gomaccUsed = false +func processRemoteBuildAndCCacheFlags(allowCCache bool, builder *commandBuilder) (remoteBuildUsed bool, err error) { + remoteBuildUsed = false if !builder.cfg.isHostWrapper { - gomaccUsed, err = processGomaCccFlags(builder) + remoteBuildUsed, err = processRemoteBuildFlags(builder) if err != nil { - return gomaccUsed, err + return remoteBuildUsed, err } } - if !gomaccUsed && allowCCache { + if !remoteBuildUsed && allowCCache { processCCacheFlag(builder) } - return gomaccUsed, nil + return remoteBuildUsed, nil } func getAbsWrapperPath(env env, wrapperCmd *command) (string, error) { diff --git a/compiler_wrapper/compiler_wrapper_test.go b/compiler_wrapper/compiler_wrapper_test.go index fd59cfe1..74fe3f58 100644 --- a/compiler_wrapper/compiler_wrapper_test.go +++ b/compiler_wrapper/compiler_wrapper_test.go @@ -126,6 +126,8 @@ func TestGomaDisablesRusage(t *testing.T) { func TestLogRusageAndForceDisableWError(t *testing.T) { withTestContext(t, func(ctx *testContext) { + ctx.NoteTestWritesToUmask() + logFileName := filepath.Join(ctx.tempDir, "rusage.log") ctx.env = []string{ "FORCE_DISABLE_WERROR=1", @@ -157,6 +159,8 @@ func TestLogRusageAndForceDisableWError(t *testing.T) { func TestErrorOnLogRusageAndBisect(t *testing.T) { withTestContext(t, func(ctx *testContext) { + ctx.NoteTestWritesToUmask() + ctx.env = []string{ "BISECT_STAGE=xyz", "TOOLCHAIN_RUSAGE_OUTPUT=rusage.log", @@ -170,6 +174,8 @@ func TestErrorOnLogRusageAndBisect(t *testing.T) { func TestErrorOnBisectAndForceDisableWError(t *testing.T) { withTestContext(t, func(ctx *testContext) { + ctx.NoteTestWritesToUmask() + ctx.env = []string{ "BISECT_STAGE=xyz", "FORCE_DISABLE_WERROR=1", diff --git a/compiler_wrapper/config.go b/compiler_wrapper/config.go index d6023846..11d77ba7 100644 --- a/compiler_wrapper/config.go +++ b/compiler_wrapper/config.go @@ -26,7 +26,8 @@ type config struct { // by the user). clangPostFlags []string // Toolchain root path relative to the wrapper binary. - rootRelPath string + clangRootRelPath string + gccRootRelPath string // Directory to store errors that were prevented with -Wno-error. newWarningsDir string // Directory to store nits in when using `WITH_TIDY=tricium`. @@ -105,7 +106,8 @@ func getConfig(configName string, useCCache bool, useLlvmNext bool, version stri // Full hardening. // Temporarily disable function splitting because of chromium:434751. var crosHardenedConfig = &config{ - rootRelPath: "../../../../..", + clangRootRelPath: "../..", + gccRootRelPath: "../../../../..", // Pass "-fcommon" till the packages are fixed to work with new clang/gcc // default of "-fno-common", crbug.com/1060413. commonFlags: []string{ @@ -127,6 +129,8 @@ var crosHardenedConfig = &config{ // Disable "-faddrsig" since it produces object files that strip doesn't understand, chromium:915742. // crbug.com/1103065: -grecord-gcc-switches pollutes the Goma cache; // removed that flag for now. + // Temporarily disable Wdeprecated-declarations. b/193860318 + clangFlags: []string{ "-Qunused-arguments", "-fno-addrsig", @@ -135,17 +139,21 @@ var crosHardenedConfig = &config{ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", }, + + // Temporarily disable Wdeprecated-copy. b/191479033 clangPostFlags: []string{ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", }, newWarningsDir: "/tmp/fatal_clang_warnings", triciumNitsDir: "/tmp/linting_output/clang-tidy", @@ -154,8 +162,9 @@ var crosHardenedConfig = &config{ // Flags to be added to non-hardened toolchain. var crosNonHardenedConfig = &config{ - rootRelPath: "../../../../..", - commonFlags: []string{}, + clangRootRelPath: "../..", + gccRootRelPath: "../../../../..", + commonFlags: []string{}, gccFlags: []string{ "-Wno-maybe-uninitialized", "-Wno-unused-local-typedefs", @@ -165,6 +174,7 @@ var crosNonHardenedConfig = &config{ // Temporarily disable tautological-*-compare chromium:778316. // Temporarily add no-unknown-warning-option to deal with old clang versions. // Temporarily disable Wsection since kernel gets a bunch of these. chromium:778867 + // Temporarily disable Wdeprecated-declarations. b/193860318 clangFlags: []string{ "-Qunused-arguments", "-fdebug-default-version=5", @@ -172,16 +182,19 @@ var crosNonHardenedConfig = &config{ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", }, + + // Temporarily disable Wdeprecated-copy. b/191479033 clangPostFlags: []string{ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", }, newWarningsDir: "/tmp/fatal_clang_warnings", triciumNitsDir: "/tmp/linting_output/clang-tidy", @@ -190,8 +203,9 @@ var crosNonHardenedConfig = &config{ // Flags to be added to host toolchain. var crosHostConfig = &config{ - isHostWrapper: true, - rootRelPath: "../..", + isHostWrapper: true, + clangRootRelPath: "../..", + gccRootRelPath: "../..", // Pass "-fcommon" till the packages are fixed to work with new clang/gcc // default of "-fno-common", crbug.com/1060413. commonFlags: []string{ @@ -206,13 +220,13 @@ var crosHostConfig = &config{ // Temporarily add no-unknown-warning-option to deal with old clang versions. // crbug.com/1103065: -grecord-gcc-switches pollutes the Goma cache; // removed that flag for now. + // Temporarily disable Wdeprecated-declarations. b/193860318 clangFlags: []string{ "-Qunused-arguments", "-fno-addrsig", "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -220,11 +234,15 @@ var crosHostConfig = &config{ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", }, + + // Temporarily disable Wdeprecated-copy. b/191479033 clangPostFlags: []string{ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", }, newWarningsDir: "/tmp/fatal_clang_warnings", triciumNitsDir: "/tmp/linting_output/clang-tidy", @@ -234,7 +252,8 @@ var crosHostConfig = &config{ var androidConfig = &config{ isHostWrapper: false, isAndroidWrapper: true, - rootRelPath: "./", + gccRootRelPath: "./", + clangRootRelPath: "./", commonFlags: []string{}, gccFlags: []string{}, clangFlags: []string{}, diff --git a/compiler_wrapper/config_test.go b/compiler_wrapper/config_test.go index 5492a1bb..86a78928 100644 --- a/compiler_wrapper/config_test.go +++ b/compiler_wrapper/config_test.go @@ -38,7 +38,6 @@ func TestRealConfigWithUseCCacheFlag(t *testing.T) { } } -/* TODO: Re-enable this, when llvm-next is different than llvm func TestRealConfigWithUseLLvmFlag(t *testing.T) { resetGlobals() defer resetGlobals() @@ -50,7 +49,7 @@ func TestRealConfigWithUseLLvmFlag(t *testing.T) { if err != nil { t.Fatal(err) } - if isUsingLLvmNext(cfg) { + if cfg.useLlvmNext { t.Fatal("UseLLvmNext: Expected not to be used") } @@ -60,7 +59,7 @@ func TestRealConfigWithUseLLvmFlag(t *testing.T) { t.Fatal(err) } - if !isUsingLLvmNext(cfg) { + if !cfg.useLlvmNext { t.Fatal("UseLLvmNext: Expected to be used") } @@ -69,7 +68,6 @@ func TestRealConfigWithUseLLvmFlag(t *testing.T) { t.Fatalf("UseLlvmNext: Expected an error, got none") } } -*/ func TestRealConfigWithConfigNameFlag(t *testing.T) { resetGlobals() @@ -128,16 +126,6 @@ func isSysrootHardened(cfg *config) bool { return false } -// TODO: Update this with correct flag when we change llvm-next. -func isUsingLLvmNext(cfg *config) bool { - for _, arg := range cfg.clangFlags { - if arg == "-Wno-reorder-init-list" { - return true - } - } - return false -} - func resetGlobals() { // Set all global variables to a defined state. UseLlvmNext = "unknown" diff --git a/compiler_wrapper/cros_hardened_config_test.go b/compiler_wrapper/cros_hardened_config_test.go index 6d96b182..337b27fe 100644 --- a/compiler_wrapper/cros_hardened_config_test.go +++ b/compiler_wrapper/cros_hardened_config_test.go @@ -16,8 +16,15 @@ const crosHardenedGoldenDir = "testdata/cros_hardened_golden" const crosHardenedNoCCacheGoldenDir = "testdata/cros_hardened_noccache_golden" const crosHardenedLlvmNextGoldenDir = "testdata/cros_hardened_llvmnext_golden" -func TestCrosHardenedConfig(t *testing.T) { +func withGoldenTestContext(t *testing.T, f func(ctx *testContext)) { withTestContext(t, func(ctx *testContext) { + ctx.NoteTestWritesToUmask() + f(ctx) + }) +} + +func TestCrosHardenedConfig(t *testing.T) { + withGoldenTestContext(t, func(ctx *testContext) { useLlvmNext := false useCCache := true cfg, err := getConfig("cros.hardened", useCCache, useLlvmNext, "123") @@ -31,7 +38,7 @@ func TestCrosHardenedConfig(t *testing.T) { } func TestCrosHardenedConfigWithoutCCache(t *testing.T) { - withTestContext(t, func(ctx *testContext) { + withGoldenTestContext(t, func(ctx *testContext) { useLlvmNext := false useCCache := false cfg, err := getConfig("cros.hardened", useCCache, useLlvmNext, "123") @@ -56,7 +63,7 @@ func TestCrosHardenedConfigWithoutCCache(t *testing.T) { } func TestCrosHardenedConfigWithLlvmNext(t *testing.T) { - withTestContext(t, func(ctx *testContext) { + withGoldenTestContext(t, func(ctx *testContext) { useLlvmNext := true useCCache := true cfg, err := getConfig("cros.hardened", useCCache, useLlvmNext, "123") @@ -531,18 +538,6 @@ func createClangArgsGoldenInputs() goldenFile { Cmds: okResults, }, { - WrapperCmd: newGoldenCmd(clangX86_64, "-Wno-error=unused-but-set-variable", mainCc), - Cmds: okResults, - }, - { - WrapperCmd: newGoldenCmd(clangX86_64, "-Wno-unused-but-set-variable", mainCc), - Cmds: okResults, - }, - { - WrapperCmd: newGoldenCmd(clangX86_64, "-Wunused-but-set-variable", mainCc), - Cmds: okResults, - }, - { WrapperCmd: newGoldenCmd(clangX86_64, "-Xclang-only=-someflag", mainCc), Cmds: okResults, }, diff --git a/compiler_wrapper/cros_host_config_test.go b/compiler_wrapper/cros_host_config_test.go index fee78e62..4f3b5cb2 100644 --- a/compiler_wrapper/cros_host_config_test.go +++ b/compiler_wrapper/cros_host_config_test.go @@ -13,7 +13,7 @@ const crosClangHostGoldenDir = "testdata/cros_clang_host_golden" const crosGccHostGoldenDir = "testdata/cros_gcc_host_golden" func TestCrosClangHostConfig(t *testing.T) { - withTestContext(t, func(ctx *testContext) { + withGoldenTestContext(t, func(ctx *testContext) { useLlvmNext := false useCCache := false cfg, err := getConfig("cros.host", useCCache, useLlvmNext, "123") @@ -43,7 +43,7 @@ func TestCrosClangHostConfig(t *testing.T) { } func TestCrosGccHostConfig(t *testing.T) { - withTestContext(t, func(ctx *testContext) { + withGoldenTestContext(t, func(ctx *testContext) { useLlvmNext := false useCCache := false cfg, err := getConfig("cros.host", useCCache, useLlvmNext, "123") diff --git a/compiler_wrapper/cros_llvm_next_flags.go b/compiler_wrapper/cros_llvm_next_flags.go index 6cd7cd2a..d2ae413b 100644 --- a/compiler_wrapper/cros_llvm_next_flags.go +++ b/compiler_wrapper/cros_llvm_next_flags.go @@ -13,6 +13,8 @@ package main // tag is set. // TODO: Enable test in config_test.go, once we have new llvm-next flags. -var llvmNextFlags = []string{} +var llvmNextFlags = []string{ + "-Wno-unused-but-set-variable", +} var llvmNextPostFlags = []string{} diff --git a/compiler_wrapper/cros_nonhardened_config_test.go b/compiler_wrapper/cros_nonhardened_config_test.go index 4883c5f9..3d413fb8 100644 --- a/compiler_wrapper/cros_nonhardened_config_test.go +++ b/compiler_wrapper/cros_nonhardened_config_test.go @@ -12,6 +12,8 @@ const crosNonHardenedGoldenDir = "testdata/cros_nonhardened_golden" func TestCrosNonHardenedConfig(t *testing.T) { withTestContext(t, func(ctx *testContext) { + ctx.NoteTestWritesToUmask() + useLlvmNext := false useCCache := true cfg, err := getConfig("cros.nonhardened", useCCache, useLlvmNext, "123") diff --git a/compiler_wrapper/disable_werror_flag.go b/compiler_wrapper/disable_werror_flag.go index 5c21b1ad..cb770b7b 100644 --- a/compiler_wrapper/disable_werror_flag.go +++ b/compiler_wrapper/disable_werror_flag.go @@ -14,7 +14,6 @@ import ( "path" "strconv" "strings" - "syscall" ) const numWErrorEstimate = 30 @@ -176,8 +175,8 @@ func doubleBuildWithWNoError(env env, cfg *config, originalCmd *command) (exitCo // Buildbots use a nonzero umask, which isn't quite what we want: these directories should // be world-readable and world-writable. - oldMask := syscall.Umask(0) - defer syscall.Umask(oldMask) + oldMask := env.umask(0) + defer env.umask(oldMask) // Allow root and regular users to write to this without issue. if err := os.MkdirAll(cfg.newWarningsDir, 0777); err != nil { diff --git a/compiler_wrapper/disable_werror_flag_test.go b/compiler_wrapper/disable_werror_flag_test.go index d0054262..592c35ba 100644 --- a/compiler_wrapper/disable_werror_flag_test.go +++ b/compiler_wrapper/disable_werror_flag_test.go @@ -318,6 +318,8 @@ func TestLogWarningsWhenDoubleBuildFails(t *testing.T) { func withForceDisableWErrorTestContext(t *testing.T, work func(ctx *testContext)) { withTestContext(t, func(ctx *testContext) { + ctx.NoteTestWritesToUmask() + ctx.env = []string{"FORCE_DISABLE_WERROR=1"} work(ctx) }) diff --git a/compiler_wrapper/env.go b/compiler_wrapper/env.go index 2c48ad30..c8f6ceb3 100644 --- a/compiler_wrapper/env.go +++ b/compiler_wrapper/env.go @@ -10,9 +10,12 @@ import ( "io" "os" "strings" + "syscall" + "time" ) type env interface { + umask(int) int getenv(key string) (string, bool) environ() []string getwd() string @@ -20,6 +23,7 @@ type env interface { stdout() io.Writer stderr() io.Writer run(cmd *command, stdin io.Reader, stdout io.Writer, stderr io.Writer) error + runWithTimeout(cmd *command, duration time.Duration) error exec(cmd *command) error } @@ -52,6 +56,10 @@ func newProcessEnv() (env, error) { var _ env = (*processEnv)(nil) +func (env *processEnv) umask(newmask int) (oldmask int) { + return syscall.Umask(newmask) +} + func (env *processEnv) getenv(key string) (string, bool) { return os.LookupEnv(key) } @@ -80,6 +88,10 @@ func (env *processEnv) exec(cmd *command) error { return execCmd(env, cmd) } +func (env *processEnv) runWithTimeout(cmd *command, duration time.Duration) error { + return runCmdWithTimeout(env, cmd, duration) +} + func (env *processEnv) run(cmd *command, stdin io.Reader, stdout io.Writer, stderr io.Writer) error { return runCmd(env, cmd, stdin, stdout, stderr) } @@ -108,6 +120,10 @@ func (env *commandRecordingEnv) exec(cmd *command) error { return env.run(cmd, env.stdin(), env.stdout(), env.stderr()) } +func (env *commandRecordingEnv) runWithTimeout(cmd *command, duration time.Duration) error { + return env.runWithTimeout(cmd, duration) +} + func (env *commandRecordingEnv) run(cmd *command, stdin io.Reader, stdout io.Writer, stderr io.Writer) error { stdoutBuffer := &bytes.Buffer{} stderrBuffer := &bytes.Buffer{} @@ -134,6 +150,11 @@ func (env *printingEnv) exec(cmd *command) error { return env.env.exec(cmd) } +func (env *printingEnv) runWithTimeout(cmd *command, duration time.Duration) error { + printCmd(env, cmd) + return env.env.runWithTimeout(cmd, duration) +} + func (env *printingEnv) run(cmd *command, stdin io.Reader, stdout io.Writer, stderr io.Writer) error { printCmd(env, cmd) return env.env.run(cmd, stdin, stdout, stderr) diff --git a/compiler_wrapper/env_test.go b/compiler_wrapper/env_test.go index e03d60a8..b5bf65a3 100644 --- a/compiler_wrapper/env_test.go +++ b/compiler_wrapper/env_test.go @@ -6,13 +6,17 @@ package main import ( "bytes" + "context" + "errors" "flag" "io/ioutil" "os" "os/exec" + "path" "path/filepath" "strings" "testing" + "time" ) // Attention: The tests in this file execute the test binary again with the `-run` flag. @@ -164,6 +168,48 @@ func TestProcessEnvRunCmdDeleteEnv(t *testing.T) { }) } +func TestRunWithTimeoutRunsTheGivenProcess(t *testing.T) { + withTestContext(t, func(ctx *testContext) { + env, err := newProcessEnv() + if err != nil { + t.Fatalf("Unexpected error making new process env: %v", err) + } + + tempFile := path.Join(ctx.tempDir, "some_file") + cmd := &command{ + Path: "touch", + Args: []string{tempFile}, + } + if err := env.runWithTimeout(cmd, time.Second*120); err != nil { + t.Fatalf("Unexpected error touch'ing %q: %v", tempFile, err) + } + + // This should be fine, since `touch` should've created the file. + if _, err := os.Stat(tempFile); err != nil { + t.Errorf("Stat'ing temp file at %q failed: %v", tempFile, err) + } + }) +} + +func TestRunWithTimeoutReturnsErrorOnTimeout(t *testing.T) { + withTestContext(t, func(ctx *testContext) { + env, err := newProcessEnv() + if err != nil { + t.Fatalf("Unexpected error making new process env: %v", err) + } + + cmd := &command{ + Path: "sleep", + Args: []string{"30"}, + } + + err = env.runWithTimeout(cmd, 100*time.Millisecond) + if !errors.Is(err, context.DeadlineExceeded) { + t.Errorf("Expected context.DeadlineExceeded after `sleep` timed out; got error: %v", err) + } + }) +} + func TestNewProcessEnvResolvesPwdAwayProperly(t *testing.T) { // This test cannot be t.Parallel(), since it modifies our environment. const envPwd = "PWD" diff --git a/compiler_wrapper/gomacc_flag.go b/compiler_wrapper/gomacc_flag.go deleted file mode 100644 index ac298b12..00000000 --- a/compiler_wrapper/gomacc_flag.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2019 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. - -package main - -import ( - "os" -) - -func processGomaCccFlags(builder *commandBuilder) (gomaUsed bool, err error) { - gomaPath := "" - nextArgIsGomaPath := false - builder.transformArgs(func(arg builderArg) string { - if arg.fromUser { - if arg.value == "--gomacc-path" { - nextArgIsGomaPath = true - return "" - } - if nextArgIsGomaPath { - gomaPath = arg.value - nextArgIsGomaPath = false - return "" - } - } - return arg.value - }) - if nextArgIsGomaPath { - return false, newUserErrorf("--gomacc-path given without value") - } - if gomaPath == "" { - gomaPath, _ = builder.env.getenv("GOMACC_PATH") - } - if gomaPath != "" { - if _, err := os.Lstat(gomaPath); err == nil { - builder.wrapPath(gomaPath) - return true, nil - } - } - return false, nil -} diff --git a/compiler_wrapper/gomacc_flag_test.go b/compiler_wrapper/gomacc_flag_test.go deleted file mode 100644 index d7b2b0b7..00000000 --- a/compiler_wrapper/gomacc_flag_test.go +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2019 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. - -package main - -import ( - "path" - "testing" -) - -func TestCallGomaccIfEnvIsGivenAndValid(t *testing.T) { - withTestContext(t, func(ctx *testContext) { - gomaPath := path.Join(ctx.tempDir, "gomacc") - // Create a file so the gomacc path is valid. - ctx.writeFile(gomaPath, "") - ctx.env = []string{"GOMACC_PATH=" + gomaPath} - cmd := ctx.must(callCompiler(ctx, ctx.cfg, - ctx.newCommand(gccX86_64, mainCc))) - if err := verifyPath(cmd, gomaPath); err != nil { - t.Error(err) - } - if err := verifyArgOrder(cmd, gccX86_64+".real", mainCc); err != nil { - t.Error(err) - } - }) -} - -func TestOmitGomaccIfEnvIsGivenButInvalid(t *testing.T) { - withTestContext(t, func(ctx *testContext) { - // Note: This path does not point to a valid file. - gomaPath := path.Join(ctx.tempDir, "gomacc") - ctx.env = []string{"GOMACC_PATH=" + gomaPath} - cmd := ctx.must(callCompiler(ctx, ctx.cfg, - ctx.newCommand(gccX86_64, mainCc))) - if err := verifyPath(cmd, gccX86_64+".real"); err != nil { - t.Error(err) - } - }) -} - -func TestCallGomaccIfArgIsGivenAndValid(t *testing.T) { - withTestContext(t, func(ctx *testContext) { - gomaPath := path.Join(ctx.tempDir, "gomacc") - // Create a file so the gomacc path is valid. - ctx.writeFile(gomaPath, "") - cmd := ctx.must(callCompiler(ctx, ctx.cfg, - ctx.newCommand(gccX86_64, mainCc, "--gomacc-path", gomaPath))) - if err := verifyPath(cmd, gomaPath); err != nil { - t.Error(err) - } - if err := verifyArgCount(cmd, 0, "--gomacc-path"); err != nil { - t.Error(err) - } - if err := verifyArgCount(cmd, 0, gomaPath); err != nil { - t.Error(err) - } - if err := verifyArgOrder(cmd, gccX86_64+".real", mainCc); err != nil { - t.Error(err) - } - }) -} - -func TestOmitGomaccIfArgIsGivenButInvalid(t *testing.T) { - withTestContext(t, func(ctx *testContext) { - // Note: This path does not point to a valid file. - gomaPath := path.Join(ctx.tempDir, "gomacc") - cmd := ctx.must(callCompiler(ctx, ctx.cfg, - ctx.newCommand(gccX86_64, mainCc, "--gomacc-path", gomaPath))) - if err := verifyPath(cmd, gccX86_64+".real"); err != nil { - t.Error(err) - } - }) -} - -func TestErrorOnGomaccArgWithoutValue(t *testing.T) { - withTestContext(t, func(ctx *testContext) { - stderr := ctx.mustFail(callCompiler(ctx, ctx.cfg, - ctx.newCommand(gccX86_64, mainCc, "--gomacc-path"))) - if err := verifyNonInternalError(stderr, "--gomacc-path given without value"); err != nil { - t.Error(err) - } - }) -} - -func TestOmitGomaccByDefault(t *testing.T) { - withTestContext(t, func(ctx *testContext) { - cmd := ctx.must(callCompiler(ctx, ctx.cfg, - ctx.newCommand(gccX86_64, mainCc))) - if err := verifyPath(cmd, gccX86_64+".real"); err != nil { - t.Error(err) - } - }) -} diff --git a/compiler_wrapper/install_compiler_wrapper.sh b/compiler_wrapper/install_compiler_wrapper.sh index 479b112c..3a5b7417 100755 --- a/compiler_wrapper/install_compiler_wrapper.sh +++ b/compiler_wrapper/install_compiler_wrapper.sh @@ -19,7 +19,16 @@ 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 +./build.py --config=cros.hardened --use_ccache=false --use_llvm_next=false --output_file=./sysroot_wrapper.hardened.noccache +./build.py --config=cros.hardened --use_ccache=true --use_llvm_next=false --output_file=./sysroot_wrapper.hardened.ccache +# Update clang target wrappers. +sudo cp ./sysroot_wrapper.hardened.noccache ./sysroot_wrapper.hardened.ccache /usr/bin +echo "Updated clang wrapper /usr/bin/sysroot_wrapper.hardened.noccache" +echo "Updated clang wrapper /usr/bin/sysroot_wrapper.hardened.ccache" + +# Update GCC 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 @@ -29,12 +38,12 @@ for GCC in cross-x86_64-cros-linux-gnu/gcc cross-armv7a-cros-linux-gnueabihf/gcc # 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}")" + echo "Updating ${GCC} wrapper." + sudo cp ./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}")" + sudo cp ./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 +rm -f ./sysroot_wrapper.hardened.noccache ./sysroot_wrapper.hardened.ccache diff --git a/compiler_wrapper/libgcc_flags.go b/compiler_wrapper/libgcc_flags.go new file mode 100644 index 00000000..72fa8381 --- /dev/null +++ b/compiler_wrapper/libgcc_flags.go @@ -0,0 +1,25 @@ +// Copyright 2021 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. + +package main + +import ( + "strings" +) + +// Add "-static-libgcc" flag to compiler command line unless +// already specified by user or user has passed "-shared-libgcc". +func processLibGCCFlags(builder *commandBuilder) { + fromUser := false + for _, arg := range builder.args { + if arg.fromUser && (strings.HasPrefix(arg.value, "-shared-libgcc") || + strings.HasPrefix(arg.value, "-static-libgcc")) { + fromUser = true + break + } + } + if !fromUser { + builder.addPreUserArgs("-static-libgcc") + } +} diff --git a/compiler_wrapper/libgcc_flags_test.go b/compiler_wrapper/libgcc_flags_test.go new file mode 100644 index 00000000..717c0e52 --- /dev/null +++ b/compiler_wrapper/libgcc_flags_test.go @@ -0,0 +1,57 @@ +// Copyright 2021 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. + +package main + +import ( + "testing" +) + +func TestDefaultStaticLibGCC(t *testing.T) { + withTestContext(t, func(ctx *testContext) { + runWithCompiler := func(compiler string) { + cmd := ctx.must(callCompiler(ctx, ctx.cfg, + ctx.newCommand(compiler, mainCc))) + if err := verifyArgCount(cmd, 1, "-static-libgcc"); err != nil { + t.Error(err) + } + } + + runWithCompiler(gccX86_64) + runWithCompiler(clangX86_64) + }) +} + +func TestKeepStaticLibGCCWithUserArgs(t *testing.T) { + withTestContext(t, func(ctx *testContext) { + runWithCompiler := func(compiler string) { + cmd := ctx.must(callCompiler(ctx, ctx.cfg, + ctx.newCommand(compiler, "-static-libgcc", mainCc))) + if err := verifyArgOrder(cmd, "-static-libgcc", mainCc); err != nil { + t.Error(err) + } + } + + runWithCompiler(gccX86_64) + runWithCompiler(clangX86_64) + }) +} + +func TestNoAddedStaticLibGCCWithSharedLibGCC(t *testing.T) { + withTestContext(t, func(ctx *testContext) { + runWithCompiler := func(compiler string) { + cmd := ctx.must(callCompiler(ctx, ctx.cfg, + ctx.newCommand(compiler, "-shared-libgcc", mainCc))) + if err := verifyArgCount(cmd, 0, "-static-libgcc"); err != nil { + t.Error(err) + } + if err := verifyArgCount(cmd, 1, "-shared-libgcc"); err != nil { + t.Error(err) + } + } + + runWithCompiler(gccX86_64) + runWithCompiler(clangX86_64) + }) +} diff --git a/compiler_wrapper/remote_build_flag_test.go b/compiler_wrapper/remote_build_flag_test.go new file mode 100644 index 00000000..4a894179 --- /dev/null +++ b/compiler_wrapper/remote_build_flag_test.go @@ -0,0 +1,251 @@ +// Copyright 2019 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. + +package main + +import ( + "os" + "path" + "reflect" + "testing" +) + +func TestCommandlineFlagParsing(t *testing.T) { + withTestContext(t, func(ctx *testContext) { + type testCase struct { + extraFlags []string + // If this is nonempty, expectedValue is ignored. Otherwise, expectedValue + // has the expected value for the flag, and expectedCommand has the expected + // (extra) flags in the builder after filtering. + expectedError string + expectedValue string + expectedExtraFlags []string + } + + const flagName = "--flag" + testCases := []testCase{ + { + extraFlags: nil, + expectedError: errNoSuchCmdlineArg.Error(), + }, + { + extraFlags: []string{flagName + "a"}, + expectedError: errNoSuchCmdlineArg.Error(), + }, + { + extraFlags: []string{flagName}, + expectedError: "flag \"" + flagName + "\" requires a value", + }, + { + extraFlags: []string{flagName, "foo"}, + expectedValue: "foo", + expectedExtraFlags: nil, + }, + { + extraFlags: []string{flagName + "=foo"}, + expectedValue: "foo", + expectedExtraFlags: nil, + }, + { + extraFlags: []string{flagName + "="}, + expectedValue: "", + expectedExtraFlags: nil, + }, + { + extraFlags: []string{flagName + "=foo", flagName + "=bar"}, + expectedValue: "foo", + expectedExtraFlags: []string{flagName + "=bar"}, + }, + } + + for _, testCase := range testCases { + cmd := ctx.newCommand(gccX86_64, testCase.extraFlags...) + builder, err := newCommandBuilder(ctx, ctx.cfg, cmd) + if err != nil { + t.Fatalf("Failed creating a command builder: %v", err) + } + + flagValue, err := removeOneUserCmdlineFlagWithValue(builder, flagName) + if err != nil { + if testCase.expectedError == "" { + t.Errorf("given extra flags %q, got unexpected error removing %q: %v", testCase.extraFlags, flagName, err) + continue + } + + if e := err.Error(); e != testCase.expectedError { + t.Errorf("given extra flags %q, got error %q; wanted %q", testCase.extraFlags, e, testCase.expectedError) + } + continue + } + + if testCase.expectedError != "" { + t.Errorf("given extra flags %q, got no error, but expected %q", testCase.extraFlags, testCase.expectedError) + continue + } + + if flagValue != testCase.expectedValue { + t.Errorf("given extra flags %q, got value %q, but expected %q", testCase.extraFlags, flagValue, testCase.expectedValue) + } + + currentFlags := []string{} + // Chop off the first arg, which should just be the compiler + for _, a := range builder.args { + currentFlags = append(currentFlags, a.value) + } + + sameFlags := (len(currentFlags) == 0 && len(testCase.expectedExtraFlags) == 0) || reflect.DeepEqual(currentFlags, testCase.expectedExtraFlags) + if !sameFlags { + t.Errorf("given extra flags %q, got post-removal flags %q, but expected %q", testCase.extraFlags, currentFlags, testCase.expectedExtraFlags) + } + } + }) +} + +func TestCallGomaccIfEnvIsGivenAndValid(t *testing.T) { + withGomaccTestContext(t, func(ctx *testContext, gomaPath string) { + ctx.env = []string{"GOMACC_PATH=" + gomaPath} + cmd := ctx.must(callCompiler(ctx, ctx.cfg, + ctx.newCommand(gccX86_64, mainCc))) + if err := verifyPath(cmd, gomaPath); err != nil { + t.Error(err) + } + if err := verifyArgOrder(cmd, gccX86_64+".real", mainCc); err != nil { + t.Error(err) + } + }) +} + +func TestOmitGomaccIfEnvIsGivenButInvalid(t *testing.T) { + withGomaccTestContext(t, func(ctx *testContext, gomaPath string) { + if err := os.Remove(gomaPath); err != nil { + t.Fatalf("failed removing fake goma file at %q: %v", gomaPath, err) + } + + ctx.env = []string{"GOMACC_PATH=" + gomaPath} + cmd := ctx.must(callCompiler(ctx, ctx.cfg, + ctx.newCommand(gccX86_64, mainCc))) + if err := verifyPath(cmd, gccX86_64+".real"); err != nil { + t.Error(err) + } + }) +} + +func TestCallGomaccIfArgIsGivenAndValid(t *testing.T) { + withGomaccTestContext(t, func(ctx *testContext, gomaPath string) { + cmd := ctx.must(callCompiler(ctx, ctx.cfg, + ctx.newCommand(gccX86_64, mainCc, "--gomacc-path", gomaPath))) + if err := verifyPath(cmd, gomaPath); err != nil { + t.Error(err) + } + if err := verifyArgCount(cmd, 0, "--gomacc-path"); err != nil { + t.Error(err) + } + if err := verifyArgCount(cmd, 0, gomaPath); err != nil { + t.Error(err) + } + if err := verifyArgOrder(cmd, gccX86_64+".real", mainCc); err != nil { + t.Error(err) + } + }) +} + +func TestOmitGomaccIfArgIsGivenButInvalid(t *testing.T) { + withGomaccTestContext(t, func(ctx *testContext, gomaPath string) { + if err := os.Remove(gomaPath); err != nil { + t.Fatalf("failed removing fake goma file at %q: %v", gomaPath, err) + } + + cmd := ctx.must(callCompiler(ctx, ctx.cfg, + ctx.newCommand(gccX86_64, mainCc, "--gomacc-path", gomaPath))) + if err := verifyPath(cmd, gccX86_64+".real"); err != nil { + t.Error(err) + } + }) +} + +func TestErrorOnGomaccArgWithoutValue(t *testing.T) { + withTestContext(t, func(ctx *testContext) { + stderr := ctx.mustFail(callCompiler(ctx, ctx.cfg, + ctx.newCommand(gccX86_64, mainCc, "--gomacc-path"))) + if err := verifyNonInternalError(stderr, "flag \"--gomacc-path\" requires a value"); err != nil { + t.Error(err) + } + }) +} + +func TestOmitGomaccByDefault(t *testing.T) { + withTestContext(t, func(ctx *testContext) { + cmd := ctx.must(callCompiler(ctx, ctx.cfg, + ctx.newCommand(gccX86_64, mainCc))) + if err := verifyPath(cmd, gccX86_64+".real"); err != nil { + t.Error(err) + } + }) +} + +func withGomaccTestContext(t *testing.T, f func(*testContext, string)) { + withTestContext(t, func(ctx *testContext) { + gomaPath := path.Join(ctx.tempDir, "gomacc") + // Create a file so the gomacc path is valid. + ctx.writeFile(gomaPath, "") + f(ctx, gomaPath) + }) +} + +func TestRewrapperDefersToTheWrapperProperly(t *testing.T) { + withTestContext(t, func(ctx *testContext) { + cmd := ctx.must(callCompiler(ctx, ctx.cfg, + ctx.newCommand(gccX86_64, mainCc, "--rewrapper-path", "/rewrapper", "--rewrapper-cfg", "/some-cfg", "some", "other", "args"))) + if err := verifyPath(cmd, "/rewrapper"); err != nil { + t.Error(err) + } + if err := verifyArgOrder(cmd, "-cfg", "/some-cfg", gccX86_64+".real", mainCc, "some", "other", "args"); err != nil { + t.Error(err) + } + }) +} + +func TestRewrapperCfgMustBePrsentIfRewrapperPathIs(t *testing.T) { + withGomaccTestContext(t, func(ctx *testContext, gomaPath string) { + stderr := ctx.mustFail(callCompiler(ctx, ctx.cfg, + ctx.newCommand(gccX86_64, mainCc, "--rewrapper-path", "/rewrapper"))) + if err := verifyNonInternalError(stderr, "--rewrapper-cfg must be specified if --rewrapper-path is"); err != nil { + t.Error(err) + } + }) +} + +func TestRewrapperPathMustBePrsentIfRewrapperCfgIs(t *testing.T) { + withGomaccTestContext(t, func(ctx *testContext, gomaPath string) { + stderr := ctx.mustFail(callCompiler(ctx, ctx.cfg, + ctx.newCommand(gccX86_64, mainCc, "--rewrapper-cfg", "/some-cfg"))) + if err := verifyNonInternalError(stderr, "--rewrapper-path must be specified if --rewrapper-cfg is"); err != nil { + t.Error(err) + } + }) +} + +func TestRewrapperAndGomaAreMutuallyExclusive(t *testing.T) { + withGomaccTestContext(t, func(ctx *testContext, gomaPath string) { + stderr := ctx.mustFail(callCompiler(ctx, ctx.cfg, + ctx.newCommand(gccX86_64, mainCc, "--rewrapper-path", "/rewrapper", "--rewrapper-cfg", "/some-cfg", "--gomacc-path", gomaPath))) + if err := verifyNonInternalError(stderr, "rewrapper and gomacc are mutually exclusive"); err != nil { + t.Error(err) + } + }) +} + +func TestRewrapperBlocksGomaInheritanceFromEnv(t *testing.T) { + withGomaccTestContext(t, func(ctx *testContext, gomaPath string) { + ctx.env = []string{"GOMACC_PATH=" + gomaPath} + cmd := ctx.must(callCompiler(ctx, ctx.cfg, + ctx.newCommand(gccX86_64, mainCc, "--rewrapper-path", "/rewrapper", "--rewrapper-cfg", "/some-cfg"))) + if err := verifyPath(cmd, "/rewrapper"); err != nil { + t.Error(err) + } + if err := verifyArgOrder(cmd, "-cfg", "/some-cfg", gccX86_64+".real", mainCc); err != nil { + t.Error(err) + } + }) +} diff --git a/compiler_wrapper/remote_build_flags.go b/compiler_wrapper/remote_build_flags.go new file mode 100644 index 00000000..fc26c93f --- /dev/null +++ b/compiler_wrapper/remote_build_flags.go @@ -0,0 +1,160 @@ +// Copyright 2019 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. + +package main + +import ( + "errors" + "fmt" + "os" + "strings" +) + +var errNoSuchCmdlineArg = errors.New("no such commandline argument") + +// Removes one flag from `builder`, assuming that a value follows the flag. Two formats are +// supported for this: `--foo=bar` and `--foo bar`. In either case, "bar" will be returned as the +// `value`. +// +// If no flag is found on the commandline, this returns the `errNoSuchCmdlineArg` error. `builder` +// is unmodified if this error is returned, but its contents are unspecified if any other error is +// returned. +// +// In the case of multiple such flags, only the first encountered will be removed. +func removeOneUserCmdlineFlagWithValue(builder *commandBuilder, flagName string) (flagValue string, err error) { + const ( + searchingForFlag uint8 = iota + searchingForValue + searchComplete + ) + + flagRequiresAValue := func() error { return newUserErrorf("flag %q requires a value", flagName) } + searchState := searchingForFlag + builder.transformArgs(func(arg builderArg) string { + if err != nil { + return arg.value + } + + switch searchState { + case searchingForFlag: + if !arg.fromUser { + return arg.value + } + + if arg.value == flagName { + searchState = searchingForValue + return "" + } + + isArgEq := strings.HasPrefix(arg.value, flagName) && arg.value[len(flagName)] == '=' + if !isArgEq { + return arg.value + } + + flagValue = arg.value[len(flagName)+1:] + searchState = searchComplete + return "" + + case searchingForValue: + if !arg.fromUser { + err = flagRequiresAValue() + return arg.value + } + + flagValue = arg.value + searchState = searchComplete + return "" + + case searchComplete: + return arg.value + + default: + panic(fmt.Sprintf("unknown search state: %v", searchState)) + } + }) + + if err != nil { + return "", err + } + + switch searchState { + case searchingForFlag: + return "", errNoSuchCmdlineArg + + case searchingForValue: + return "", flagRequiresAValue() + + case searchComplete: + return flagValue, nil + + default: + panic(fmt.Sprintf("unknown search state: %v", searchState)) + } +} + +func processGomaCccFlags(builder *commandBuilder, inheritFromEnv bool) (gomaUsed bool, err error) { + gomaPath, err := removeOneUserCmdlineFlagWithValue(builder, "--gomacc-path") + if err != nil && err != errNoSuchCmdlineArg { + return false, err + } + + if inheritFromEnv && (err == errNoSuchCmdlineArg || gomaPath == "") { + gomaPath, _ = builder.env.getenv("GOMACC_PATH") + } + + if gomaPath != "" { + if _, err := os.Lstat(gomaPath); err == nil { + builder.wrapPath(gomaPath) + return true, nil + } + } + return false, nil +} + +func processRewrapperCcFlags(builder *commandBuilder) (rewrapperUsed bool, err error) { + rewrapperPath, pathErr := removeOneUserCmdlineFlagWithValue(builder, "--rewrapper-path") + if pathErr != nil && pathErr != errNoSuchCmdlineArg { + return false, err + } + + rewrapperCfg, cfgErr := removeOneUserCmdlineFlagWithValue(builder, "--rewrapper-cfg") + if cfgErr != nil && cfgErr != errNoSuchCmdlineArg { + return false, err + } + + if pathErr == errNoSuchCmdlineArg { + if cfgErr != errNoSuchCmdlineArg { + return false, newUserErrorf("--rewrapper-path must be specified if --rewrapper-cfg is") + } + return false, nil + } + + if cfgErr == errNoSuchCmdlineArg { + return false, newUserErrorf("--rewrapper-cfg must be specified if --rewrapper-path is") + } + + // It's unclear that we should have a similar fallback to gomacc if --rewrapper-path doesn't + // exist, so don't until it's obviously necessary. + builder.wrapPath(rewrapperPath, "-cfg", rewrapperCfg) + return true, nil +} + +func processRemoteBuildFlags(builder *commandBuilder) (remoteBuildUsed bool, err error) { + rewrapperUsed, err := processRewrapperCcFlags(builder) + if err != nil { + return rewrapperUsed, err + } + + inheritGomaFromEnv := !rewrapperUsed + gomaUsed, err := processGomaCccFlags(builder, inheritGomaFromEnv) + remoteBuildUsed = gomaUsed || rewrapperUsed + if err != nil { + return remoteBuildUsed, err + } + + if gomaUsed && rewrapperUsed { + return true, newUserErrorf("rewrapper and gomacc are mutually exclusive") + } + return remoteBuildUsed, nil +} diff --git a/compiler_wrapper/rusage_flag.go b/compiler_wrapper/rusage_flag.go index 4aa40b4d..63469602 100644 --- a/compiler_wrapper/rusage_flag.go +++ b/compiler_wrapper/rusage_flag.go @@ -101,8 +101,8 @@ func maybeCaptureRusage(env env, compilerCmd *command, action func(willLogRusage // We need to temporarily set umask to 0 to ensure 777 permissions are actually 777 // This effects builderbots in particular - oldMask := syscall.Umask(0) - defer syscall.Umask(oldMask) + oldMask := env.umask(0) + defer env.umask(oldMask) // We want to know what package is being compiled. The working directory gives us a good clue. cwd, err := os.Getwd() diff --git a/compiler_wrapper/rusage_flag_test.go b/compiler_wrapper/rusage_flag_test.go index 940f4a79..439cfd15 100644 --- a/compiler_wrapper/rusage_flag_test.go +++ b/compiler_wrapper/rusage_flag_test.go @@ -159,6 +159,8 @@ func TestLogRusageAppendsToFile(t *testing.T) { func withLogRusageTestContext(t *testing.T, work func(ctx *testContext)) { withTestContext(t, func(ctx *testContext) { + ctx.NoteTestWritesToUmask() + ctx.env = []string{"TOOLCHAIN_RUSAGE_OUTPUT=" + filepath.Join(ctx.tempDir, "rusage.log")} work(ctx) }) diff --git a/compiler_wrapper/sysroot_flag_test.go b/compiler_wrapper/sysroot_flag_test.go index 308d5e96..b05a627e 100644 --- a/compiler_wrapper/sysroot_flag_test.go +++ b/compiler_wrapper/sysroot_flag_test.go @@ -57,7 +57,7 @@ func TestClearEmptySysrootFlagInEnv(t *testing.T) { func TestSetSysrootRelativeToWrapperPath(t *testing.T) { withTestContext(t, func(ctx *testContext) { - ctx.cfg.rootRelPath = "somepath" + ctx.cfg.gccRootRelPath = "somepath" cmd := ctx.must(callCompiler(ctx, ctx.cfg, ctx.newCommand(gccX86_64, mainCc))) if err := verifyArgOrder(cmd, @@ -69,7 +69,7 @@ func TestSetSysrootRelativeToWrapperPath(t *testing.T) { func TestSetSysrootRelativeToSymlinkedWrapperPath(t *testing.T) { withTestContext(t, func(ctx *testContext) { - ctx.cfg.rootRelPath = "somepath" + ctx.cfg.gccRootRelPath = "somepath" linkedWrapperPath := path.Join(ctx.tempDir, "a/linked/path/x86_64-cros-linux-gnu-gcc") ctx.symlink(path.Join(ctx.tempDir, gccX86_64), linkedWrapperPath) diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/bisect.json b/compiler_wrapper/testdata/cros_clang_host_golden/bisect.json index d6d1a308..fae0f9f5 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/bisect.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/bisect.json @@ -29,7 +29,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -37,12 +36,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ], "env_updates": [ "PYTHONPATH=/somepath/test_binary" @@ -82,7 +83,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -90,12 +90,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ], "env_updates": [ "PYTHONPATH=/somepath/test_binary" @@ -138,7 +140,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -146,12 +147,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ], "env_updates": [ "PYTHONPATH=/somepath/test_binary" diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clang_ftrapv_maincc_target_specific.json b/compiler_wrapper/testdata/cros_clang_host_golden/clang_ftrapv_maincc_target_specific.json index ce992fa3..947f1a4d 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clang_ftrapv_maincc_target_specific.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clang_ftrapv_maincc_target_specific.json @@ -20,7 +20,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -28,12 +27,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -60,7 +61,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -68,12 +68,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -100,7 +102,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -108,12 +109,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -140,7 +143,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -148,12 +150,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -180,7 +184,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -188,12 +191,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -220,7 +225,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -228,12 +232,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -260,7 +266,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -268,12 +273,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -300,7 +307,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -308,12 +314,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -340,7 +348,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -348,12 +355,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clang_host_wrapper.json b/compiler_wrapper/testdata/cros_clang_host_golden/clang_host_wrapper.json index 1411ba22..9267f5b4 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clang_host_wrapper.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clang_host_wrapper.json @@ -19,7 +19,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -27,12 +26,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clang_maincc_target_specific.json b/compiler_wrapper/testdata/cros_clang_host_golden/clang_maincc_target_specific.json index 1e7b84d9..c7a4a6a7 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clang_maincc_target_specific.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clang_maincc_target_specific.json @@ -19,7 +19,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -27,12 +26,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -58,7 +59,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -66,12 +66,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -97,7 +99,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -105,12 +106,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -136,7 +139,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -144,12 +146,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -175,7 +179,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -183,12 +186,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -214,7 +219,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -222,12 +226,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -253,7 +259,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -261,12 +266,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -292,7 +299,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -300,12 +306,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -331,7 +339,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -339,12 +346,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clang_path.json b/compiler_wrapper/testdata/cros_clang_host_golden/clang_path.json index 56eb92c6..96b3fe50 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clang_path.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clang_path.json @@ -19,7 +19,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -27,12 +26,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -61,7 +62,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -69,12 +69,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] }, "stdout": "somemessage", @@ -103,7 +105,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -111,12 +112,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -145,7 +148,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -153,12 +155,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -194,7 +198,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -202,6 +205,7 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-resource-dir=someResourceDir", @@ -209,7 +213,8 @@ "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -248,7 +253,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -256,6 +260,7 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-resource-dir=someResourceDir", @@ -263,7 +268,8 @@ "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -302,7 +308,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -310,6 +315,7 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-resource-dir=someResourceDir", @@ -317,7 +323,8 @@ "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] }, "stdout": "somemessage", @@ -346,7 +353,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -354,12 +360,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -385,7 +393,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -393,12 +400,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -424,7 +433,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -432,12 +440,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -463,7 +473,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -471,12 +480,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -505,7 +516,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -513,12 +523,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clang_sanitizer_args.json b/compiler_wrapper/testdata/cros_clang_host_golden/clang_sanitizer_args.json index 4e99c843..14e45b27 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clang_sanitizer_args.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clang_sanitizer_args.json @@ -21,7 +21,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -29,13 +28,15 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fsanitize=kernel-address", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -63,7 +64,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -71,13 +71,15 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fsanitize=kernel-address", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -105,7 +107,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -113,13 +114,15 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fsanitize=kernel-address", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -147,7 +150,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -155,13 +157,15 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fsanitize=kernel-address", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -188,7 +192,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -196,6 +199,7 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fno-experimental-new-pass-manager", @@ -203,7 +207,8 @@ "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -231,7 +236,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -239,6 +243,7 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fno-experimental-new-pass-manager", @@ -247,7 +252,8 @@ "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -274,7 +280,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -282,13 +287,15 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fsanitize=address", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -315,7 +322,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -323,13 +329,15 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fprofile-instr-generate", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clang_specific_args.json b/compiler_wrapper/testdata/cros_clang_host_golden/clang_specific_args.json index 646f464d..01a50a96 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clang_specific_args.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clang_specific_args.json @@ -29,7 +29,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -37,6 +36,7 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-mno-movbe", @@ -50,7 +50,8 @@ "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -77,7 +78,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -85,13 +85,15 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-Wno-#warnings", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -118,89 +120,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", - "-Wno-tautological-constant-compare", - "-Wno-tautological-unsigned-enum-zero-compare", - "-Wno-final-dtor-non-final-class", - "-Werror=poison-system-directories", - "-Wno-unknown-warning-option", - "-fexperimental-new-pass-manager", - "-Wno-compound-token-split-by-macro", - "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", - "-fcommon", - "-Wno-error=uninitialized", - "main.cc", - "-Wno-implicit-int-float-conversion", - "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" - ] - } - } - ] - }, - { - "wd": "/tmp/stable", - "wrapper": { - "cmd": { - "path": "./x86_64-cros-linux-gnu-clang", - "args": [ - "-Wno-error=unused-but-set-variable", - "main.cc" - ] - } - }, - "cmds": [ - { - "cmd": { - "path": "/tmp/stable/clang", - "args": [ - "-Qunused-arguments", - "-fno-addrsig", - "-fuse-ld=lld", - "-fdebug-default-version=5", - "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", - "-Wno-tautological-constant-compare", - "-Wno-tautological-unsigned-enum-zero-compare", - "-Wno-final-dtor-non-final-class", - "-Werror=poison-system-directories", - "-Wno-unknown-warning-option", - "-fexperimental-new-pass-manager", - "-Wno-compound-token-split-by-macro", - "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", - "-fcommon", - "-Wno-error=unused-variable", - "main.cc", - "-Wno-implicit-int-float-conversion", - "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" - ] - } - } - ] - }, - { - "wd": "/tmp/stable", - "wrapper": { - "cmd": { - "path": "./x86_64-cros-linux-gnu-clang", - "args": [ - "-Wno-unused-but-set-variable", - "main.cc" - ] - } - }, - "cmds": [ - { - "cmd": { - "path": "/tmp/stable/clang", - "args": [ - "-Qunused-arguments", - "-fno-addrsig", - "-fuse-ld=lld", - "-fdebug-default-version=5", - "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -208,54 +127,15 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", - "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", - "-fcommon", - "-Wno-unused-variable", - "main.cc", - "-Wno-implicit-int-float-conversion", - "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" - ] - } - } - ] - }, - { - "wd": "/tmp/stable", - "wrapper": { - "cmd": { - "path": "./x86_64-cros-linux-gnu-clang", - "args": [ - "-Wunused-but-set-variable", - "main.cc" - ] - } - }, - "cmds": [ - { - "cmd": { - "path": "/tmp/stable/clang", - "args": [ - "-Qunused-arguments", - "-fno-addrsig", - "-fuse-ld=lld", - "-fdebug-default-version=5", - "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", - "-Wno-tautological-constant-compare", - "-Wno-tautological-unsigned-enum-zero-compare", - "-Wno-final-dtor-non-final-class", - "-Werror=poison-system-directories", - "-Wno-unknown-warning-option", - "-fexperimental-new-pass-manager", - "-Wno-compound-token-split-by-macro", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", - "-Wunused-variable", + "-Wno-error=uninitialized", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -282,7 +162,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -290,13 +169,15 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-someflag", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/clangtidy.json b/compiler_wrapper/testdata/cros_clang_host_golden/clangtidy.json index 4f14ab26..2a563b89 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/clangtidy.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/clangtidy.json @@ -35,7 +35,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -43,12 +42,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } }, @@ -61,7 +62,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -69,12 +69,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -117,7 +119,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -125,12 +126,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } }, @@ -143,7 +146,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -151,12 +153,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -201,7 +205,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -209,12 +212,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] }, "stdout": "somemessage", @@ -230,7 +235,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -238,12 +242,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -289,7 +295,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -297,12 +302,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } }, @@ -315,7 +322,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -323,12 +329,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] }, "stdout": "somemessage", diff --git a/compiler_wrapper/testdata/cros_clang_host_golden/force_disable_werror.json b/compiler_wrapper/testdata/cros_clang_host_golden/force_disable_werror.json index f88174a7..139e351a 100644 --- a/compiler_wrapper/testdata/cros_clang_host_golden/force_disable_werror.json +++ b/compiler_wrapper/testdata/cros_clang_host_golden/force_disable_werror.json @@ -22,7 +22,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -30,12 +29,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] } } @@ -64,7 +65,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -72,12 +72,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] }, "stderr": "-Werror originalerror", @@ -92,7 +94,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -100,12 +101,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-Wno-error", "-Wno-error=poison-system-directories" ] @@ -138,7 +141,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -146,12 +148,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation" + "-Wno-string-concatenation", + "-Wno-deprecated-copy" ] }, "stderr": "-Werror originalerror", @@ -166,7 +170,6 @@ "-fuse-ld=lld", "-fdebug-default-version=5", "-Wno-unused-local-typedefs", - "-Wno-deprecated-declarations", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-final-dtor-non-final-class", @@ -174,12 +177,14 @@ "-Wno-unknown-warning-option", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-Wno-error", "-Wno-error=poison-system-directories" ] diff --git a/compiler_wrapper/testdata/cros_hardened_golden/bisect.json b/compiler_wrapper/testdata/cros_hardened_golden/bisect.json index 53cc5986..c3bac4d2 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/bisect.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/bisect.json @@ -33,12 +33,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -46,11 +47,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -101,12 +104,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -114,11 +118,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -172,12 +178,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -185,11 +192,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clang_ftrapv_maincc_target_specific.json b/compiler_wrapper/testdata/cros_hardened_golden/clang_ftrapv_maincc_target_specific.json index c7016ad1..6efe1d2a 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clang_ftrapv_maincc_target_specific.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clang_ftrapv_maincc_target_specific.json @@ -24,12 +24,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -37,12 +38,14 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-ftrapv", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -82,12 +85,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -95,12 +99,14 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-eabi-", "-ftrapv", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -140,12 +146,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -153,12 +160,14 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-win-gnu-", "-ftrapv", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -198,18 +207,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", "-fPIE", "-pie", "-D_FORTIFY_SOURCE=2", + "-static-libgcc", "-mthumb", "--prefix=../../bin/armv7m-cros-linux-gnu-", "-ftrapv", @@ -217,6 +228,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv7m-cros-linux-gnu" @@ -255,12 +267,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -268,12 +281,14 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/armv7m-cros-eabi-", "-ftrapv", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv7m-cros-eabi" @@ -312,18 +327,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", "-fPIE", "-pie", "-D_FORTIFY_SOURCE=2", + "-static-libgcc", "-mthumb", "--prefix=../../bin/armv7m-cros-win-gnu-", "-ftrapv", @@ -331,6 +348,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv7m-cros-win-gnu" @@ -369,18 +387,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", "-fPIE", "-pie", "-D_FORTIFY_SOURCE=2", + "-static-libgcc", "-mthumb", "--prefix=../../bin/armv8m-cros-linux-gnu-", "-ftrapv", @@ -388,6 +408,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv8m-cros-linux-gnu" @@ -426,12 +447,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -439,12 +461,14 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/armv8m-cros-eabi-", "-ftrapv", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv8m-cros-eabi" @@ -483,18 +507,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", "-fPIE", "-pie", "-D_FORTIFY_SOURCE=2", + "-static-libgcc", "-mthumb", "--prefix=../../bin/armv8m-cros-win-gnu-", "-ftrapv", @@ -502,6 +528,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv8m-cros-win-gnu" diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clang_maincc_target_specific.json b/compiler_wrapper/testdata/cros_hardened_golden/clang_maincc_target_specific.json index 4c7ebd05..ac1109c1 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clang_maincc_target_specific.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clang_maincc_target_specific.json @@ -23,12 +23,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -36,11 +37,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -79,12 +82,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -92,11 +96,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-eabi-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -135,12 +141,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -148,11 +155,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-win-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -191,24 +200,27 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", "-fPIE", "-pie", "-D_FORTIFY_SOURCE=2", + "-static-libgcc", "-mthumb", "--prefix=../../bin/armv7m-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv7m-cros-linux-gnu" @@ -246,12 +258,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -259,11 +272,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/armv7m-cros-eabi-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv7m-cros-eabi" @@ -301,24 +316,27 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", "-fPIE", "-pie", "-D_FORTIFY_SOURCE=2", + "-static-libgcc", "-mthumb", "--prefix=../../bin/armv7m-cros-win-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv7m-cros-win-gnu" @@ -356,24 +374,27 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", "-fPIE", "-pie", "-D_FORTIFY_SOURCE=2", + "-static-libgcc", "-mthumb", "--prefix=../../bin/armv8m-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv8m-cros-linux-gnu" @@ -411,12 +432,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -424,11 +446,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/armv8m-cros-eabi-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv8m-cros-eabi" @@ -466,24 +490,27 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", "-fPIE", "-pie", "-D_FORTIFY_SOURCE=2", + "-static-libgcc", "-mthumb", "--prefix=../../bin/armv8m-cros-win-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv8m-cros-win-gnu" diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clang_path.json b/compiler_wrapper/testdata/cros_hardened_golden/clang_path.json index 48ab0dd9..d3dc7287 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clang_path.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clang_path.json @@ -23,12 +23,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -36,11 +37,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -82,12 +85,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -95,11 +99,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -141,12 +147,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -154,11 +161,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -200,12 +209,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -213,11 +223,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -266,12 +278,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -279,6 +292,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-resource-dir=someResourceDir", "--gcc-toolchain=/usr", @@ -286,6 +300,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -337,12 +352,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -350,6 +366,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-resource-dir=someResourceDir", "--gcc-toolchain=/usr", @@ -357,6 +374,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -403,12 +421,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -416,6 +435,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-resource-dir=someResourceDir", "--gcc-toolchain=/usr", @@ -423,6 +443,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -464,12 +485,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -477,11 +499,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -511,8 +535,8 @@ "cmd": { "path": "/usr/bin/ccache", "args": [ - "a/b/usr/bin/clang", - "--sysroot=/tmp/stable/a/b/usr/x86_64-cros-linux-gnu", + "a/b/c/d/e/usr/bin/clang", + "--sysroot=/tmp/stable/a/b/c/d/e/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-fno-addrsig", "-fdebug-default-version=5", @@ -520,12 +544,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -533,13 +558,15 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", - "--prefix=a/b/bin/x86_64-cros-linux-gnu-", + "-static-libgcc", + "--prefix=a/b/c/d/e/bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", - "-Ba/b/bin", + "-Ba/b/c/d/e/bin", "-target", "x86_64-cros-linux-gnu" ], @@ -567,8 +594,8 @@ "cmd": { "path": "/usr/bin/ccache", "args": [ - "a/b/usr/bin/clang", - "--sysroot=/tmp/stable/a/b/usr/x86_64-cros-linux-gnu", + "a/b/c/d/e/usr/bin/clang", + "--sysroot=/tmp/stable/a/b/c/d/e/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-fno-addrsig", "-fdebug-default-version=5", @@ -576,12 +603,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -589,13 +617,15 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", - "--prefix=a/b/bin/x86_64-cros-linux-gnu-", + "-static-libgcc", + "--prefix=a/b/c/d/e/bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", - "-Ba/b/bin", + "-Ba/b/c/d/e/bin", "-target", "x86_64-cros-linux-gnu" ], @@ -623,8 +653,8 @@ "cmd": { "path": "/usr/bin/ccache", "args": [ - "../../usr/bin/clang", - "--sysroot=/usr/x86_64-cros-linux-gnu", + "../usr/bin/clang", + "--sysroot=/tmp/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-fno-addrsig", "-fdebug-default-version=5", @@ -632,12 +662,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -645,13 +676,15 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", - "--prefix=../../bin/x86_64-cros-linux-gnu-", + "-static-libgcc", + "--prefix=../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", - "-B../../bin", + "-B../bin", "-target", "x86_64-cros-linux-gnu" ], @@ -682,8 +715,8 @@ "cmd": { "path": "/usr/bin/ccache", "args": [ - "/usr/bin/clang", - "--sysroot=/usr/x86_64-cros-linux-gnu", + "/tmp/usr/bin/clang", + "--sysroot=/tmp/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-fno-addrsig", "-fdebug-default-version=5", @@ -691,12 +724,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -704,13 +738,15 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", - "--prefix=../../bin/x86_64-cros-linux-gnu-", + "-static-libgcc", + "--prefix=../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", - "-B../../bin", + "-B../bin", "-target", "x86_64-cros-linux-gnu" ], diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clang_sanitizer_args.json b/compiler_wrapper/testdata/cros_hardened_golden/clang_sanitizer_args.json index 30536e68..8ef57484 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clang_sanitizer_args.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clang_sanitizer_args.json @@ -25,24 +25,27 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", "-fPIE", "-pie", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-fsanitize=kernel-address", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -83,24 +86,27 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", "-fPIE", "-pie", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-fsanitize=kernel-address", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -141,24 +147,27 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", "-fPIE", "-pie", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-fsanitize=kernel-address", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -199,24 +208,27 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", "-fPIE", "-pie", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-fsanitize=kernel-address", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -256,18 +268,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", "-fPIE", "-pie", "-fno-omit-frame-pointer", + "-static-libgcc", "-fno-experimental-new-pass-manager", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-fsanitize=fuzzer", @@ -275,6 +289,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -315,18 +330,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", "-fPIE", "-pie", "-fno-omit-frame-pointer", + "-static-libgcc", "-fno-experimental-new-pass-manager", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-fsanitize=address", @@ -335,6 +352,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -374,24 +392,27 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", "-fPIE", "-pie", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-fsanitize=address", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -431,12 +452,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -444,12 +466,14 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-fprofile-instr-generate", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clang_specific_args.json b/compiler_wrapper/testdata/cros_hardened_golden/clang_specific_args.json index 973cf630..f93c958b 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clang_specific_args.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clang_specific_args.json @@ -33,12 +33,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -46,6 +47,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-mno-movbe", "-Wclobbered", @@ -59,6 +61,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -98,12 +101,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -111,12 +115,14 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-Wno-#warnings", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -156,128 +162,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", - "-fuse-ld=lld", - "-Wno-final-dtor-non-final-class", - "-Werror=poison-system-directories", - "-fexperimental-new-pass-manager", - "-Wno-compound-token-split-by-macro", - "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", - "-fcommon", - "-fstack-protector-strong", - "-fPIE", - "-pie", - "-D_FORTIFY_SOURCE=2", - "-fno-omit-frame-pointer", - "--prefix=../../bin/x86_64-cros-linux-gnu-", - "-Wno-error=uninitialized", - "main.cc", - "-Wno-implicit-int-float-conversion", - "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation", - "-mno-movbe", - "-B../../bin", - "-target", - "x86_64-cros-linux-gnu" - ], - "env_updates": [ - "CCACHE_DIR=/var/cache/distfiles/ccache", - "CCACHE_UMASK=002", - "CCACHE_CPP2=yes" - ] - } - } - ] - }, - { - "wd": "/tmp/stable", - "wrapper": { - "cmd": { - "path": "./x86_64-cros-linux-gnu-clang", - "args": [ - "-Wno-error=unused-but-set-variable", - "main.cc" - ] - } - }, - "cmds": [ - { - "cmd": { - "path": "/usr/bin/ccache", - "args": [ - "../../usr/bin/clang", - "--sysroot=/usr/x86_64-cros-linux-gnu", - "-Qunused-arguments", - "-fno-addrsig", - "-fdebug-default-version=5", - "-Wno-tautological-constant-compare", - "-Wno-tautological-unsigned-enum-zero-compare", - "-Wno-unknown-warning-option", - "-Wno-section", - "-static-libgcc", - "-fuse-ld=lld", - "-Wno-final-dtor-non-final-class", - "-Werror=poison-system-directories", - "-fexperimental-new-pass-manager", - "-Wno-compound-token-split-by-macro", - "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", - "-fcommon", - "-fstack-protector-strong", - "-fPIE", - "-pie", - "-D_FORTIFY_SOURCE=2", - "-fno-omit-frame-pointer", - "--prefix=../../bin/x86_64-cros-linux-gnu-", - "-Wno-error=unused-variable", - "main.cc", - "-Wno-implicit-int-float-conversion", - "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation", - "-mno-movbe", - "-B../../bin", - "-target", - "x86_64-cros-linux-gnu" - ], - "env_updates": [ - "CCACHE_DIR=/var/cache/distfiles/ccache", - "CCACHE_UMASK=002", - "CCACHE_CPP2=yes" - ] - } - } - ] - }, - { - "wd": "/tmp/stable", - "wrapper": { - "cmd": { - "path": "./x86_64-cros-linux-gnu-clang", - "args": [ - "-Wno-unused-but-set-variable", - "main.cc" - ] - } - }, - "cmds": [ - { - "cmd": { - "path": "/usr/bin/ccache", - "args": [ - "../../usr/bin/clang", - "--sysroot=/usr/x86_64-cros-linux-gnu", - "-Qunused-arguments", - "-fno-addrsig", - "-fdebug-default-version=5", - "-Wno-tautological-constant-compare", - "-Wno-tautological-unsigned-enum-zero-compare", - "-Wno-unknown-warning-option", - "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -285,70 +176,14 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", - "--prefix=../../bin/x86_64-cros-linux-gnu-", - "-Wno-unused-variable", - "main.cc", - "-Wno-implicit-int-float-conversion", - "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation", - "-mno-movbe", - "-B../../bin", - "-target", - "x86_64-cros-linux-gnu" - ], - "env_updates": [ - "CCACHE_DIR=/var/cache/distfiles/ccache", - "CCACHE_UMASK=002", - "CCACHE_CPP2=yes" - ] - } - } - ] - }, - { - "wd": "/tmp/stable", - "wrapper": { - "cmd": { - "path": "./x86_64-cros-linux-gnu-clang", - "args": [ - "-Wunused-but-set-variable", - "main.cc" - ] - } - }, - "cmds": [ - { - "cmd": { - "path": "/usr/bin/ccache", - "args": [ - "../../usr/bin/clang", - "--sysroot=/usr/x86_64-cros-linux-gnu", - "-Qunused-arguments", - "-fno-addrsig", - "-fdebug-default-version=5", - "-Wno-tautological-constant-compare", - "-Wno-tautological-unsigned-enum-zero-compare", - "-Wno-unknown-warning-option", - "-Wno-section", "-static-libgcc", - "-fuse-ld=lld", - "-Wno-final-dtor-non-final-class", - "-Werror=poison-system-directories", - "-fexperimental-new-pass-manager", - "-Wno-compound-token-split-by-macro", - "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", - "-fcommon", - "-fstack-protector-strong", - "-fPIE", - "-pie", - "-D_FORTIFY_SOURCE=2", - "-fno-omit-frame-pointer", "--prefix=../../bin/x86_64-cros-linux-gnu-", - "-Wunused-variable", + "-Wno-error=uninitialized", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -388,12 +223,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -401,12 +237,14 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-someflag", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clang_sysroot_wrapper_common.json b/compiler_wrapper/testdata/cros_hardened_golden/clang_sysroot_wrapper_common.json index f9fa152a..5cfe476e 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clang_sysroot_wrapper_common.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clang_sysroot_wrapper_common.json @@ -25,6 +25,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ] @@ -59,12 +60,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -72,11 +74,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -118,12 +122,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -131,11 +136,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -170,22 +177,25 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -225,16 +235,18 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "-fno-stack-protector", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-D__KERNEL__", @@ -242,6 +254,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -281,15 +294,17 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-D_FORTIFY_SOURCE=2", + "-static-libgcc", "-mthumb", "-fno-stack-protector", "--prefix=../../bin/armv7a-cros-linux-gnueabihf-", @@ -298,6 +313,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv7a-cros-linux-gnueabihf" @@ -335,12 +351,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -348,12 +365,14 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "--sysroot=xyz", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/clangtidy.json b/compiler_wrapper/testdata/cros_hardened_golden/clangtidy.json index d2f22710..658ecc26 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/clangtidy.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/clangtidy.json @@ -38,12 +38,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -51,11 +52,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -75,12 +78,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -88,11 +92,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -142,12 +148,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -155,11 +162,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -180,12 +189,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -193,11 +203,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -249,12 +261,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -262,11 +275,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -290,12 +305,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -303,11 +319,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -360,12 +378,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -373,11 +392,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -398,12 +419,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -411,11 +433,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/force_disable_werror.json b/compiler_wrapper/testdata/cros_hardened_golden/force_disable_werror.json index 523d3df4..14441d7b 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/force_disable_werror.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/force_disable_werror.json @@ -26,12 +26,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -39,11 +40,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -85,12 +88,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -98,11 +102,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -130,12 +136,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -143,11 +150,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -193,12 +202,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -206,11 +216,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -238,12 +250,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -251,11 +264,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", diff --git a/compiler_wrapper/testdata/cros_hardened_golden/gcc_clang_syntax.json b/compiler_wrapper/testdata/cros_hardened_golden/gcc_clang_syntax.json index f3d487ee..3ffd9e96 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/gcc_clang_syntax.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/gcc_clang_syntax.json @@ -23,12 +23,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -36,11 +37,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -65,6 +68,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -104,12 +108,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -117,11 +122,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -146,6 +153,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ] @@ -180,12 +188,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -193,11 +202,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -239,12 +250,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -252,11 +264,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -281,6 +295,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], diff --git a/compiler_wrapper/testdata/cros_hardened_golden/gcc_maincc_target_specific.json b/compiler_wrapper/testdata/cros_hardened_golden/gcc_maincc_target_specific.json index 7affa691..92fec35e 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/gcc_maincc_target_specific.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/gcc_maincc_target_specific.json @@ -25,6 +25,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -62,6 +63,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -99,6 +101,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -135,6 +138,7 @@ "-fPIE", "-pie", "-D_FORTIFY_SOURCE=2", + "-static-libgcc", "-mthumb", "main.cc" ], @@ -172,6 +176,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc" ], "env_updates": [ @@ -207,6 +212,7 @@ "-fPIE", "-pie", "-D_FORTIFY_SOURCE=2", + "-static-libgcc", "-mthumb", "main.cc" ], @@ -243,6 +249,7 @@ "-fPIE", "-pie", "-D_FORTIFY_SOURCE=2", + "-static-libgcc", "-mthumb", "main.cc" ], @@ -280,6 +287,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc" ], "env_updates": [ @@ -315,6 +323,7 @@ "-fPIE", "-pie", "-D_FORTIFY_SOURCE=2", + "-static-libgcc", "-mthumb", "main.cc" ], diff --git a/compiler_wrapper/testdata/cros_hardened_golden/gcc_path.json b/compiler_wrapper/testdata/cros_hardened_golden/gcc_path.json index c32ef3b8..f44e69dd 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/gcc_path.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/gcc_path.json @@ -25,6 +25,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -65,6 +66,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -105,6 +107,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -142,6 +145,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -179,6 +183,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -219,6 +224,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], diff --git a/compiler_wrapper/testdata/cros_hardened_golden/gcc_sanitizer_args.json b/compiler_wrapper/testdata/cros_hardened_golden/gcc_sanitizer_args.json index 380665f8..96215022 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/gcc_sanitizer_args.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/gcc_sanitizer_args.json @@ -27,6 +27,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "-fsanitize=kernel-address", "main.cc", "-mno-movbe" @@ -67,6 +68,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "-fsanitize=kernel-address", "main.cc", "-mno-movbe" @@ -107,6 +109,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "-fsanitize=kernel-address", "main.cc", "-mno-movbe" @@ -147,6 +150,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "-fsanitize=kernel-address", "main.cc", "-mno-movbe" @@ -186,6 +190,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "-fsanitize=fuzzer", "main.cc", "-mno-movbe" @@ -226,6 +231,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "-fsanitize=address", "-fprofile-instr-generate", "main.cc", @@ -266,6 +272,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "-fsanitize=address", "main.cc", "-mno-movbe" @@ -305,6 +312,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "-fprofile-instr-generate", "main.cc", "-mno-movbe" diff --git a/compiler_wrapper/testdata/cros_hardened_golden/gcc_specific_args.json b/compiler_wrapper/testdata/cros_hardened_golden/gcc_specific_args.json index bade6d95..f5c311b4 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/gcc_specific_args.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/gcc_specific_args.json @@ -26,6 +26,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "-march=goldmont", "main.cc", "-mno-movbe" @@ -65,6 +66,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "-march=goldmont-plus", "main.cc", "-mno-movbe" @@ -104,6 +106,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "-march=skylake", "main.cc", "-mno-movbe" diff --git a/compiler_wrapper/testdata/cros_hardened_golden/gcc_sysroot_wrapper_common.json b/compiler_wrapper/testdata/cros_hardened_golden/gcc_sysroot_wrapper_common.json index 11d58f55..9ca8403e 100644 --- a/compiler_wrapper/testdata/cros_hardened_golden/gcc_sysroot_wrapper_common.json +++ b/compiler_wrapper/testdata/cros_hardened_golden/gcc_sysroot_wrapper_common.json @@ -25,6 +25,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ] @@ -61,6 +62,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -101,6 +103,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ] @@ -133,6 +136,7 @@ "-fstack-protector-strong", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -168,6 +172,7 @@ "-fcommon", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "-fno-stack-protector", "-D__KERNEL__", "main.cc", @@ -204,6 +209,7 @@ "-Wno-maybe-uninitialized", "-fcommon", "-D_FORTIFY_SOURCE=2", + "-static-libgcc", "-mthumb", "-fno-stack-protector", "-D__KERNEL__", @@ -243,6 +249,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--sysroot=xyz", "main.cc", "-mno-movbe" diff --git a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/bisect.json b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/bisect.json index 53cc5986..b29f09d0 100644 --- a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/bisect.json +++ b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/bisect.json @@ -33,12 +33,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -46,11 +48,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -101,12 +105,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -114,11 +120,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -172,12 +180,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -185,11 +195,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", diff --git a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clang_path.json b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clang_path.json index 48ab0dd9..352ac4da 100644 --- a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clang_path.json +++ b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clang_path.json @@ -23,12 +23,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -36,11 +38,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -82,12 +86,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -95,11 +101,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -141,12 +149,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -154,11 +164,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -200,12 +212,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -213,11 +227,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -266,12 +282,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -279,6 +297,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-resource-dir=someResourceDir", "--gcc-toolchain=/usr", @@ -286,6 +305,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -337,12 +357,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -350,6 +372,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-resource-dir=someResourceDir", "--gcc-toolchain=/usr", @@ -357,6 +380,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -403,12 +427,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -416,6 +442,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-resource-dir=someResourceDir", "--gcc-toolchain=/usr", @@ -423,6 +450,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -464,12 +492,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -477,11 +507,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -511,8 +543,8 @@ "cmd": { "path": "/usr/bin/ccache", "args": [ - "a/b/usr/bin/clang", - "--sysroot=/tmp/stable/a/b/usr/x86_64-cros-linux-gnu", + "a/b/c/d/e/usr/bin/clang", + "--sysroot=/tmp/stable/a/b/c/d/e/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-fno-addrsig", "-fdebug-default-version=5", @@ -520,12 +552,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -533,13 +567,15 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", - "--prefix=a/b/bin/x86_64-cros-linux-gnu-", + "-static-libgcc", + "--prefix=a/b/c/d/e/bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", - "-Ba/b/bin", + "-Ba/b/c/d/e/bin", "-target", "x86_64-cros-linux-gnu" ], @@ -567,8 +603,8 @@ "cmd": { "path": "/usr/bin/ccache", "args": [ - "a/b/usr/bin/clang", - "--sysroot=/tmp/stable/a/b/usr/x86_64-cros-linux-gnu", + "a/b/c/d/e/usr/bin/clang", + "--sysroot=/tmp/stable/a/b/c/d/e/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-fno-addrsig", "-fdebug-default-version=5", @@ -576,12 +612,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -589,13 +627,15 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", - "--prefix=a/b/bin/x86_64-cros-linux-gnu-", + "-static-libgcc", + "--prefix=a/b/c/d/e/bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", - "-Ba/b/bin", + "-Ba/b/c/d/e/bin", "-target", "x86_64-cros-linux-gnu" ], @@ -623,8 +663,8 @@ "cmd": { "path": "/usr/bin/ccache", "args": [ - "../../usr/bin/clang", - "--sysroot=/usr/x86_64-cros-linux-gnu", + "../usr/bin/clang", + "--sysroot=/tmp/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-fno-addrsig", "-fdebug-default-version=5", @@ -632,12 +672,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -645,13 +687,15 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", - "--prefix=../../bin/x86_64-cros-linux-gnu-", + "-static-libgcc", + "--prefix=../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", - "-B../../bin", + "-B../bin", "-target", "x86_64-cros-linux-gnu" ], @@ -682,8 +726,8 @@ "cmd": { "path": "/usr/bin/ccache", "args": [ - "/usr/bin/clang", - "--sysroot=/usr/x86_64-cros-linux-gnu", + "/tmp/usr/bin/clang", + "--sysroot=/tmp/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-fno-addrsig", "-fdebug-default-version=5", @@ -691,12 +735,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -704,13 +750,15 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", - "--prefix=../../bin/x86_64-cros-linux-gnu-", + "-static-libgcc", + "--prefix=../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", - "-B../../bin", + "-B../bin", "-target", "x86_64-cros-linux-gnu" ], diff --git a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clangtidy.json b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clangtidy.json index d2f22710..11851288 100644 --- a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clangtidy.json +++ b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/clangtidy.json @@ -38,12 +38,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -51,11 +53,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -75,12 +79,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -88,11 +94,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -142,12 +150,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -155,11 +165,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -180,12 +192,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -193,11 +207,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -249,12 +265,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -262,11 +280,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -290,12 +310,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -303,11 +325,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -360,12 +384,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -373,11 +399,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -398,12 +426,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -411,11 +441,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", diff --git a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/force_disable_werror.json b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/force_disable_werror.json index 523d3df4..44afa63d 100644 --- a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/force_disable_werror.json +++ b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/force_disable_werror.json @@ -26,12 +26,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -39,11 +41,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -85,12 +89,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -98,11 +104,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -130,12 +138,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -143,11 +153,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -193,12 +205,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -206,11 +220,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -238,12 +254,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -251,11 +269,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", diff --git a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/gcc_clang_syntax.json b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/gcc_clang_syntax.json index f3d487ee..2851f6d5 100644 --- a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/gcc_clang_syntax.json +++ b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/gcc_clang_syntax.json @@ -23,12 +23,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -36,11 +38,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -65,6 +69,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -104,12 +109,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -117,11 +124,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -146,6 +155,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ] @@ -180,12 +190,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -193,11 +205,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -239,12 +253,14 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", + "-Wno-unused-but-set-variable", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -252,11 +268,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -281,6 +299,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], diff --git a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/gcc_path.json b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/gcc_path.json index c32ef3b8..f44e69dd 100644 --- a/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/gcc_path.json +++ b/compiler_wrapper/testdata/cros_hardened_llvmnext_golden/gcc_path.json @@ -25,6 +25,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -65,6 +66,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -105,6 +107,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -142,6 +145,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -179,6 +183,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -219,6 +224,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ], diff --git a/compiler_wrapper/testdata/cros_hardened_noccache_golden/bisect.json b/compiler_wrapper/testdata/cros_hardened_noccache_golden/bisect.json index 5adec383..58a0846f 100644 --- a/compiler_wrapper/testdata/cros_hardened_noccache_golden/bisect.json +++ b/compiler_wrapper/testdata/cros_hardened_noccache_golden/bisect.json @@ -32,12 +32,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -45,11 +46,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -96,12 +99,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -109,11 +113,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -163,12 +169,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -176,11 +183,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", diff --git a/compiler_wrapper/testdata/cros_hardened_noccache_golden/clang_path.json b/compiler_wrapper/testdata/cros_hardened_noccache_golden/clang_path.json index ff41cec6..5865a12f 100644 --- a/compiler_wrapper/testdata/cros_hardened_noccache_golden/clang_path.json +++ b/compiler_wrapper/testdata/cros_hardened_noccache_golden/clang_path.json @@ -22,12 +22,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -35,11 +36,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -75,12 +78,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -88,11 +92,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -128,12 +134,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -141,11 +148,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -181,12 +190,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -194,11 +204,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -241,12 +253,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -254,6 +267,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-resource-dir=someResourceDir", "--gcc-toolchain=/usr", @@ -261,6 +275,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -307,12 +322,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -320,6 +336,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-resource-dir=someResourceDir", "--gcc-toolchain=/usr", @@ -327,6 +344,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -372,12 +390,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -385,6 +404,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-resource-dir=someResourceDir", "--gcc-toolchain=/usr", @@ -392,6 +412,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -427,12 +448,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -440,11 +462,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -467,9 +491,9 @@ "cmds": [ { "cmd": { - "path": "a/b/usr/bin/clang", + "path": "a/b/c/d/e/usr/bin/clang", "args": [ - "--sysroot=/tmp/stable/a/b/usr/x86_64-cros-linux-gnu", + "--sysroot=/tmp/stable/a/b/c/d/e/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-fno-addrsig", "-fdebug-default-version=5", @@ -477,12 +501,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -490,13 +515,15 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", - "--prefix=a/b/bin/x86_64-cros-linux-gnu-", + "-static-libgcc", + "--prefix=a/b/c/d/e/bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", - "-Ba/b/bin", + "-Ba/b/c/d/e/bin", "-target", "x86_64-cros-linux-gnu" ] @@ -517,9 +544,9 @@ "cmds": [ { "cmd": { - "path": "a/b/usr/bin/clang", + "path": "a/b/c/d/e/usr/bin/clang", "args": [ - "--sysroot=/tmp/stable/a/b/usr/x86_64-cros-linux-gnu", + "--sysroot=/tmp/stable/a/b/c/d/e/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-fno-addrsig", "-fdebug-default-version=5", @@ -527,12 +554,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -540,13 +568,15 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", - "--prefix=a/b/bin/x86_64-cros-linux-gnu-", + "-static-libgcc", + "--prefix=a/b/c/d/e/bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", - "-Ba/b/bin", + "-Ba/b/c/d/e/bin", "-target", "x86_64-cros-linux-gnu" ] @@ -567,9 +597,9 @@ "cmds": [ { "cmd": { - "path": "../../usr/bin/clang", + "path": "../usr/bin/clang", "args": [ - "--sysroot=/usr/x86_64-cros-linux-gnu", + "--sysroot=/tmp/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-fno-addrsig", "-fdebug-default-version=5", @@ -577,12 +607,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -590,13 +621,15 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", - "--prefix=../../bin/x86_64-cros-linux-gnu-", + "-static-libgcc", + "--prefix=../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", - "-B../../bin", + "-B../bin", "-target", "x86_64-cros-linux-gnu" ] @@ -620,9 +653,9 @@ "cmds": [ { "cmd": { - "path": "/usr/bin/clang", + "path": "/tmp/usr/bin/clang", "args": [ - "--sysroot=/usr/x86_64-cros-linux-gnu", + "--sysroot=/tmp/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-fno-addrsig", "-fdebug-default-version=5", @@ -630,12 +663,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -643,13 +677,15 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", - "--prefix=../../bin/x86_64-cros-linux-gnu-", + "-static-libgcc", + "--prefix=../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", - "-B../../bin", + "-B../bin", "-target", "x86_64-cros-linux-gnu" ] diff --git a/compiler_wrapper/testdata/cros_hardened_noccache_golden/clangtidy.json b/compiler_wrapper/testdata/cros_hardened_noccache_golden/clangtidy.json index d2f22710..658ecc26 100644 --- a/compiler_wrapper/testdata/cros_hardened_noccache_golden/clangtidy.json +++ b/compiler_wrapper/testdata/cros_hardened_noccache_golden/clangtidy.json @@ -38,12 +38,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -51,11 +52,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -75,12 +78,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -88,11 +92,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -142,12 +148,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -155,11 +162,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -180,12 +189,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -193,11 +203,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -249,12 +261,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -262,11 +275,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -290,12 +305,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -303,11 +319,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -360,12 +378,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -373,11 +392,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -398,12 +419,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -411,11 +433,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", diff --git a/compiler_wrapper/testdata/cros_hardened_noccache_golden/force_disable_werror.json b/compiler_wrapper/testdata/cros_hardened_noccache_golden/force_disable_werror.json index 46a56fa4..aa3de738 100644 --- a/compiler_wrapper/testdata/cros_hardened_noccache_golden/force_disable_werror.json +++ b/compiler_wrapper/testdata/cros_hardened_noccache_golden/force_disable_werror.json @@ -25,12 +25,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -38,11 +39,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -78,12 +81,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -91,11 +95,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -117,12 +123,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -130,11 +137,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -174,12 +183,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -187,11 +197,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -213,12 +225,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -226,11 +239,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", diff --git a/compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_clang_syntax.json b/compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_clang_syntax.json index 0c937f26..a532745f 100644 --- a/compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_clang_syntax.json +++ b/compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_clang_syntax.json @@ -23,12 +23,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -36,11 +37,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -64,6 +67,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ] @@ -99,12 +103,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -112,11 +117,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -141,6 +148,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ] @@ -175,12 +183,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -188,11 +197,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -234,12 +245,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-fuse-ld=lld", + "--unwindlib=libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "-fcommon", "-fstack-protector-strong", @@ -247,11 +259,13 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -275,6 +289,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ] diff --git a/compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_path.json b/compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_path.json index 6bd35ffa..9a964aad 100644 --- a/compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_path.json +++ b/compiler_wrapper/testdata/cros_hardened_noccache_golden/gcc_path.json @@ -24,6 +24,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ] @@ -59,6 +60,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ] @@ -94,6 +96,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ] @@ -126,6 +129,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ] @@ -158,6 +162,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ] @@ -193,6 +198,7 @@ "-pie", "-D_FORTIFY_SOURCE=2", "-fno-omit-frame-pointer", + "-static-libgcc", "main.cc", "-mno-movbe" ] diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/bisect.json b/compiler_wrapper/testdata/cros_nonhardened_golden/bisect.json index 91ed0d69..7ccc0f66 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/bisect.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/bisect.json @@ -32,17 +32,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -92,17 +94,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -155,17 +159,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_ftrapv_maincc_target_specific.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_ftrapv_maincc_target_specific.json index 2793238d..36e8f7d0 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_ftrapv_maincc_target_specific.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_ftrapv_maincc_target_specific.json @@ -23,18 +23,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-ftrapv", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -73,18 +75,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-eabi-", "-ftrapv", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -123,18 +127,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-win-gnu-", "-ftrapv", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -173,12 +179,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "-mthumb", "--prefix=../../bin/armv7m-cros-linux-gnu-", "-ftrapv", @@ -186,6 +193,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv7m-cros-linux-gnu" @@ -223,18 +231,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/armv7m-cros-eabi-", "-ftrapv", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv7m-cros-eabi" @@ -272,12 +282,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "-mthumb", "--prefix=../../bin/armv7m-cros-win-gnu-", "-ftrapv", @@ -285,6 +296,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv7m-cros-win-gnu" @@ -322,12 +334,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "-mthumb", "--prefix=../../bin/armv8m-cros-linux-gnu-", "-ftrapv", @@ -335,6 +348,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv8m-cros-linux-gnu" @@ -372,18 +386,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/armv8m-cros-eabi-", "-ftrapv", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv8m-cros-eabi" @@ -421,12 +437,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "-mthumb", "--prefix=../../bin/armv8m-cros-win-gnu-", "-ftrapv", @@ -434,6 +451,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv8m-cros-win-gnu" diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_maincc_target_specific.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_maincc_target_specific.json index 183ed65a..af33ad3a 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_maincc_target_specific.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_maincc_target_specific.json @@ -22,17 +22,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -70,17 +72,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-eabi-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -118,17 +122,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-win-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -166,18 +172,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "-mthumb", "--prefix=../../bin/armv7m-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv7m-cros-linux-gnu" @@ -214,17 +222,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/armv7m-cros-eabi-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv7m-cros-eabi" @@ -261,18 +271,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "-mthumb", "--prefix=../../bin/armv7m-cros-win-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv7m-cros-win-gnu" @@ -309,18 +321,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "-mthumb", "--prefix=../../bin/armv8m-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv8m-cros-linux-gnu" @@ -357,17 +371,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/armv8m-cros-eabi-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv8m-cros-eabi" @@ -404,18 +420,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "-mthumb", "--prefix=../../bin/armv8m-cros-win-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv8m-cros-win-gnu" diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_path.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_path.json index 9a7ef5a0..bb03aa25 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_path.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_path.json @@ -22,17 +22,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -73,17 +75,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -124,17 +128,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -175,17 +181,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -233,12 +241,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-resource-dir=someResourceDir", "--gcc-toolchain=/usr", @@ -246,6 +255,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -296,12 +306,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-resource-dir=someResourceDir", "--gcc-toolchain=/usr", @@ -309,6 +320,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -354,12 +366,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-resource-dir=someResourceDir", "--gcc-toolchain=/usr", @@ -367,6 +380,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -407,17 +421,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -447,27 +463,29 @@ "cmd": { "path": "/usr/bin/ccache", "args": [ - "a/b/usr/bin/clang", - "--sysroot=/tmp/stable/a/b/usr/x86_64-cros-linux-gnu", + "a/b/c/d/e/usr/bin/clang", + "--sysroot=/tmp/stable/a/b/c/d/e/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-fdebug-default-version=5", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", - "--prefix=a/b/bin/x86_64-cros-linux-gnu-", + "-static-libgcc", + "--prefix=a/b/c/d/e/bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", - "-Ba/b/bin", + "-Ba/b/c/d/e/bin", "-target", "x86_64-cros-linux-gnu" ], @@ -495,27 +513,29 @@ "cmd": { "path": "/usr/bin/ccache", "args": [ - "a/b/usr/bin/clang", - "--sysroot=/tmp/stable/a/b/usr/x86_64-cros-linux-gnu", + "a/b/c/d/e/usr/bin/clang", + "--sysroot=/tmp/stable/a/b/c/d/e/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-fdebug-default-version=5", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", - "--prefix=a/b/bin/x86_64-cros-linux-gnu-", + "-static-libgcc", + "--prefix=a/b/c/d/e/bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", - "-Ba/b/bin", + "-Ba/b/c/d/e/bin", "-target", "x86_64-cros-linux-gnu" ], @@ -543,27 +563,29 @@ "cmd": { "path": "/usr/bin/ccache", "args": [ - "../../usr/bin/clang", - "--sysroot=/usr/x86_64-cros-linux-gnu", + "../usr/bin/clang", + "--sysroot=/tmp/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-fdebug-default-version=5", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", - "--prefix=../../bin/x86_64-cros-linux-gnu-", + "-static-libgcc", + "--prefix=../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", - "-B../../bin", + "-B../bin", "-target", "x86_64-cros-linux-gnu" ], @@ -594,27 +616,29 @@ "cmd": { "path": "/usr/bin/ccache", "args": [ - "/usr/bin/clang", - "--sysroot=/usr/x86_64-cros-linux-gnu", + "/tmp/usr/bin/clang", + "--sysroot=/tmp/usr/x86_64-cros-linux-gnu", "-Qunused-arguments", "-fdebug-default-version=5", "-Wno-tautological-constant-compare", "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", - "--prefix=../../bin/x86_64-cros-linux-gnu-", + "-static-libgcc", + "--prefix=../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", - "-B../../bin", + "-B../bin", "-target", "x86_64-cros-linux-gnu" ], diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sanitizer_args.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sanitizer_args.json index 26029d5e..26addbcb 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sanitizer_args.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sanitizer_args.json @@ -24,18 +24,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-fsanitize=kernel-address", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -75,18 +77,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-fsanitize=kernel-address", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -126,18 +130,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-fsanitize=kernel-address", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -177,18 +183,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-fsanitize=kernel-address", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -227,12 +235,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "-fno-experimental-new-pass-manager", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-fsanitize=fuzzer", @@ -240,6 +249,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -279,12 +289,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "-fno-experimental-new-pass-manager", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-fsanitize=address", @@ -293,6 +304,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -331,18 +343,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-fsanitize=address", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -381,18 +395,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-fprofile-instr-generate", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_specific_args.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_specific_args.json index 256078cb..2b73d51b 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_specific_args.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_specific_args.json @@ -32,12 +32,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-mno-movbe", "-Wclobbered", @@ -51,6 +52,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -89,18 +91,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-Wno-#warnings", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -139,168 +143,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", - "-Wno-final-dtor-non-final-class", - "-Werror=poison-system-directories", - "-fexperimental-new-pass-manager", - "-Wno-compound-token-split-by-macro", - "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", - "--prefix=../../bin/x86_64-cros-linux-gnu-", - "-Wno-error=uninitialized", - "main.cc", - "-Wno-implicit-int-float-conversion", - "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation", - "-mno-movbe", - "-B../../bin", - "-target", - "x86_64-cros-linux-gnu" - ], - "env_updates": [ - "CCACHE_DIR=/var/cache/distfiles/ccache", - "CCACHE_UMASK=002", - "CCACHE_CPP2=yes" - ] - } - } - ] - }, - { - "wd": "/tmp/stable", - "wrapper": { - "cmd": { - "path": "./x86_64-cros-linux-gnu-clang", - "args": [ - "-Wno-error=unused-but-set-variable", - "main.cc" - ] - } - }, - "cmds": [ - { - "cmd": { - "path": "/usr/bin/ccache", - "args": [ - "../../usr/bin/clang", - "--sysroot=/usr/x86_64-cros-linux-gnu", - "-Qunused-arguments", - "-fdebug-default-version=5", - "-Wno-tautological-constant-compare", - "-Wno-tautological-unsigned-enum-zero-compare", - "-Wno-unknown-warning-option", - "-Wno-section", - "-static-libgcc", - "-Wno-final-dtor-non-final-class", - "-Werror=poison-system-directories", - "-fexperimental-new-pass-manager", - "-Wno-compound-token-split-by-macro", - "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", - "--prefix=../../bin/x86_64-cros-linux-gnu-", - "-Wno-error=unused-variable", - "main.cc", - "-Wno-implicit-int-float-conversion", - "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation", - "-mno-movbe", - "-B../../bin", - "-target", - "x86_64-cros-linux-gnu" - ], - "env_updates": [ - "CCACHE_DIR=/var/cache/distfiles/ccache", - "CCACHE_UMASK=002", - "CCACHE_CPP2=yes" - ] - } - } - ] - }, - { - "wd": "/tmp/stable", - "wrapper": { - "cmd": { - "path": "./x86_64-cros-linux-gnu-clang", - "args": [ - "-Wno-unused-but-set-variable", - "main.cc" - ] - } - }, - "cmds": [ - { - "cmd": { - "path": "/usr/bin/ccache", - "args": [ - "../../usr/bin/clang", - "--sysroot=/usr/x86_64-cros-linux-gnu", - "-Qunused-arguments", - "-fdebug-default-version=5", - "-Wno-tautological-constant-compare", - "-Wno-tautological-unsigned-enum-zero-compare", - "-Wno-unknown-warning-option", - "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", - "--prefix=../../bin/x86_64-cros-linux-gnu-", - "-Wno-unused-variable", - "main.cc", - "-Wno-implicit-int-float-conversion", - "-Wno-compound-token-split-by-space", - "-Wno-string-concatenation", - "-mno-movbe", - "-B../../bin", - "-target", - "x86_64-cros-linux-gnu" - ], - "env_updates": [ - "CCACHE_DIR=/var/cache/distfiles/ccache", - "CCACHE_UMASK=002", - "CCACHE_CPP2=yes" - ] - } - } - ] - }, - { - "wd": "/tmp/stable", - "wrapper": { - "cmd": { - "path": "./x86_64-cros-linux-gnu-clang", - "args": [ - "-Wunused-but-set-variable", - "main.cc" - ] - } - }, - "cmds": [ - { - "cmd": { - "path": "/usr/bin/ccache", - "args": [ - "../../usr/bin/clang", - "--sysroot=/usr/x86_64-cros-linux-gnu", - "-Qunused-arguments", - "-fdebug-default-version=5", - "-Wno-tautological-constant-compare", - "-Wno-tautological-unsigned-enum-zero-compare", - "-Wno-unknown-warning-option", - "-Wno-section", "-static-libgcc", - "-Wno-final-dtor-non-final-class", - "-Werror=poison-system-directories", - "-fexperimental-new-pass-manager", - "-Wno-compound-token-split-by-macro", - "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", "--prefix=../../bin/x86_64-cros-linux-gnu-", - "-Wunused-variable", + "-Wno-error=uninitialized", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -339,18 +195,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-someflag", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sysroot_wrapper_common.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sysroot_wrapper_common.json index 2e8bffed..96d6e65a 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sysroot_wrapper_common.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clang_sysroot_wrapper_common.json @@ -20,6 +20,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "main.cc", "-mno-movbe" ] @@ -53,17 +54,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -104,17 +107,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -148,17 +153,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -197,12 +204,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "-fno-stack-protector", "--prefix=../../bin/x86_64-cros-linux-gnu-", "-D__KERNEL__", @@ -210,6 +218,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -248,12 +257,13 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "-mthumb", "-fno-stack-protector", "--prefix=../../bin/armv7a-cros-linux-gnueabihf-", @@ -262,6 +272,7 @@ "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-B../../bin", "-target", "armv7a-cros-linux-gnueabihf" @@ -298,18 +309,20 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "--sysroot=xyz", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/clangtidy.json b/compiler_wrapper/testdata/cros_nonhardened_golden/clangtidy.json index 53bfbde2..ad6cb480 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/clangtidy.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/clangtidy.json @@ -37,17 +37,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -66,17 +68,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -125,17 +129,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -155,17 +161,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -216,17 +224,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -249,17 +259,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -311,17 +323,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -341,17 +355,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/force_disable_werror.json b/compiler_wrapper/testdata/cros_nonhardened_golden/force_disable_werror.json index 1bf6339f..ba7f61f4 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/force_disable_werror.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/force_disable_werror.json @@ -25,17 +25,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -76,17 +78,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -113,17 +117,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -168,17 +174,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -205,17 +213,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_clang_syntax.json b/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_clang_syntax.json index ca3284f5..5e62ca2e 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_clang_syntax.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_clang_syntax.json @@ -22,17 +22,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -52,6 +54,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -90,17 +93,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -120,6 +125,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "main.cc", "-mno-movbe" ] @@ -153,17 +159,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -204,17 +212,19 @@ "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-unknown-warning-option", "-Wno-section", - "-static-libgcc", "-Wno-final-dtor-non-final-class", "-Werror=poison-system-directories", "-fexperimental-new-pass-manager", "-Wno-compound-token-split-by-macro", + "-Wno-deprecated-declarations", "-fcrash-diagnostics-dir=/tmp/stable/clang_crash_diagnostics", + "-static-libgcc", "--prefix=../../bin/x86_64-cros-linux-gnu-", "main.cc", "-Wno-implicit-int-float-conversion", "-Wno-compound-token-split-by-space", "-Wno-string-concatenation", + "-Wno-deprecated-copy", "-mno-movbe", "-B../../bin", "-target", @@ -234,6 +244,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "main.cc", "-mno-movbe" ], diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_maincc_target_specific.json b/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_maincc_target_specific.json index d11a7413..5bb170bd 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_maincc_target_specific.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_maincc_target_specific.json @@ -20,6 +20,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -52,6 +53,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -84,6 +86,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -116,6 +119,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "-mthumb", "main.cc" ], @@ -148,6 +152,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "main.cc" ], "env_updates": [ @@ -179,6 +184,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "-mthumb", "main.cc" ], @@ -211,6 +217,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "-mthumb", "main.cc" ], @@ -243,6 +250,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "main.cc" ], "env_updates": [ @@ -274,6 +282,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "-mthumb", "main.cc" ], diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_path.json b/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_path.json index 17483eee..00f2a364 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_path.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_path.json @@ -20,6 +20,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -55,6 +56,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -90,6 +92,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -122,6 +125,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -154,6 +158,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -189,6 +194,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "main.cc", "-mno-movbe" ], diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_sanitizer_args.json b/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_sanitizer_args.json index 4aacc51a..10ff7383 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_sanitizer_args.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_sanitizer_args.json @@ -22,6 +22,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "-fsanitize=kernel-address", "main.cc", "-mno-movbe" @@ -57,6 +58,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "-fsanitize=kernel-address", "main.cc", "-mno-movbe" @@ -92,6 +94,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "-fsanitize=kernel-address", "main.cc", "-mno-movbe" @@ -127,6 +130,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "-fsanitize=kernel-address", "main.cc", "-mno-movbe" @@ -161,6 +165,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "-fsanitize=fuzzer", "main.cc", "-mno-movbe" @@ -196,6 +201,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "-fsanitize=address", "-fprofile-instr-generate", "main.cc", @@ -231,6 +237,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "-fsanitize=address", "main.cc", "-mno-movbe" @@ -265,6 +272,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "-fprofile-instr-generate", "main.cc", "-mno-movbe" diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_specific_args.json b/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_specific_args.json index dc9bdbe0..5228e12b 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_specific_args.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_specific_args.json @@ -21,6 +21,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "-march=goldmont", "main.cc", "-mno-movbe" @@ -55,6 +56,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "-march=goldmont-plus", "main.cc", "-mno-movbe" @@ -89,6 +91,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "-march=skylake", "main.cc", "-mno-movbe" diff --git a/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_sysroot_wrapper_common.json b/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_sysroot_wrapper_common.json index be2df4cf..23109bc4 100644 --- a/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_sysroot_wrapper_common.json +++ b/compiler_wrapper/testdata/cros_nonhardened_golden/gcc_sysroot_wrapper_common.json @@ -20,6 +20,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "main.cc", "-mno-movbe" ] @@ -51,6 +52,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -86,6 +88,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "main.cc", "-mno-movbe" ] @@ -115,6 +118,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "main.cc", "-mno-movbe" ], @@ -148,6 +152,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "-fno-stack-protector", "-D__KERNEL__", "main.cc", @@ -183,6 +188,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "-mthumb", "-fno-stack-protector", "-D__KERNEL__", @@ -217,6 +223,7 @@ "-Wno-unused-local-typedefs", "-Wno-deprecated-declarations", "-Wtrampolines", + "-static-libgcc", "--sysroot=xyz", "main.cc", "-mno-movbe" diff --git a/compiler_wrapper/testutil_test.go b/compiler_wrapper/testutil_test.go index 21b7169d..035f2373 100644 --- a/compiler_wrapper/testutil_test.go +++ b/compiler_wrapper/testutil_test.go @@ -14,7 +14,10 @@ import ( "path/filepath" "regexp" "strings" + "sync" + "syscall" "testing" + "time" ) const ( @@ -43,8 +46,15 @@ type testContext struct { stdinBuffer bytes.Buffer stdoutBuffer bytes.Buffer stderrBuffer bytes.Buffer + + umaskRestoreAction func() } +// We have some tests which modify our umask, and other tests which depend upon the value of our +// umask remaining consistent. This lock serializes those. Please use `NoteTestWritesToUmask()` and +// `NoteTestDependsOnUmask()` on `testContext` rather than using this directly. +var umaskModificationLock sync.RWMutex + func withTestContext(t *testing.T, work func(ctx *testContext)) { t.Parallel() tempDir, err := ioutil.TempDir("", "compiler_wrapper") @@ -62,11 +72,48 @@ func withTestContext(t *testing.T, work func(ctx *testContext)) { } ctx.updateConfig(&config{}) + defer ctx.maybeReleaseUmaskDependency() work(&ctx) } var _ env = (*testContext)(nil) +func (ctx *testContext) umask(mask int) (oldmask int) { + if ctx.umaskRestoreAction == nil { + panic("Umask operations requested in test without declaring a umask dependency") + } + return syscall.Umask(mask) +} + +func (ctx *testContext) initUmaskDependency(lockFn func(), unlockFn func()) { + if ctx.umaskRestoreAction != nil { + // Use a panic so we get a backtrace. + panic("Multiple notes of a test depending on the value of `umask` given -- tests " + + "are only allowed up to one.") + } + + lockFn() + ctx.umaskRestoreAction = unlockFn +} + +func (ctx *testContext) maybeReleaseUmaskDependency() { + if ctx.umaskRestoreAction != nil { + ctx.umaskRestoreAction() + } +} + +// Note that the test depends on a stable value for the process' umask. +func (ctx *testContext) NoteTestReadsFromUmask() { + ctx.initUmaskDependency(umaskModificationLock.RLock, umaskModificationLock.RUnlock) +} + +// Note that the test modifies the process' umask. This implies a dependency on the process' umask, +// so it's an error to call both NoteTestWritesToUmask and NoteTestReadsFromUmask from the same +// test. +func (ctx *testContext) NoteTestWritesToUmask() { + ctx.initUmaskDependency(umaskModificationLock.Lock, umaskModificationLock.Unlock) +} + func (ctx *testContext) getenv(key string) (string, bool) { for i := len(ctx.env) - 1; i >= 0; i-- { entry := ctx.env[i] @@ -114,6 +161,10 @@ func (ctx *testContext) run(cmd *command, stdin io.Reader, stdout io.Writer, std return nil } +func (ctx *testContext) runWithTimeout(cmd *command, duration time.Duration) error { + return ctx.exec(cmd) +} + func (ctx *testContext) exec(cmd *command) error { ctx.cmdCount++ ctx.lastCmd = cmd diff --git a/cros_utils/email_sender.py b/cros_utils/email_sender.py index 6b8893ea..df8afbc4 100755 --- a/cros_utils/email_sender.py +++ b/cros_utils/email_sender.py @@ -71,7 +71,7 @@ class EmailSender(object): "From" email address. Must be nonempty. well_known_recipients: a list of well-known recipients for the email. These are translated into addresses by our mailer. - Current potential values for this are ('sheriff', + Current potential values for this are ('detective', 'cwp-team', 'cros-team', 'mage'). Either this or direct_recipients must be a nonempty list. direct_recipients: @google.com emails to send addresses to. Either this @@ -89,8 +89,8 @@ class EmailSender(object): type(well_known_recipients)) if not isinstance(direct_recipients, (tuple, list)): - raise ValueError( - '`direct_recipients` is unexpectedly a %s' % type(direct_recipients)) + raise ValueError('`direct_recipients` is unexpectedly a %s' % + type(direct_recipients)) if not subject or not identifier: raise ValueError('both `subject` and `identifier` must be nonempty') @@ -205,8 +205,8 @@ class EmailSender(object): to_be_deleted = [] try: - with tempfile.NamedTemporaryFile( - 'w', encoding='utf-8', delete=False) as f: + with tempfile.NamedTemporaryFile('w', encoding='utf-8', + delete=False) as f: f.write(text_to_send) f.flush() to_be_deleted.append(f.name) @@ -239,8 +239,10 @@ class EmailSender(object): report_suffix = '_report.html' else: report_suffix = '_report.txt' - with tempfile.NamedTemporaryFile( - 'w', encoding='utf-8', delete=False, suffix=report_suffix) as f: + with tempfile.NamedTemporaryFile('w', + encoding='utf-8', + delete=False, + suffix=report_suffix) as f: f.write(attachment.content) f.flush() attachment_files.append(f.name) diff --git a/cros_utils/email_sender_unittest.py b/cros_utils/email_sender_unittest.py index 73492196..ae41f143 100755 --- a/cros_utils/email_sender_unittest.py +++ b/cros_utils/email_sender_unittest.py @@ -69,7 +69,7 @@ class Test(unittest.TestCase): 'subject': 'foo', 'identifier': 'foo', # non-list recipients - 'well_known_recipients': 'sheriff', + 'well_known_recipients': 'detective', 'text_body': 'hi', }, ] @@ -89,8 +89,8 @@ class Test(unittest.TestCase): def actual_write_file(file_path): nonlocal written_obj - self.assertTrue( - file_path.startswith(email_sender.X20_PATH + '/'), file_path) + self.assertTrue(file_path.startswith(email_sender.X20_PATH + '/'), + file_path) f = io.StringIO() yield f written_obj = json.loads(f.getvalue()) @@ -99,7 +99,7 @@ class Test(unittest.TestCase): email_sender.EmailSender().SendX20Email( subject='hello', identifier='world', - well_known_recipients=['sheriff'], + well_known_recipients=['detective'], direct_recipients=['gbiv@google.com'], text_body='text', html_body='html', @@ -109,7 +109,7 @@ class Test(unittest.TestCase): written_obj, { 'subject': 'hello', 'email_identifier': 'world', - 'well_known_recipients': ['sheriff'], + 'well_known_recipients': ['detective'], 'direct_recipients': ['gbiv@google.com'], 'body': 'text', 'html_body': 'html', diff --git a/crosperf/download_images.py b/crosperf/download_images.py index 9bd4a8bf..8e1bad11 100644 --- a/crosperf/download_images.py +++ b/crosperf/download_images.py @@ -137,8 +137,8 @@ class ImageDownloader(object): def DownloadSingleFile(self, chromeos_root, build_id, package_file_name): # Verify if package files exist status = 0 - gs_package_name = ( - 'gs://chromeos-image-archive/%s/%s' % (build_id, package_file_name)) + gs_package_name = ('gs://chromeos-image-archive/%s/%s' % + (build_id, package_file_name)) gsutil_cmd = os.path.join(chromeos_root, GS_UTIL) if not test_flag.GetTestMode(): cmd = '%s ls %s' % (gsutil_cmd, gs_package_name) @@ -171,8 +171,8 @@ class ImageDownloader(object): uncompress_cmd): # Uncompress file download_path = os.path.join(chromeos_root, 'chroot/tmp', build_id) - command = ( - 'cd %s ; %s %s' % (download_path, uncompress_cmd, package_file_name)) + command = ('cd %s ; %s %s' % + (download_path, uncompress_cmd, package_file_name)) if self.log_level != 'verbose': self._logger.LogOutput('CMD: %s' % command) @@ -193,8 +193,8 @@ class ImageDownloader(object): def VerifyFileExists(self, chromeos_root, build_id, package_file): # Quickly verify if the files are there status = 0 - gs_package_name = ( - 'gs://chromeos-image-archive/%s/%s' % (build_id, package_file)) + gs_package_name = ('gs://chromeos-image-archive/%s/%s' % + (build_id, package_file)) gsutil_cmd = os.path.join(chromeos_root, GS_UTIL) if not test_flag.GetTestMode(): cmd = '%s ls %s' % (gsutil_cmd, gs_package_name) @@ -227,9 +227,9 @@ class ImageDownloader(object): autotest_packages_name) if status != 0: default_autotest_dir = '/mnt/host/source/src/third_party/autotest/files' - print( - '(Warning: Could not find autotest packages .)\n' - '(Warning: Defaulting autotest path to %s .' % default_autotest_dir) + print('(Warning: Could not find autotest packages .)\n' + '(Warning: Defaulting autotest path to %s .' % + default_autotest_dir) return default_autotest_dir # Files exist on server, download and uncompress them @@ -281,22 +281,26 @@ class ImageDownloader(object): self.UncompressSingleFile(chromeos_root, build_id, debug_archive_name, 'tar -xf ') - # Rename created autotest directory to autotest_files - command = ('cd %s ; mv debug debug_files' % download_path) + # Extract and move debug files into the proper location. + debug_dir = 'debug_files/usr/lib' + command = ('cd %s ; mkdir -p %s; mv debug %s' % + (download_path, debug_dir, debug_dir)) if self.log_level != 'verbose': self._logger.LogOutput('CMD: %s' % command) - print('(Moving downloaded debug files to debug_files)') + print('Moving downloaded debug files to %s' % debug_dir) retval = self._ce.RunCommand(command) if retval != 0: - raise MissingFile('Could not create directory debug_files') + raise MissingFile('Could not create directory %s' % + os.path.join(debug_dir, 'debug')) return debug_rel_path def Run(self, chromeos_root, xbuddy_label, autotest_path, debug_path, download_debug): build_id = self.GetBuildID(chromeos_root, xbuddy_label) - image_name = ('gs://chromeos-image-archive/%s/chromiumos_test_image.tar.xz' - % build_id) + image_name = ( + 'gs://chromeos-image-archive/%s/chromiumos_test_image.tar.xz' % + build_id) # Verify that image exists for build_id, before attempting to # download it. diff --git a/crosperf/results_cache.py b/crosperf/results_cache.py index 3342f93a..87e30ecc 100644 --- a/crosperf/results_cache.py +++ b/crosperf/results_cache.py @@ -273,7 +273,7 @@ class Result(object): return keyvals_dict def GetSamples(self): - samples = 0 + actual_samples = 0 for perf_data_file in self.perf_data_files: chroot_perf_data_file = misc.GetInsideChrootPath(self.chromeos_root, perf_data_file) @@ -304,17 +304,53 @@ class Result(object): # Each line looks like this: # 45.42% 237210 chrome # And we want the second number which is the sample count. - sample = 0 + samples = 0 try: for line in result.split('\n'): attr = line.split() if len(attr) == 3 and '%' in attr[0]: - sample += int(attr[1]) + samples += int(attr[1]) except: raise RuntimeError('Cannot parse perf dso result') - samples += sample - return [samples, u'samples'] + actual_samples += samples + + # Remove idle cycles from the accumulated sample count. + perf_report_file = f'{perf_data_file}.report' + if not os.path.exists(perf_report_file): + raise RuntimeError(f'Missing perf report file: {perf_report_file}') + + idle_functions = { + '[kernel.kallsyms]': + ('intel_idle', 'arch_cpu_idle', 'intel_idle', 'cpu_startup_entry', + 'default_idle', 'cpu_idle_loop', 'do_idle'), + } + idle_samples = 0 + + with open(perf_report_file) as f: + try: + for line in f: + line = line.strip() + if not line or line[0] == '#': + continue + # Each line has the following fields, + # pylint: disable=line-too-long + # Overhead Samples Command Shared Object Symbol + # pylint: disable=line-too-long + # 1.48% 60 swapper [kernel.kallsyms] [k] intel_idle + # pylint: disable=line-too-long + # 0.00% 1 shill libshill-net.so [.] std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >::vector<unsigned char const*> + _, samples, _, dso, _, function = line.split(None, 5) + + if dso in idle_functions and function in idle_functions[dso]: + if self.log_level != 'verbose': + self._logger.LogOutput('Removing %s samples from %s in %s' % + (samples, function, dso)) + idle_samples += int(samples) + except: + raise RuntimeError('Cannot parse perf report') + actual_samples -= idle_samples + return [actual_samples, u'samples'] def GetResultsDir(self): if self.suite == 'tast': @@ -351,11 +387,11 @@ class Result(object): result = self.FindFilesInResultsDir('-name perf_measurements').splitlines() if not result: if self.suite == 'telemetry_Crosperf': - result = \ - self.FindFilesInResultsDir('-name histograms.json').splitlines() + result = ( + self.FindFilesInResultsDir('-name histograms.json').splitlines()) else: - result = \ - self.FindFilesInResultsDir('-name results-chart.json').splitlines() + result = ( + self.FindFilesInResultsDir('-name results-chart.json').splitlines()) return result def GetTurbostatFile(self): @@ -413,7 +449,8 @@ class Result(object): if debug_path: symfs = '--symfs ' + debug_path - vmlinux = '--vmlinux ' + os.path.join(debug_path, 'boot', 'vmlinux') + vmlinux = '--vmlinux ' + os.path.join(debug_path, 'usr', 'lib', 'debug', + 'boot', 'vmlinux') kallsyms = '' print('** WARNING **: --kallsyms option not applied, no System.map-* ' 'for downloaded image.') @@ -1204,8 +1241,8 @@ class TelemetryResult(Result): self.err = pickle.load(f) self.retval = pickle.load(f) - self.chrome_version = \ - super(TelemetryResult, self).GetChromeVersionFromCache(cache_dir) + self.chrome_version = ( + super(TelemetryResult, self).GetChromeVersionFromCache(cache_dir)) self.ProcessResults() diff --git a/crosperf/results_cache_unittest.py b/crosperf/results_cache_unittest.py index e2730e5f..df3a35e9 100755 --- a/crosperf/results_cache_unittest.py +++ b/crosperf/results_cache_unittest.py @@ -9,6 +9,7 @@ from __future__ import print_function +import io import os import shutil import tempfile @@ -188,8 +189,8 @@ PERF_DATA_HEADER = """ # """ -TURBOSTAT_LOG_OUTPUT = \ -"""CPU Avg_MHz Busy% Bzy_MHz TSC_MHz IRQ CoreTmp +TURBOSTAT_LOG_OUTPUT = ( + """CPU Avg_MHz Busy% Bzy_MHz TSC_MHz IRQ CoreTmp - 329 12.13 2723 2393 10975 77 0 336 12.41 2715 2393 6328 77 2 323 11.86 2731 2393 4647 69 @@ -217,7 +218,7 @@ CPU Avg_MHz Busy% Bzy_MHz TSC_MHz IRQ CoreTmp - 843 29.83 2832 2393 28161 47 0 827 29.35 2826 2393 16093 47 2 858 30.31 2838 2393 12068 46 -""" +""") TURBOSTAT_DATA = { 'cpufreq': { 'all': [2723, 2884, 2927, 2937, 2932, 2933, 2832] @@ -227,8 +228,7 @@ TURBOSTAT_DATA = { }, } -TOP_LOG = \ -""" +TOP_LOG = (""" PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 4102 chronos 12 -8 3454472 238300 118188 R 41.8 6.1 0:08.37 chrome 4204 chronos 12 -8 2492716 205728 179016 S 11.8 5.3 0:03.89 chrome @@ -250,7 +250,7 @@ TOP_LOG = \ 5713 chronos 20 0 5178652 103120 50372 S 17.8 2.6 0:01.13 chrome 7 root 20 0 0 0 0 S 1.0 0.0 0:00.73 rcu_preempt 855 root 20 0 0 0 0 S 1.0 0.0 0:00.01 kworker/4:2 -""" +""") TOP_DATA = [ { 'cmd': 'chrome-5745', @@ -301,8 +301,7 @@ TOP_DATA = [ 'top5_cpu_use': [1.0], }, ] -TOP_OUTPUT = \ -""" COMMAND AVG CPU% SEEN HIGHEST 5 +TOP_OUTPUT = (""" COMMAND AVG CPU% SEEN HIGHEST 5 chrome 128.250000 6 [122.8, 107.9, 17.8, 5.0, 2.0] irq/230-cros-ec 1.000000 1 [2.0] sshd 0.500000 1 [1.0] @@ -310,10 +309,9 @@ TOP_OUTPUT = \ spi5 0.500000 1 [1.0] rcu_preempt 0.500000 1 [1.0] kworker/4:2 0.500000 1 [1.0] -""" +""") -CPUSTATS_UNIQ_OUTPUT = \ -""" +CPUSTATS_UNIQ_OUTPUT = (""" /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq 1512000 /sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_cur_freq 1512000 /sys/devices/system/cpu/cpu3/cpufreq/cpuinfo_cur_freq 2016000 @@ -326,7 +324,7 @@ big-cpu 51234 soc-thermal 45456 little-cpu 42555 big-cpu 61724 -""" +""") CPUSTATS_UNIQ_DATA = { 'cpufreq': { 'cpu0': [1512, 1500], @@ -339,8 +337,7 @@ CPUSTATS_UNIQ_DATA = { 'big-cpu': [51.2, 61.7] } } -CPUSTATS_DUPL_OUTPUT = \ -""" +CPUSTATS_DUPL_OUTPUT = (""" /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq 1512000 /sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_cur_freq 1512000 /sys/devices/system/cpu/cpu2/cpufreq/cpuinfo_cur_freq 1512000 @@ -353,7 +350,7 @@ CPUSTATS_DUPL_OUTPUT = \ /sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_cur_freq 1614000 /sys/devices/system/cpu/cpu2/cpufreq/cpuinfo_cur_freq 1614000 /sys/devices/system/cpu/cpu3/cpufreq/cpuinfo_cur_freq 1982000 -""" +""") CPUSTATS_DUPL_DATA = { 'cpufreq': { 'cpu0': [1512, 1500, 1614], @@ -363,8 +360,7 @@ CPUSTATS_DUPL_DATA = { TMP_DIR1 = '/tmp/tmpAbcXyz' -HISTOGRAMSET = \ -""" +HISTOGRAMSET = (""" [ { "values": [ @@ -436,7 +432,7 @@ HISTOGRAMSET = \ } ] -""" +""") # pylint: enable=line-too-long @@ -773,15 +769,25 @@ class ResultTest(unittest.TestCase): @mock.patch.object(misc, 'GetInsideChrootPath') @mock.patch.object(command_executer.CommandExecuter, 'ChrootRunCommandWOutput') - def test_get_samples(self, mock_chrootruncmd, mock_getpath): - fake_file = '/usr/chromeos/chroot/tmp/results/fake_file' + @mock.patch.object(os.path, 'exists') + def test_get_samples(self, mock_exists, mock_get_total_samples, mock_getpath): self.result.perf_data_files = ['/tmp/results/perf.data'] self.result.board = 'samus' - mock_getpath.return_value = fake_file - self.result.ce.ChrootRunCommandWOutput = mock_chrootruncmd - mock_chrootruncmd.return_value = ['', '45.42% 237210 chrome ', ''] - samples = self.result.GetSamples() - self.assertEqual(samples, [237210, u'samples']) + mock_getpath.return_value = '/usr/chromeos/chroot/tmp/results/perf.data' + mock_get_total_samples.return_value = [ + '', '45.42% 237210 chrome ', '' + ] + mock_exists.return_value = True + + # mock_open does not seem to support iteration. + # pylint: disable=line-too-long + content = """1.63% 66 dav1d-tile chrome [.] decode_coefs + 1.48% 60 swapper [kernel.kallsyms] [k] intel_idle + 1.16% 47 dav1d-tile chrome [.] decode_sb""" + + with mock.patch('builtins.open', return_value=io.StringIO(content)): + samples = self.result.GetSamples() + self.assertEqual(samples, [237210 - 60, u'samples']) def test_get_results_dir(self): @@ -1262,7 +1268,7 @@ class ResultTest(unittest.TestCase): self.assertEqual(mock_chrootruncmd.call_args_list[0][0], (self.result.chromeos_root, ('/usr/sbin/perf report -n --symfs /tmp/debug ' - '--vmlinux /tmp/debug/boot/vmlinux ' + '--vmlinux /tmp/debug/usr/lib/debug/boot/vmlinux ' '-i %s --stdio > %s') % (fake_file, fake_file))) @mock.patch.object(misc, 'GetOutsideChrootPath') @@ -1940,8 +1946,8 @@ class ResultsCacheTest(unittest.TestCase): mock_checksum.return_value = 'FakeImageChecksumabc123' self.results_cache.machine_manager.GetMachines = FakeGetMachines - self.results_cache.machine_manager.machine_checksum['mock_label'] = \ - 'FakeMachineChecksumabc987' + self.results_cache.machine_manager.machine_checksum['mock_label'] = ( + 'FakeMachineChecksumabc987') # Based on the label, benchmark and machines, get the directory in which # to store the cache information for this test run. result_path = self.results_cache.GetCacheDirForWrite() @@ -1987,8 +1993,8 @@ class ResultsCacheTest(unittest.TestCase): mock_checksum.return_value = 'FakeImageChecksumabc123' self.results_cache.machine_manager.GetMachines = FakeGetMachines - self.results_cache.machine_manager.machine_checksum['mock_label'] = \ - 'FakeMachineChecksumabc987' + self.results_cache.machine_manager.machine_checksum['mock_label'] = ( + 'FakeMachineChecksumabc987') # Test 1. Generating cache name for reading (not writing). key_list = self.results_cache.GetCacheKeyList(True) diff --git a/debug_info_test/check_cus.py b/debug_info_test/check_cus.py index d3cd6365..41123259 100644 --- a/debug_info_test/check_cus.py +++ b/debug_info_test/check_cus.py @@ -49,7 +49,7 @@ def check_compile_units(dso_path): comp_path = '' readelf = subprocess.Popen( - ['readelf', '--debug-dump=info', '--dwarf-depth=1', dso_path], + ['llvm-dwarfdump', '--recurse-depth=0', dso_path], stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'), encoding='utf-8') diff --git a/debug_info_test/check_exist.py b/debug_info_test/check_exist.py index f2cc7c6b..898dae45 100644 --- a/debug_info_test/check_exist.py +++ b/debug_info_test/check_exist.py @@ -85,7 +85,7 @@ def check_exist_all(dso_path): """ readelf = subprocess.Popen( - ['readelf', '--debug-dump=info', '--dwarf-depth=1', dso_path], + ['llvm-dwarfdump', '--recurse-depth=0', dso_path], stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'), encoding='utf-8') diff --git a/llvm_tools/README.md b/llvm_tools/README.md index f15040ec..43c80ad6 100644 --- a/llvm_tools/README.md +++ b/llvm_tools/README.md @@ -495,6 +495,10 @@ more information, please see the `--help` ### `revert_checker.py` +**This script is copied from upstream LLVM. Please prefer to make upstream edits, +rather than modifying this script. It's kept in a CrOS repo so we don't need an +LLVM tree to `import` this from scripts here.** + This script reports reverts which happen 'across' a certain LLVM commit. To clarify the meaning of 'across' with an example, if we had the following diff --git a/llvm_tools/get_llvm_hash.py b/llvm_tools/get_llvm_hash.py index 7c770e64..83b5ae76 100755 --- a/llvm_tools/get_llvm_hash.py +++ b/llvm_tools/get_llvm_hash.py @@ -9,16 +9,18 @@ from __future__ import print_function import argparse +import contextlib +import functools import os +import re import shutil import subprocess import sys import tempfile -from contextlib import contextmanager import git_llvm_rev -from subprocess_helpers import CheckCommand from subprocess_helpers import check_output +from subprocess_helpers import CheckCommand _LLVM_GIT_URL = ('https://chromium.googlesource.com/external/github.com/llvm' '/llvm-project') @@ -63,7 +65,66 @@ def GetGitHashFrom(src_dir, version): git_llvm_rev.Rev(branch=git_llvm_rev.MAIN_BRANCH, number=version)) -@contextmanager +def CheckoutBranch(src_dir, branch): + """Checks out and pulls from a branch in a git repo. + + Args: + src_dir: The LLVM source tree. + branch: The git branch to checkout in src_dir. + + Raises: + ValueError: Failed to checkout or pull branch version + """ + CheckCommand(['git', '-C', src_dir, 'checkout', branch]) + CheckCommand(['git', '-C', src_dir, 'pull']) + + +def ParseLLVMMajorVersion(cmakelist): + """Reads CMakeList.txt file contents for LLVMMajor Version. + + Args: + cmakelist: contents of CMakeList.txt + + Returns: + The major version number as a string + + Raises: + ValueError: The major version cannot be parsed from cmakelist + """ + match = re.search(r'\n\s+set\(LLVM_VERSION_MAJOR (?P<major>\d+)\)', cmakelist) + if not match: + raise ValueError('Failed to parse CMakeList for llvm major version') + return match.group('major') + + +@functools.lru_cache(maxsize=1) +def GetLLVMMajorVersion(git_hash=None): + """Reads llvm/CMakeList.txt file contents for LLVMMajor Version. + + Args: + git_hash: git hash of llvm version as string or None for top of trunk + + Returns: + The major version number as a string + + Raises: + ValueError: The major version cannot be parsed from cmakelist or + there was a failure to checkout git_hash version + FileExistsError: The src directory doe not contain CMakeList.txt + """ + src_dir = GetAndUpdateLLVMProjectInLLVMTools() + cmakelists_path = os.path.join(src_dir, 'llvm', 'CMakeLists.txt') + if git_hash: + CheckCommand(['git', '-C', src_dir, 'checkout', git_hash]) + try: + with open(cmakelists_path) as cmakelists_file: + return ParseLLVMMajorVersion(cmakelists_file.read()) + finally: + if git_hash: + CheckoutBranch(src_dir, git_llvm_rev.MAIN_BRANCH) + + +@contextlib.contextmanager def CreateTempLLVMRepo(temp_dir): """Adds a LLVM worktree to 'temp_dir'. @@ -77,7 +138,7 @@ def CreateTempLLVMRepo(temp_dir): temp_dir: An absolute path to the temporary directory to put the worktree in (obtained via 'tempfile.mkdtemp()'). - Returns: + Yields: The absolute path to 'temp_dir'. Raises: @@ -114,6 +175,9 @@ def GetAndUpdateLLVMProjectInLLVMTools(): LLVM mirror. In either case, this function will return the absolute path to 'llvm-project-copy' directory. + Returns: + Absolute path to 'llvm-project-copy' directory in 'llvm_tools' + Raises: ValueError: LLVM repo (in 'llvm-project-copy' dir.) has changes or failed to checkout to main or failed to fetch from chromium mirror of LLVM. @@ -125,9 +189,11 @@ def GetAndUpdateLLVMProjectInLLVMTools(): 'llvm-project-copy') if not os.path.isdir(abs_path_to_llvm_project_dir): - print('Checking out LLVM from scratch. This could take a while...\n' - '(This should only need to be done once, though.)', - file=sys.stderr) + print( + (f'Checking out LLVM to {abs_path_to_llvm_project_dir}\n' + 'so that we can map between commit hashes and revision numbers.\n' + 'This may take a while, but only has to be done once.'), + file=sys.stderr) os.mkdir(abs_path_to_llvm_project_dir) LLVMHash().CloneLLVMRepo(abs_path_to_llvm_project_dir) @@ -142,11 +208,7 @@ def GetAndUpdateLLVMProjectInLLVMTools(): raise ValueError('LLVM repo in %s has changes, please remove.' % abs_path_to_llvm_project_dir) - CheckCommand([ - 'git', '-C', abs_path_to_llvm_project_dir, 'checkout', - git_llvm_rev.MAIN_BRANCH - ]) - CheckCommand(['git', '-C', abs_path_to_llvm_project_dir, 'pull']) + CheckoutBranch(abs_path_to_llvm_project_dir, git_llvm_rev.MAIN_BRANCH) return abs_path_to_llvm_project_dir @@ -154,6 +216,9 @@ def GetAndUpdateLLVMProjectInLLVMTools(): def GetGoogle3LLVMVersion(stable): """Gets the latest google3 LLVM version. + Args: + stable: boolean, use the stable version or the unstable version + Returns: The latest LLVM SVN version as an integer. @@ -178,7 +243,7 @@ def GetGoogle3LLVMVersion(stable): return GetVersionFrom(GetAndUpdateLLVMProjectInLLVMTools(), git_hash.rstrip()) -def is_svn_option(svn_option): +def IsSvnOption(svn_option): """Validates whether the argument (string) is a git hash option. The argument is used to find the git hash of LLVM. @@ -186,6 +251,10 @@ def is_svn_option(svn_option): Args: svn_option: The option passed in as a command line argument. + Returns: + lowercase svn_option if it is a known hash source, otherwise the svn_option + as an int + Raises: ValueError: Invalid svn option provided. """ @@ -212,7 +281,7 @@ def GetLLVMHashAndVersionFromSVNOption(svn_option): Args: svn_option: A valid svn option obtained from the command line. - Ex: 'google3', 'tot', or <svn_version> such as 365123. + Ex. 'google3', 'tot', or <svn_version> such as 365123. Returns: A tuple that is the LLVM git hash and LLVM version. @@ -240,7 +309,7 @@ class LLVMHash(object): """Provides methods to retrieve a LLVM hash.""" @staticmethod - @contextmanager + @contextlib.contextmanager def CreateTempDirectory(): temp_dir = tempfile.mkdtemp() @@ -310,7 +379,7 @@ def main(): parser = argparse.ArgumentParser(description='Finds the LLVM hash.') parser.add_argument( '--llvm_version', - type=is_svn_option, + type=IsSvnOption, required=True, help='which git hash of LLVM to find. Either a svn revision, or one ' 'of %s' % sorted(KNOWN_HASH_SOURCES)) diff --git a/llvm_tools/get_llvm_hash_unittest.py b/llvm_tools/get_llvm_hash_unittest.py index 2e56aed5..49740f33 100755 --- a/llvm_tools/get_llvm_hash_unittest.py +++ b/llvm_tools/get_llvm_hash_unittest.py @@ -90,6 +90,50 @@ class TestGetLLVMHash(unittest.TestCase): self.assertEqual(LLVMHash().GetTopOfTrunkGitHash(), 'a123testhash1') mock_check_output.assert_called_once() + @mock.patch.object(subprocess, 'Popen') + def testCheckoutBranch(self, mock_popen): + mock_popen.return_value = mock.MagicMock( + communicate=lambda: (None, None), returncode=0) + get_llvm_hash.CheckoutBranch('fake/src_dir', 'fake_branch') + self.assertEqual( + mock_popen.call_args_list[0][0], + (['git', '-C', 'fake/src_dir', 'checkout', 'fake_branch'],)) + self.assertEqual(mock_popen.call_args_list[1][0], + (['git', '-C', 'fake/src_dir', 'pull'],)) + + def testParseLLVMMajorVersion(self): + cmakelist_42 = ('set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)\n' + 'if(NOT DEFINED LLVM_VERSION_MAJOR)\n' + ' set(LLVM_VERSION_MAJOR 42)\n' + 'endif()') + self.assertEqual(get_llvm_hash.ParseLLVMMajorVersion(cmakelist_42), '42') + + def testParseLLVMMajorVersionInvalid(self): + invalid_cmakelist = 'invalid cmakelist.txt contents' + with self.assertRaises(ValueError): + get_llvm_hash.ParseLLVMMajorVersion(invalid_cmakelist) + + @mock.patch.object(get_llvm_hash, 'GetAndUpdateLLVMProjectInLLVMTools') + @mock.patch.object(get_llvm_hash, 'ParseLLVMMajorVersion') + @mock.patch.object(get_llvm_hash, 'CheckCommand') + @mock.patch.object(get_llvm_hash, 'CheckoutBranch') + @mock.patch( + 'get_llvm_hash.open', + mock.mock_open(read_data='mock contents'), + create=True) + def testGetLLVMMajorVersion(self, mock_checkout_branch, mock_git_checkout, + mock_major_version, mock_llvm_project_path): + mock_llvm_project_path.return_value = 'path/to/llvm-project' + mock_major_version.return_value = '1234' + self.assertEqual(get_llvm_hash.GetLLVMMajorVersion('314159265'), '1234') + # Second call should be memoized + self.assertEqual(get_llvm_hash.GetLLVMMajorVersion('314159265'), '1234') + mock_llvm_project_path.assert_called_once() + mock_major_version.assert_called_with('mock contents') + mock_git_checkout.assert_called_once_with( + ['git', '-C', 'path/to/llvm-project', 'checkout', '314159265']) + mock_checkout_branch.assert_called_once_with('path/to/llvm-project', 'main') + if __name__ == '__main__': unittest.main() diff --git a/llvm_tools/get_upstream_patch.py b/llvm_tools/get_upstream_patch.py index 350fc25c..77783d41 100755 --- a/llvm_tools/get_upstream_patch.py +++ b/llvm_tools/get_upstream_patch.py @@ -4,8 +4,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# pylint: disable=cros-logging-import - """Get an upstream patch to LLVM's PATCHES.json.""" from __future__ import print_function @@ -101,6 +99,7 @@ def add_patch(patches_json_path: str, patches_dir: str, temp_file = patches_json_path + '.tmp' with open(temp_file, 'w', encoding='utf-8') as f: json.dump(patches_json, f, indent=4, separators=(',', ': ')) + f.write('\n') os.rename(temp_file, patches_json_path) diff --git a/llvm_tools/git_llvm_rev.py b/llvm_tools/git_llvm_rev.py index c8c1505c..b62b26e2 100755 --- a/llvm_tools/git_llvm_rev.py +++ b/llvm_tools/git_llvm_rev.py @@ -183,6 +183,11 @@ def translate_sha_to_rev(llvm_config: LLVMConfig, sha_or_ref: str) -> Rev: raise ValueError( f'No viable branches found from {llvm_config.remote} with {sha}') + # It seems that some `origin/release/.*` branches have + # `origin/upstream/release/.*` equivalents, which is... awkward to deal with. + # Prefer the latter, since that seems to have newer commits than the former. + # Technically n^2, but len(elements) should be like, tens in the worst case. + candidates = [x for x in candidates if f'upstream/{x}' not in candidates] if len(candidates) != 1: raise ValueError( f'Ambiguity: multiple branches from {llvm_config.remote} have {sha}: ' diff --git a/llvm_tools/git_llvm_rev_test.py b/llvm_tools/git_llvm_rev_test.py index 74280c5d..d05093a8 100755 --- a/llvm_tools/git_llvm_rev_test.py +++ b/llvm_tools/git_llvm_rev_test.py @@ -93,7 +93,7 @@ class Test(unittest.TestCase): def test_zz_branch_revs_work_after_merge_points_and_svn_cutoff(self) -> None: # Arbitrary 9.x commit without an attached llvm-svn: value. sha = self.rev_to_sha_with_round_trip( - git_llvm_rev.Rev(branch='release/9.x', number=366670)) + git_llvm_rev.Rev(branch='upstream/release/9.x', number=366670)) self.assertEqual(sha, '4e858e4ac00b59f064da4e1f7e276916e7d296aa') def test_zz_branch_revs_work_at_merge_points(self) -> None: @@ -108,7 +108,7 @@ class Test(unittest.TestCase): # branch, we'll pick main for this. That's fine. sha = git_llvm_rev.translate_rev_to_sha( get_llvm_config(), - git_llvm_rev.Rev(branch='release/9.x', number=rev_number)) + git_llvm_rev.Rev(branch='upstream/release/9.x', number=rev_number)) self.assertEqual(sha, backing_sha) def test_zz_branch_revs_work_after_merge_points(self) -> None: @@ -117,7 +117,7 @@ class Test(unittest.TestCase): # ours, and are therefore untrustworthy. The commit for this *does* have a # different `llvm-svn:` string than we should have. sha = self.rev_to_sha_with_round_trip( - git_llvm_rev.Rev(branch='release/9.x', number=366427)) + git_llvm_rev.Rev(branch='upstream/release/9.x', number=366427)) self.assertEqual(sha, '2cf681a11aea459b50d712abc7136f7129e4d57f') diff --git a/llvm_tools/revert_checker.py b/llvm_tools/revert_checker.py index bb9182b0..acc8b5fa 100755 --- a/llvm_tools/revert_checker.py +++ b/llvm_tools/revert_checker.py @@ -1,8 +1,17 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -# 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. +#===----------------------------------------------------------------------===## +# +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +#===----------------------------------------------------------------------===## +# +# !!!!!!!!!!!! NOTE !!!!!!!!!!!! +# This is copied directly from upstream LLVM. Please make any changes upstream, +# rather than to this file directly. Once changes are made there, you're free +# to integrate them here. """Checks for reverts of commits across a given git commit. @@ -20,11 +29,21 @@ conflicts/etc always introduce _some_ amount of fuzziness. This script just uses a bundle of heuristics, and is bound to ignore / incorrectly flag some reverts. The hope is that it'll easily catch the vast majority (>90%) of them, though. -""" -# pylint: disable=cros-logging-import +This is designed to be used in one of two ways: an import in Python, or run +directly from a shell. If you want to import this, the `find_reverts` +function is the thing to look at. If you'd rather use this from a shell, have a +usage example: + +``` +./revert_checker.py c47f97169 origin/main origin/release/12.x +``` -from __future__ import print_function +This checks for all reverts from the tip of origin/main to c47f97169, which are +across the latter. It then does the same for origin/release/12.x to c47f97169. +Duplicate reverts discovered when walking both roots (origin/main and +origin/release/12.x) are deduplicated in output. +""" import argparse import collections @@ -32,7 +51,9 @@ import logging import re import subprocess import sys -import typing as t +from typing import Generator, List, NamedTuple, Iterable + +assert sys.version_info >= (3, 6), 'Only Python 3.6+ is supported.' # People are creative with their reverts, and heuristics are a bit difficult. # Like 90% of of reverts have "This reverts commit ${full_sha}". @@ -43,7 +64,7 @@ import typing as t # starts involving human intervention, which is probably not worth it for now. -def _try_parse_reverts_from_commit_message(commit_message: str) -> t.List[str]: +def _try_parse_reverts_from_commit_message(commit_message: str) -> List[str]: if not commit_message: return [] @@ -56,9 +77,10 @@ def _try_parse_reverts_from_commit_message(commit_message: str) -> t.List[str]: return results -def _stream_stdout(command: t.List[str]) -> t.Generator[str, None, None]: +def _stream_stdout(command: List[str]) -> Generator[str, None, None]: with subprocess.Popen( command, stdout=subprocess.PIPE, encoding='utf-8', errors='replace') as p: + assert p.stdout is not None # for mypy's happiness. yield from p.stdout @@ -73,14 +95,14 @@ def _resolve_sha(git_dir: str, sha: str) -> str: ).strip() -_LogEntry = t.NamedTuple('_LogEntry', [ +_LogEntry = NamedTuple('_LogEntry', [ ('sha', str), - ('commit_message', t.List[str]), + ('commit_message', str), ]) def _log_stream(git_dir: str, root_sha: str, - end_at_sha: str) -> t.Iterable[_LogEntry]: + end_at_sha: str) -> Iterable[_LogEntry]: sep = 50 * '<>' log_command = [ 'git', @@ -103,8 +125,6 @@ def _log_stream(git_dir: str, root_sha: str, break while found_commit_header: - # crbug.com/1041148 - # pylint: disable=stop-iteration-return sha = next(stdout_stream, None) assert sha is not None, 'git died?' sha = sha.rstrip() @@ -122,52 +142,54 @@ def _log_stream(git_dir: str, root_sha: str, yield _LogEntry(sha, '\n'.join(commit_message).rstrip()) -def _shas_between(git_dir: str, base_ref: str, - head_ref: str) -> t.Iterable[str]: +def _shas_between(git_dir: str, base_ref: str, head_ref: str) -> Iterable[str]: rev_list = [ 'git', '-C', git_dir, 'rev-list', '--first-parent', - '%s..%s' % (base_ref, head_ref), + f'{base_ref}..{head_ref}', ] return (x.strip() for x in _stream_stdout(rev_list)) def _rev_parse(git_dir: str, ref: str) -> str: - result = subprocess.check_output( + return subprocess.check_output( ['git', '-C', git_dir, 'rev-parse', ref], encoding='utf-8', ).strip() - return t.cast(str, result) -Revert = t.NamedTuple('Revert', [ +Revert = NamedTuple('Revert', [ ('sha', str), ('reverted_sha', str), ]) -def find_common_parent_commit(git_dir: str, ref_a: str, ref_b: str) -> str: +def _find_common_parent_commit(git_dir: str, ref_a: str, ref_b: str) -> str: + """Finds the closest common parent commit between `ref_a` and `ref_b`.""" return subprocess.check_output( ['git', '-C', git_dir, 'merge-base', ref_a, ref_b], encoding='utf-8', ).strip() -def find_reverts(git_dir: str, across_ref: str, root: str) -> t.List[Revert]: - """Finds reverts across `across_ref` in `git_dir`, starting from `root`.""" +def find_reverts(git_dir: str, across_ref: str, root: str) -> List[Revert]: + """Finds reverts across `across_ref` in `git_dir`, starting from `root`. + + These reverts are returned in order of oldest reverts first. + """ across_sha = _rev_parse(git_dir, across_ref) root_sha = _rev_parse(git_dir, root) - common_ancestor = find_common_parent_commit(git_dir, across_sha, root_sha) + common_ancestor = _find_common_parent_commit(git_dir, across_sha, root_sha) if common_ancestor != across_sha: - raise ValueError("%s isn't an ancestor of %s (common ancestor: %s)" % - (across_sha, root_sha, common_ancestor)) + raise ValueError(f"{across_sha} isn't an ancestor of {root_sha} " + '(common ancestor: {common_ancestor})') intermediate_commits = set(_shas_between(git_dir, across_sha, root_sha)) - assert across_ref not in intermediate_commits + assert across_sha not in intermediate_commits logging.debug('%d commits appear between %s and %s', len(intermediate_commits), across_sha, root_sha) @@ -204,10 +226,14 @@ def find_reverts(git_dir: str, across_ref: str, root: str) -> t.List[Revert]: logging.error("%s claims to revert %s -- which isn't a commit -- %s", sha, object_type, reverted_sha) + # Since `all_reverts` contains reverts in log order (e.g., newer comes before + # older), we need to reverse this to keep with our guarantee of older = + # earlier in the result. + all_reverts.reverse() return all_reverts -def main(args: t.List[str]) -> int: +def _main() -> None: parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument( @@ -217,7 +243,7 @@ def main(args: t.List[str]) -> int: parser.add_argument( 'root', nargs='+', help='Root(s) to search for commits from.') parser.add_argument('--debug', action='store_true') - opts = parser.parse_args(args) + opts = parser.parse_args() logging.basicConfig( format='%(asctime)s: %(levelname)s: %(filename)s:%(lineno)d: %(message)s', @@ -228,14 +254,17 @@ def main(args: t.List[str]) -> int: # out. The overwhelmingly common case is also to have one root, and it's way # easier to reason about output that comes in an order that's meaningful to # git. - all_reverts = collections.OrderedDict() + seen_reverts = set() + all_reverts = [] for root in opts.root: for revert in find_reverts(opts.git_dir, opts.base_ref, root): - all_reverts[revert] = None + if revert not in seen_reverts: + seen_reverts.add(revert) + all_reverts.append(revert) - for revert in all_reverts.keys(): - print('%s claims to revert %s' % (revert.sha, revert.reverted_sha)) + for revert in all_reverts: + print(f'{revert.sha} claims to revert {revert.reverted_sha}') if __name__ == '__main__': - sys.exit(main(sys.argv[1:])) + _main() diff --git a/llvm_tools/revert_checker_test.py b/llvm_tools/revert_checker_test.py deleted file mode 100755 index 16b3c3f6..00000000 --- a/llvm_tools/revert_checker_test.py +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# 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. - -"""Tests for revert_checker.""" - -from __future__ import print_function - -# pylint: disable=cros-logging-import -import logging -import unittest - -import llvm_project -import revert_checker - -# pylint: disable=protected-access - - -class _SilencingFilter(object): - """Silences all log messages. - - Also collects info about log messages that would've been emitted. - """ - - def __init__(self): - self.messages = [] - - def filter(self, record): - self.messages.append(record.getMessage()) - return 0 - - -class Test(unittest.TestCase): - """Tests for revert_checker.""" - - def silence_logging(self): - root = logging.getLogger() - filt = _SilencingFilter() - root.addFilter(filt) - self.addCleanup(root.removeFilter, filt) - return filt - - def test_known_log_stream(self): - start_sha = 'e241573d5972d34a323fa5c64774c4207340beb3' - end_sha = 'a7a37517751ffb0f5529011b4ba96e67fcb27510' - commits = [ - revert_checker._LogEntry( - 'e241573d5972d34a323fa5c64774c4207340beb3', '\n'.join(( - '[mlir] NFC: remove IntegerValueSet / MutableIntegerSet', - '', - 'Summary:', - '- these are unused and really not needed now given flat ' - 'affine', - ' constraints', - '', - 'Differential Revision: https://reviews.llvm.org/D75792', - ))), - revert_checker._LogEntry( - '97572fa6e9daecd648873496fd11f7d1e25a55f0', - '[NFC] use hasAnyOperatorName and hasAnyOverloadedOperatorName ' - 'functions in clang-tidy matchers', - ), - ] - - logs = list( - revert_checker._log_stream( - llvm_project.get_location(), - root_sha=start_sha, - end_at_sha=end_sha, - )) - self.assertEqual(commits, logs) - - def test_reverted_noncommit_object_is_a_nop(self): - log_filter = self.silence_logging() - # c9944df916e41b1014dff5f6f75d52297b48ecdc mentions reverting a non-commit - # object. It sits between the given base_ref and root. - reverts = revert_checker.find_reverts( - git_dir=llvm_project.get_location(), - across_ref='c9944df916e41b1014dff5f6f75d52297b48ecdc~', - root='c9944df916e41b1014dff5f6f75d52297b48ecdc') - self.assertEqual(reverts, []) - - complaint = ('Failed to resolve reverted object ' - 'edd18355be574122aaa9abf58c15d8c50fb085a1') - self.assertTrue( - any(x.startswith(complaint) for x in log_filter.messages), - log_filter.messages) - - def test_known_reverts_across_previous_llvm_next_rev(self): - # c9944df916e41b1014dff5f6f75d52297b48ecdc mentions reverting a non-commit - # object. It sits between the given base_ref and root. - reverts = revert_checker.find_reverts( - git_dir=llvm_project.get_location(), - across_ref='c47f971694be0159ffddfee8a75ae515eba91439', - root='9f981e9adf9c8d29bb80306daf08d2770263ade6') - self.assertEqual(reverts, [ - revert_checker.Revert( - sha='9f981e9adf9c8d29bb80306daf08d2770263ade6', - reverted_sha='4060016fce3e6a0b926ee9fc59e440a612d3a2ec'), - revert_checker.Revert( - sha='4e0fe038f438ae1679eae9e156e1f248595b2373', - reverted_sha='65b21282c710afe9c275778820c6e3c1cf46734b'), - ]) - - -if __name__ == '__main__': - llvm_project.ensure_up_to_date() - unittest.main() diff --git a/llvm_tools/update_chromeos_llvm_hash.py b/llvm_tools/update_chromeos_llvm_hash.py index e28fe690..ab83321a 100755 --- a/llvm_tools/update_chromeos_llvm_hash.py +++ b/llvm_tools/update_chromeos_llvm_hash.py @@ -4,32 +4,30 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -"""Updates the LLVM hash and uprevs the build of the specified - -packages. +"""Updates the LLVM hash and uprevs the build of the specified packages. For each package, a temporary repo is created and the changes are uploaded for review. """ from __future__ import print_function -from datetime import datetime -from enum import Enum import argparse +import datetime +import enum import os import re import subprocess -from failure_modes import FailureModes import chroot +import failure_modes import get_llvm_hash import git import llvm_patch_management # Specify which LLVM hash to update -class LLVMVariant(Enum): +class LLVMVariant(enum.Enum): """Represent the LLVM hash in an ebuild file to update.""" current = 'LLVM_HASH' @@ -41,6 +39,21 @@ class LLVMVariant(Enum): verbose = False +def defaultCrosRoot(): + """Get default location of chroot_path. + + The logic assumes that the cros_root is ~/chromiumos, unless llvm_tools is + inside of a CrOS checkout, in which case that checkout should be used. + + Returns: + The best guess location for the cros checkout. + """ + llvm_tools_path = os.path.realpath(os.path.dirname(__file__)) + if llvm_tools_path.endswith('src/third_party/toolchain-utils/llvm_tools'): + return os.path.join(llvm_tools_path, '../../../../') + return '~/chromiumos' + + def GetCommandLineArgs(): """Parses the command line for the optional command line arguments. @@ -51,10 +64,6 @@ def GetCommandLineArgs(): and the LLVM version to use when retrieving the LLVM hash. """ - # Default path to the chroot if a path is not specified. - cros_root = os.path.expanduser('~') - cros_root = os.path.join(cros_root, 'chromiumos') - # Create parser and add optional command-line arguments. parser = argparse.ArgumentParser( description="Updates the build's hash for llvm-next.") @@ -62,7 +71,7 @@ def GetCommandLineArgs(): # Add argument for a specific chroot path. parser.add_argument( '--chroot_path', - default=cros_root, + default=defaultCrosRoot(), help='the path to the chroot (default: %(default)s)') # Add argument for specific builds to uprev and update their llvm-next hash. @@ -71,8 +80,8 @@ def GetCommandLineArgs(): default=['sys-devel/llvm'], required=False, nargs='+', - help='the ebuilds to update their hash for llvm-next ' \ - '(default: %(default)s)') + help='the ebuilds to update their hash for llvm-next ' + '(default: %(default)s)') # Add argument for whether to display command contents to `stdout`. parser.add_argument( @@ -91,7 +100,7 @@ def GetCommandLineArgs(): # Add argument for the LLVM version to use. parser.add_argument( '--llvm_version', - type=get_llvm_hash.is_svn_option, + type=get_llvm_hash.IsSvnOption, required=True, help='which git hash to use. Either a svn revision, or one ' 'of %s' % sorted(get_llvm_hash.KNOWN_HASH_SOURCES)) @@ -99,12 +108,15 @@ def GetCommandLineArgs(): # Add argument for the mode of the patch management when handling patches. parser.add_argument( '--failure_mode', - default=FailureModes.FAIL.value, - choices=[FailureModes.FAIL.value, FailureModes.CONTINUE.value, - FailureModes.DISABLE_PATCHES.value, - FailureModes.REMOVE_PATCHES.value], - help='the mode of the patch manager when handling failed patches ' \ - '(default: %(default)s)') + default=failure_modes.FailureModes.FAIL.value, + choices=[ + failure_modes.FailureModes.FAIL.value, + failure_modes.FailureModes.CONTINUE.value, + failure_modes.FailureModes.DISABLE_PATCHES.value, + failure_modes.FailureModes.REMOVE_PATCHES.value + ], + help='the mode of the patch manager when handling failed patches ' + '(default: %(default)s)') # Add argument for the patch metadata file. parser.add_argument( @@ -199,7 +211,6 @@ def UpdateEbuildLLVMHash(ebuild_path, llvm_variant, git_hash, svn_version): for cur_line in ReplaceLLVMHash(ebuild_file, llvm_variant, git_hash, svn_version): temp_file.write(cur_line) - os.rename(temp_ebuild_file, ebuild_path) # Get the path to the parent directory. @@ -217,6 +228,9 @@ def ReplaceLLVMHash(ebuild_lines, llvm_variant, git_hash, svn_version): llvm_variant: The LLVM hash to update. git_hash: The new git hash. svn_version: The SVN-style revision number of git_hash. + + Yields: + lines of the modified ebuild file """ is_updated = False llvm_regex = re.compile('^' + re.escape(llvm_variant.value) + @@ -266,7 +280,7 @@ def UprevEbuildSymlink(symlink): os.path.dirname(symlink), 'mv', symlink, new_symlink]) -def UprevEbuildToVersion(symlink, svn_version): +def UprevEbuildToVersion(symlink, svn_version, git_hash): """Uprevs the ebuild's revision number. Increases the revision number by 1 and stages the change in @@ -275,31 +289,34 @@ def UprevEbuildToVersion(symlink, svn_version): Args: symlink: The absolute path of an ebuild symlink. svn_version: The SVN-style revision number of git_hash. + git_hash: The new git hash. Raises: ValueError: Failed to uprev the ebuild or failed to stage the changes. + AssertionError: No llvm version provided for an LLVM uprev """ if not os.path.islink(symlink): raise ValueError('Invalid symlink provided: %s' % symlink) ebuild = os.path.realpath(symlink) + llvm_major_version = get_llvm_hash.GetLLVMMajorVersion(git_hash) # llvm package = os.path.basename(os.path.dirname(symlink)) if not package: raise ValueError('Tried to uprev an unknown package') - # llvm if package == 'llvm': new_ebuild, is_changed = re.subn( - r'pre([0-9]+)_p([0-9]+)', - 'pre%s_p%s' % (svn_version, \ - datetime.today().strftime('%Y%m%d')), + r'(\d+)\.(\d+)_pre([0-9]+)_p([0-9]+)', + '%s.\\2_pre%s_p%s' % (llvm_major_version, svn_version, + datetime.datetime.today().strftime('%Y%m%d')), ebuild, count=1) # any other package else: new_ebuild, is_changed = re.subn( - r'pre([0-9]+)', 'pre%s' % svn_version, ebuild, count=1) + r'(\d+)\.(\d+)_pre([0-9]+)', + '%s.\\2_pre%s' % (llvm_major_version, svn_version), ebuild, count=1) if not is_changed: # failed to increment the revision number raise ValueError('Failed to uprev the ebuild.') @@ -374,8 +391,8 @@ def StagePatchMetadataFileForCommit(patch_metadata_file_path): """ if not os.path.isfile(patch_metadata_file_path): - raise ValueError( - 'Invalid patch metadata file provided: %s' % patch_metadata_file_path) + raise ValueError('Invalid patch metadata file provided: %s' % + patch_metadata_file_path) # Cmd to stage the patch metadata file for commit. subprocess.check_output([ @@ -393,15 +410,18 @@ def StagePackagesPatchResultsForCommit(package_info_dict, commit_messages): package (key). commit_messages: The commit message that has the updated ebuilds and upreving information. + + Returns: + commit_messages with new additions """ # For each package, check if any patches for that package have # changed, if so, add which patches have changed to the commit # message. for package_name, patch_info_dict in package_info_dict.items(): - if patch_info_dict['disabled_patches'] or \ - patch_info_dict['removed_patches'] or \ - patch_info_dict['modified_metadata']: + if (patch_info_dict['disabled_patches'] or + patch_info_dict['removed_patches'] or + patch_info_dict['modified_metadata']): cur_package_header = '\nFor the package %s:' % package_name commit_messages.append(cur_package_header) @@ -450,9 +470,9 @@ def UpdatePackages(packages, llvm_variant, git_hash, svn_version, chroot_path, the patches and its metadata. mode: The mode of the patch manager when handling an applicable patch that failed to apply. - Ex: 'FailureModes.FAIL' + Ex. 'FailureModes.FAIL' git_hash_source: The source of which git hash to use based off of. - Ex: 'google3', 'tot', or <version> such as 365123 + Ex. 'google3', 'tot', or <version> such as 365123 extra_commit_msg: extra test to append to the commit message. Returns: @@ -478,11 +498,11 @@ def UpdatePackages(packages, llvm_variant, git_hash, svn_version, chroot_path, if llvm_variant == LLVMVariant.next: commit_message_header = 'llvm-next' if git_hash_source in get_llvm_hash.KNOWN_HASH_SOURCES: - commit_message_header += ( - '/%s: upgrade to %s (r%d)' % (git_hash_source, git_hash, svn_version)) + commit_message_header += ('/%s: upgrade to %s (r%d)' % + (git_hash_source, git_hash, svn_version)) else: - commit_message_header += ( - ': upgrade to %s (r%d)' % (git_hash, svn_version)) + commit_message_header += (': upgrade to %s (r%d)' % + (git_hash, svn_version)) commit_messages = [ commit_message_header + '\n', @@ -504,7 +524,7 @@ def UpdatePackages(packages, llvm_variant, git_hash, svn_version, chroot_path, UpdateEbuildLLVMHash(ebuild_path, llvm_variant, git_hash, svn_version) if llvm_variant == LLVMVariant.current: - UprevEbuildToVersion(symlink_path, svn_version) + UprevEbuildToVersion(symlink_path, svn_version, git_hash) else: UprevEbuildSymlink(symlink_path) @@ -514,6 +534,8 @@ def UpdatePackages(packages, llvm_variant, git_hash, svn_version, chroot_path, packages.append('%s/%s' % (parent_dir_name, cur_dir_name)) commit_messages.append('%s/%s' % (parent_dir_name, cur_dir_name)) + EnsurePackageMaskContains(chroot_path, git_hash) + # Handle the patches for each package. package_info_dict = llvm_patch_management.UpdatePackagesPatchMetadataFile( chroot_path, svn_version, patch_metadata_file, packages, mode) @@ -533,6 +555,31 @@ def UpdatePackages(packages, llvm_variant, git_hash, svn_version, chroot_path, return change_list +def EnsurePackageMaskContains(chroot_path, git_hash): + """Adds the major version of llvm to package.mask if it's not already present. + + Args: + chroot_path: The absolute path to the chroot. + git_hash: The new git hash. + + Raises: + FileExistsError: package.mask not found in ../../chromiumos-overlay + """ + + llvm_major_version = get_llvm_hash.GetLLVMMajorVersion(git_hash) + + overlay_dir = os.path.join(chroot_path, 'src/third_party/chromiumos-overlay') + mask_path = os.path.join(overlay_dir, + 'profiles/targets/chromeos/package.mask') + with open(mask_path, 'r+') as mask_file: + mask_contents = mask_file.read() + expected_line = '=sys-devel/llvm-%s.0_pre*\n' % llvm_major_version + if expected_line not in mask_contents: + mask_file.write(expected_line) + + subprocess.check_output(['git', '-C', overlay_dir, 'add', mask_path]) + + def main(): """Updates the LLVM next hash for each package. @@ -560,7 +607,7 @@ def main(): svn_version, args_output.chroot_path, args_output.patch_metadata_file, - FailureModes(args_output.failure_mode), + failure_modes.FailureModes(args_output.failure_mode), git_hash_source, extra_commit_msg=None) diff --git a/llvm_tools/update_chromeos_llvm_hash_unittest.py b/llvm_tools/update_chromeos_llvm_hash_unittest.py index 205feb0c..adb20598 100755 --- a/llvm_tools/update_chromeos_llvm_hash_unittest.py +++ b/llvm_tools/update_chromeos_llvm_hash_unittest.py @@ -8,8 +8,8 @@ from __future__ import print_function -from collections import namedtuple -from datetime import datetime +import collections +import datetime import os import re import subprocess @@ -18,6 +18,7 @@ import unittest.mock as mock import chroot import failure_modes +import get_llvm_hash import git import llvm_patch_management import test_helpers @@ -30,6 +31,19 @@ import update_chromeos_llvm_hash class UpdateLLVMHashTest(unittest.TestCase): """Test class for updating LLVM hashes of packages.""" + @mock.patch.object(os.path, 'realpath') + def testDefaultCrosRootFromCrOSCheckout(self, mock_llvm_tools): + llvm_tools_path = '/path/to/cros/src/third_party/toolchain-utils/llvm_tools' + mock_llvm_tools.return_value = llvm_tools_path + self.assertEqual(update_chromeos_llvm_hash.defaultCrosRoot(), + '%s/../../../../' % llvm_tools_path) + + @mock.patch.object(os.path, 'realpath') + def testDefaultCrosRootFromOutsideCrOSCheckout(self, mock_llvm_tools): + mock_llvm_tools.return_value = '~/toolchain-utils/llvm_tools' + self.assertEqual(update_chromeos_llvm_hash.defaultCrosRoot(), + '~/chromiumos') + # Simulate behavior of 'os.path.isfile()' when the ebuild path to a package # does not exist. @mock.patch.object(os.path, 'isfile', return_value=False) @@ -67,11 +81,11 @@ class UpdateLLVMHashTest(unittest.TestCase): # Verify the exception is raised when the ebuild file does not have # 'LLVM_HASH'. with self.assertRaises(ValueError) as err: - update_chromeos_llvm_hash.UpdateEbuildLLVMHash( - ebuild_file, llvm_variant, git_hash, svn_version) + update_chromeos_llvm_hash.UpdateEbuildLLVMHash(ebuild_file, + llvm_variant, git_hash, + svn_version) - self.assertEqual( - str(err.exception), ('Failed to update %s.', 'LLVM_HASH')) + self.assertEqual(str(err.exception), 'Failed to update LLVM_HASH') llvm_variant = update_chromeos_llvm_hash.LLVMVariant.next @@ -95,11 +109,11 @@ class UpdateLLVMHashTest(unittest.TestCase): # Verify the exception is raised when the ebuild file does not have # 'LLVM_NEXT_HASH'. with self.assertRaises(ValueError) as err: - update_chromeos_llvm_hash.UpdateEbuildLLVMHash( - ebuild_file, llvm_variant, git_hash, svn_version) + update_chromeos_llvm_hash.UpdateEbuildLLVMHash(ebuild_file, + llvm_variant, git_hash, + svn_version) - self.assertEqual( - str(err.exception), ('Failed to update %s.', 'LLVM_NEXT_HASH')) + self.assertEqual(str(err.exception), 'Failed to update LLVM_NEXT_HASH') self.assertEqual(mock_isfile.call_count, 2) @@ -179,19 +193,25 @@ class UpdateLLVMHashTest(unittest.TestCase): mock_stage_commit_command.assert_called_once() + @mock.patch.object(get_llvm_hash, 'GetLLVMMajorVersion') @mock.patch.object(os.path, 'islink', return_value=False) - def testFailedToUprevEbuildToVersionForInvalidSymlink(self, mock_islink): + def testFailedToUprevEbuildToVersionForInvalidSymlink(self, mock_islink, + mock_llvm_version): symlink_path = '/path/to/chroot/package/package.ebuild' svn_version = 1000 + git_hash = 'badf00d' + mock_llvm_version.return_value = '1234' # Verify the exception is raised when a invalid symbolic link is passed in. with self.assertRaises(ValueError) as err: - update_chromeos_llvm_hash.UprevEbuildToVersion(symlink_path, svn_version) + update_chromeos_llvm_hash.UprevEbuildToVersion(symlink_path, svn_version, + git_hash) self.assertEqual( str(err.exception), 'Invalid symlink provided: %s' % symlink_path) mock_islink.assert_called_once() + mock_llvm_version.assert_not_called() @mock.patch.object(os.path, 'islink', return_value=False) def testFailedToUprevEbuildSymlinkForInvalidSymlink(self, mock_islink): @@ -206,22 +226,28 @@ class UpdateLLVMHashTest(unittest.TestCase): mock_islink.assert_called_once() + @mock.patch.object(get_llvm_hash, 'GetLLVMMajorVersion') # Simulate 'os.path.islink' when a symbolic link is passed in. @mock.patch.object(os.path, 'islink', return_value=True) # Simulate 'os.path.realpath' when a symbolic link is passed in. @mock.patch.object(os.path, 'realpath', return_value=True) - def testFailedToUprevEbuildToVersion(self, mock_realpath, mock_islink): + def testFailedToUprevEbuildToVersion(self, mock_realpath, mock_islink, + mock_llvm_version): symlink_path = '/path/to/chroot/llvm/llvm_pre123_p.ebuild' mock_realpath.return_value = '/abs/path/to/llvm/llvm_pre123_p.ebuild' + git_hash = 'badf00d' + mock_llvm_version.return_value = '1234' svn_version = 1000 # Verify the exception is raised when the symlink does not match the # expected pattern with self.assertRaises(ValueError) as err: - update_chromeos_llvm_hash.UprevEbuildToVersion(symlink_path, svn_version) + update_chromeos_llvm_hash.UprevEbuildToVersion(symlink_path, svn_version, + git_hash) self.assertEqual(str(err.exception), 'Failed to uprev the ebuild.') + mock_llvm_version.assert_called_once_with(git_hash) mock_islink.assert_called_once_with(symlink_path) # Simulate 'os.path.islink' when a symbolic link is passed in. @@ -238,17 +264,24 @@ class UpdateLLVMHashTest(unittest.TestCase): mock_islink.assert_called_once_with(symlink_path) + @mock.patch.object(get_llvm_hash, 'GetLLVMMajorVersion') @mock.patch.object(os.path, 'islink', return_value=True) @mock.patch.object(os.path, 'realpath') @mock.patch.object(subprocess, 'check_output', return_value=None) def testSuccessfullyUprevEbuildToVersionLLVM(self, mock_command_output, - mock_realpath, mock_islink): - symlink = '/path/to/llvm/llvm_pre3_p2-r10.ebuild' - ebuild = '/abs/path/to/llvm/llvm_pre3_p2.ebuild' + mock_realpath, mock_islink, + mock_llvm_version): + symlink = '/path/to/llvm/llvm-12.0_pre3_p2-r10.ebuild' + ebuild = '/abs/path/to/llvm/llvm-12.0_pre3_p2.ebuild' mock_realpath.return_value = ebuild + git_hash = 'badf00d' + mock_llvm_version.return_value = '1234' svn_version = 1000 - update_chromeos_llvm_hash.UprevEbuildToVersion(symlink, svn_version) + update_chromeos_llvm_hash.UprevEbuildToVersion(symlink, svn_version, + git_hash) + + mock_llvm_version.assert_called_once_with(git_hash) mock_islink.assert_called() @@ -258,12 +291,8 @@ class UpdateLLVMHashTest(unittest.TestCase): # Verify commands symlink_dir = os.path.dirname(symlink) - new_ebuild, _is_changed = re.subn( - r'pre([0-9]+)_p([0-9]+)', - 'pre%s_p%s' % (svn_version, \ - datetime.today().strftime('%Y%m%d')), - ebuild, - count=1) + timestamp = datetime.datetime.today().strftime('%Y%m%d') + new_ebuild = '/abs/path/to/llvm/llvm-1234.0_pre1000_p%s.ebuild' % timestamp new_symlink = new_ebuild[:-len('.ebuild')] + '-r1.ebuild' expected_cmd = ['git', '-C', symlink_dir, 'mv', ebuild, new_ebuild] @@ -282,28 +311,34 @@ class UpdateLLVMHashTest(unittest.TestCase): self.assertEqual(mock_command_output.call_args_list[3], mock.call(expected_cmd)) + @mock.patch.object(get_llvm_hash, 'GetLLVMMajorVersion') @mock.patch.object(os.path, 'islink', return_value=True) @mock.patch.object(os.path, 'realpath') @mock.patch.object(subprocess, 'check_output', return_value=None) def testSuccessfullyUprevEbuildToVersionNonLLVM(self, mock_command_output, - mock_realpath, mock_islink): - symlink = '/path/to/compiler-rt/compiler-rt_pre3_p2-r10.ebuild' - ebuild = '/abs/path/to/compiler-rt/compiler-rt_pre3_p2.ebuild' + mock_realpath, mock_islink, + mock_llvm_version): + symlink = '/abs/path/to/compiler-rt/compiler-rt-12.0_pre314159265-r4.ebuild' + ebuild = '/abs/path/to/compiler-rt/compiler-rt-12.0_pre314159265.ebuild' mock_realpath.return_value = ebuild + mock_llvm_version.return_value = '1234' svn_version = 1000 + git_hash = '5678' - update_chromeos_llvm_hash.UprevEbuildToVersion(symlink, svn_version) + update_chromeos_llvm_hash.UprevEbuildToVersion(symlink, svn_version, + git_hash) mock_islink.assert_called() mock_realpath.assert_called_once_with(symlink) + mock_llvm_version.assert_called_once_with(git_hash) + mock_command_output.assert_called() # Verify commands symlink_dir = os.path.dirname(symlink) - new_ebuild, _is_changed = re.subn( - r'pre([0-9]+)', 'pre%s' % svn_version, ebuild, count=1) + new_ebuild = '/abs/path/to/compiler-rt/compiler-rt-1234.0_pre1000.ebuild' new_symlink = new_ebuild[:-len('.ebuild')] + '-r1.ebuild' expected_cmd = ['git', '-C', symlink_dir, 'mv', ebuild, new_ebuild] @@ -350,7 +385,8 @@ class UpdateLLVMHashTest(unittest.TestCase): # Test function to simulate 'ConvertChrootPathsToAbsolutePaths' when a # symlink does not start with the prefix '/mnt/host/source'. - def BadPrefixChrootPath(_chroot_path, _chroot_file_paths): + def BadPrefixChrootPath(*args): + assert len(args) == 2 raise ValueError('Invalid prefix for the chroot path: ' '%s' % package_chroot_path) @@ -458,8 +494,7 @@ class UpdateLLVMHashTest(unittest.TestCase): @mock.patch.object(os.path, 'isfile', return_value=True) @mock.patch.object(subprocess, 'check_output', return_value=None) - def testSuccessfullyStagedPatchMetadataFileForCommit(self, mock_run_cmd, - _mock_isfile): + def testSuccessfullyStagedPatchMetadataFileForCommit(self, mock_run_cmd, _): patch_metadata_path = '/abs/path/to/filesdir/PATCHES.json' @@ -549,6 +584,7 @@ class UpdateLLVMHashTest(unittest.TestCase): self.assertEqual(mock_stage_patches_for_commit.call_count, 2) + @mock.patch.object(get_llvm_hash, 'GetLLVMMajorVersion') @mock.patch.object(update_chromeos_llvm_hash, 'CreatePathDictionaryFromPackages') @mock.patch.object(git, 'CreateBranch') @@ -560,20 +596,19 @@ class UpdateLLVMHashTest(unittest.TestCase): def testExceptionRaisedWhenUpdatingPackages( self, mock_realpath, mock_delete_repo, mock_upload_changes, mock_uprev_symlink, mock_update_llvm_next, mock_create_repo, - mock_create_path_dict): - - abs_path_to_package = '/some/path/to/chroot/src/path/to/package.ebuild' - - symlink_path_to_package = \ - '/some/path/to/chroot/src/path/to/package-r1.ebuild' + mock_create_path_dict, mock_llvm_major_version): path_to_package_dir = '/some/path/to/chroot/src/path/to' + abs_path_to_package = os.path.join(path_to_package_dir, 'package.ebuild') + symlink_path_to_package = os.path.join(path_to_package_dir, + 'package-r1.ebuild') + + mock_llvm_major_version.return_value = '1234' # Test function to simulate 'CreateBranch' when successfully created the # branch on a valid repo path. - def SuccessfullyCreateBranchForChanges(_repo_path, branch): + def SuccessfullyCreateBranchForChanges(_, branch): self.assertEqual(branch, 'update-LLVM_NEXT_HASH-a123testhash4') - return # Test function to simulate 'UpdateEbuildLLVMHash' when successfully # updated the ebuild's 'LLVM_NEXT_HASH'. @@ -581,23 +616,23 @@ class UpdateLLVMHashTest(unittest.TestCase): self.assertEqual(ebuild_path, abs_path_to_package) self.assertEqual(git_hash, 'a123testhash4') self.assertEqual(svn_version, 1000) - return # Test function to simulate 'UprevEbuildSymlink' when the symlink to the # ebuild does not have a revision number. - def FailedToUprevEbuildSymlink(_symlink_path): + def FailedToUprevEbuildSymlink(_): # Raises a 'ValueError' exception because the symlink did not have have a # revision number. raise ValueError('Failed to uprev the ebuild.') # Test function to fail on 'UploadChanges' if the function gets called # when an exception is raised. - def ShouldNotExecuteUploadChanges(_repo_path, _git_hash, _commit_messages): + def ShouldNotExecuteUploadChanges(*args): # Test function should not be called (i.e. execution should resume in the # 'finally' block) because 'UprevEbuildSymlink' raised an # exception. - assert False, 'Failed to go to "finally" block ' \ - 'after the exception was raised.' + assert len(args) == 3 + assert False, ('Failed to go to "finally" block ' + 'after the exception was raised.') test_package_path_dict = {symlink_path_to_package: abs_path_to_package} @@ -627,10 +662,12 @@ class UpdateLLVMHashTest(unittest.TestCase): # Verify exception is raised when an exception is thrown within # the 'try' block by UprevEbuildSymlink function. with self.assertRaises(ValueError) as err: - update_chromeos_llvm_hash.UpdatePackages( - packages_to_update, llvm_variant, git_hash, svn_version, chroot_path, - patch_metadata_file, failure_modes.FailureModes.FAIL, git_hash_source, - extra_commit_msg) + update_chromeos_llvm_hash.UpdatePackages(packages_to_update, llvm_variant, + git_hash, svn_version, + chroot_path, patch_metadata_file, + failure_modes.FailureModes.FAIL, + git_hash_source, + extra_commit_msg) self.assertEqual(str(err.exception), 'Failed to uprev the ebuild.') @@ -639,8 +676,9 @@ class UpdateLLVMHashTest(unittest.TestCase): mock_create_repo.assert_called_once_with(path_to_package_dir, branch) - mock_update_llvm_next.assert_called_once_with( - abs_path_to_package, llvm_variant, git_hash, svn_version) + mock_update_llvm_next.assert_called_once_with(abs_path_to_package, + llvm_variant, git_hash, + svn_version) mock_uprev_symlink.assert_called_once_with(symlink_path_to_package) @@ -648,6 +686,8 @@ class UpdateLLVMHashTest(unittest.TestCase): mock_delete_repo.assert_called_once_with(path_to_package_dir, branch) + @mock.patch.object(update_chromeos_llvm_hash, 'EnsurePackageMaskContains') + @mock.patch.object(get_llvm_hash, 'GetLLVMMajorVersion') @mock.patch.object(update_chromeos_llvm_hash, 'CreatePathDictionaryFromPackages') @mock.patch.object(git, 'CreateBranch') @@ -658,23 +698,22 @@ class UpdateLLVMHashTest(unittest.TestCase): @mock.patch.object(llvm_patch_management, 'UpdatePackagesPatchMetadataFile') @mock.patch.object(update_chromeos_llvm_hash, 'StagePatchMetadataFileForCommit') - def testSuccessfullyUpdatedPackages( - self, mock_stage_patch_file, mock_update_package_metadata_file, - mock_delete_repo, mock_upload_changes, mock_uprev_symlink, - mock_update_llvm_next, mock_create_repo, mock_create_path_dict): - - abs_path_to_package = '/some/path/to/chroot/src/path/to/package.ebuild' - - symlink_path_to_package = \ - '/some/path/to/chroot/src/path/to/package-r1.ebuild' + def testSuccessfullyUpdatedPackages(self, mock_stage_patch_file, + mock_update_package_metadata_file, + mock_delete_repo, mock_upload_changes, + mock_uprev_symlink, mock_update_llvm_next, + mock_create_repo, mock_create_path_dict, + mock_llvm_version, mock_mask_contains): path_to_package_dir = '/some/path/to/chroot/src/path/to' + abs_path_to_package = os.path.join(path_to_package_dir, 'package.ebuild') + symlink_path_to_package = os.path.join(path_to_package_dir, + 'package-r1.ebuild') # Test function to simulate 'CreateBranch' when successfully created the # branch for the changes to be made to the ebuild files. - def SuccessfullyCreateBranchForChanges(_repo_path, branch): + def SuccessfullyCreateBranchForChanges(_, branch): self.assertEqual(branch, 'update-LLVM_NEXT_HASH-a123testhash5') - return # Test function to simulate 'UploadChanges' after a successfull update of # 'LLVM_NEXT_HASH" of the ebuild file. @@ -683,7 +722,6 @@ class UpdateLLVMHashTest(unittest.TestCase): '/some/path/to/chroot/src/path/to/package.ebuild') self.assertEqual(git_hash, 'a123testhash5') self.assertEqual(svn_version, 1000) - return # Test function to simulate 'UprevEbuildSymlink' when successfully # incremented the revision number by 1. @@ -691,8 +729,6 @@ class UpdateLLVMHashTest(unittest.TestCase): self.assertEqual(symlink_path, '/some/path/to/chroot/src/path/to/package-r1.ebuild') - return - # Test function to simulate 'UpdatePackagesPatchMetadataFile()' when the # patch results contains a disabled patch in 'disable_patches' mode. def RetrievedPatchResults(chroot_path, svn_version, patch_metadata_file, @@ -704,7 +740,7 @@ class UpdateLLVMHashTest(unittest.TestCase): self.assertListEqual(packages, ['path/to']) self.assertEqual(mode, failure_modes.FailureModes.DISABLE_PATCHES) - PatchInfo = namedtuple('PatchInfo', [ + PatchInfo = collections.namedtuple('PatchInfo', [ 'applied_patches', 'failed_patches', 'non_applicable_patches', 'disabled_patches', 'removed_patches', 'modified_metadata' ]) @@ -727,9 +763,9 @@ class UpdateLLVMHashTest(unittest.TestCase): # Test function to simulate 'UploadChanges()' when successfully created a # commit for the changes made to the packages and their patches and # retrieved the change list of the commit. - def SuccessfullyUploadedChanges(_repo_path, _branch, _commit_messages): + def SuccessfullyUploadedChanges(*args): + assert len(args) == 3 commit_url = 'https://some_name/path/to/commit/+/12345' - return git.CommitContents(url=commit_url, cl_number=12345) test_package_path_dict = {symlink_path_to_package: abs_path_to_package} @@ -746,6 +782,8 @@ class UpdateLLVMHashTest(unittest.TestCase): mock_uprev_symlink.side_effect = SuccessfullyUprevedEbuildSymlink mock_update_package_metadata_file.side_effect = RetrievedPatchResults mock_upload_changes.side_effect = SuccessfullyUploadedChanges + mock_llvm_version.return_value = '1234' + mock_mask_contains.reurn_value = None packages_to_update = ['test-packages/package1'] llvm_variant = update_chromeos_llvm_hash.LLVMVariant.next @@ -772,11 +810,14 @@ class UpdateLLVMHashTest(unittest.TestCase): mock_create_repo.assert_called_once_with(path_to_package_dir, branch) - mock_update_llvm_next.assert_called_once_with( - abs_path_to_package, llvm_variant, git_hash, svn_version) + mock_update_llvm_next.assert_called_once_with(abs_path_to_package, + llvm_variant, git_hash, + svn_version) mock_uprev_symlink.assert_called_once_with(symlink_path_to_package) + mock_mask_contains.assert_called_once_with(chroot_path, git_hash) + expected_commit_messages = [ 'llvm-next/tot: upgrade to a123testhash5 (r1000)\n', 'The following packages have been updated:', 'path/to', @@ -796,6 +837,48 @@ class UpdateLLVMHashTest(unittest.TestCase): mock_delete_repo.assert_called_once_with(path_to_package_dir, branch) + @mock.patch.object(subprocess, 'check_output', return_value=None) + @mock.patch.object(get_llvm_hash, 'GetLLVMMajorVersion') + def testEnsurePackageMaskContainsExisting(self, mock_llvm_version, + mock_git_add): + chroot_path = 'absolute/path/to/chroot' + git_hash = 'badf00d' + mock_llvm_version.return_value = '1234' + with mock.patch( + 'update_chromeos_llvm_hash.open', + mock.mock_open(read_data='\n=sys-devel/llvm-1234.0_pre*\n'), + create=True) as mock_file: + update_chromeos_llvm_hash.EnsurePackageMaskContains(chroot_path, git_hash) + handle = mock_file() + handle.write.assert_not_called() + mock_llvm_version.assert_called_once_with(git_hash) + + overlay_dir = 'absolute/path/to/chroot/src/third_party/chromiumos-overlay' + mask_path = overlay_dir + '/profiles/targets/chromeos/package.mask' + mock_git_add.assert_called_once_with( + ['git', '-C', overlay_dir, 'add', mask_path]) + + @mock.patch.object(subprocess, 'check_output', return_value=None) + @mock.patch.object(get_llvm_hash, 'GetLLVMMajorVersion') + def testEnsurePackageMaskContainsNotExisting(self, mock_llvm_version, + mock_git_add): + chroot_path = 'absolute/path/to/chroot' + git_hash = 'badf00d' + mock_llvm_version.return_value = '1234' + with mock.patch( + 'update_chromeos_llvm_hash.open', + mock.mock_open(read_data='nothing relevant'), + create=True) as mock_file: + update_chromeos_llvm_hash.EnsurePackageMaskContains(chroot_path, git_hash) + handle = mock_file() + handle.write.assert_called_once_with('=sys-devel/llvm-1234.0_pre*\n') + mock_llvm_version.assert_called_once_with(git_hash) + + overlay_dir = 'absolute/path/to/chroot/src/third_party/chromiumos-overlay' + mask_path = overlay_dir + '/profiles/targets/chromeos/package.mask' + mock_git_add.assert_called_once_with( + ['git', '-C', overlay_dir, 'add', mask_path]) + if __name__ == '__main__': unittest.main() diff --git a/llvm_tools/update_packages_and_run_tests.py b/llvm_tools/update_packages_and_run_tests.py index 66819ebc..dd01253e 100755 --- a/llvm_tools/update_packages_and_run_tests.py +++ b/llvm_tools/update_packages_and_run_tests.py @@ -73,7 +73,7 @@ def GetCommandLineArgs(): # Add argument for the LLVM version to use. parser.add_argument( '--llvm_version', - type=get_llvm_hash.is_svn_option, + type=get_llvm_hash.IsSvnOption, required=True, help='which git hash of LLVM to find ' '{google3, ToT, <svn_version>} ' diff --git a/run_tests_for.py b/run_tests_for.py index 19f81722..807a218d 100755 --- a/run_tests_for.py +++ b/run_tests_for.py @@ -74,21 +74,19 @@ def _gather_python_tests_in(rel_subdir, toolchain_utils): """Returns all files that appear to be Python tests in a given directory.""" subdir = os.path.join(toolchain_utils, rel_subdir) test_files = ( - os.path.join(subdir, file_name) - for file_name in os.listdir(subdir) + os.path.join(subdir, file_name) for file_name in os.listdir(subdir) if file_name.endswith('_test.py') or file_name.endswith('_unittest.py')) return _filter_python_tests(test_files, toolchain_utils) def _run_test(test_spec): """Runs a test.""" - p = subprocess.Popen( - test_spec.command, - cwd=test_spec.directory, - stdin=open('/dev/null'), - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - encoding='utf-8') + p = subprocess.Popen(test_spec.command, + cwd=test_spec.directory, + stdin=open('/dev/null'), + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + encoding='utf-8') stdout, _ = p.communicate() exit_code = p.wait() return exit_code, stdout @@ -115,12 +113,23 @@ def _autodetect_python_tests_for(test_file, toolchain_utils): if not test_file.endswith('.py'): return [] - test_suffixes = ['_test.py', '_unittest.py'] - if any(test_file.endswith(x) for x in test_suffixes): + test_prefixes = ('test_', 'unittest_') + test_suffixes = ('_test.py', '_unittest.py') + + test_file_name = os.path.basename(test_file) + test_file_is_a_test = ( + any(test_file_name.startswith(x) for x in test_prefixes) + or any(test_file_name.endswith(x) for x in test_suffixes)) + + if test_file_is_a_test: test_files = [test_file] else: - base = test_file[:-3] - candidates = (base + x for x in test_suffixes) + test_file_no_suffix = test_file[:-3] + candidates = [test_file_no_suffix + x for x in test_suffixes] + + dir_name = os.path.dirname(test_file) + candidates += (os.path.join(dir_name, x + test_file_name) + for x in test_prefixes) test_files = (x for x in candidates if os.path.exists(x)) return _filter_python_tests(test_files, toolchain_utils) @@ -128,7 +137,7 @@ def _autodetect_python_tests_for(test_file, toolchain_utils): def _run_test_scripts(all_tests, show_successful_output=False): """Runs a list of TestSpecs. Returns whether all of them succeeded.""" with contextlib.closing(multiprocessing.pool.ThreadPool()) as pool: - results = [pool.apply_async(_run_test, (test,)) for test in all_tests] + results = [pool.apply_async(_run_test, (test, )) for test in all_tests] failures = [] for i, (test, future) in enumerate(zip(all_tests, results)): @@ -234,16 +243,15 @@ def main(argv): default_toolchain_utils = os.path.abspath(os.path.dirname(__file__)) parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument( - '--show_all_output', - action='store_true', - help='show stdout of successful tests') - parser.add_argument( - '--toolchain_utils', - default=default_toolchain_utils, - help='directory of toolchain-utils. Often auto-detected') - parser.add_argument( - 'file', nargs='*', help='a file that we should run tests for') + parser.add_argument('--show_all_output', + action='store_true', + help='show stdout of successful tests') + parser.add_argument('--toolchain_utils', + default=default_toolchain_utils, + help='directory of toolchain-utils. Often auto-detected') + parser.add_argument('file', + nargs='*', + help='a file that we should run tests for') args = parser.parse_args(argv) modified_files = [os.path.abspath(f) for f in args.file] diff --git a/rust_tools/rust_uprev.py b/rust_tools/rust_uprev.py index 6d112420..16fb0da8 100755 --- a/rust_tools/rust_uprev.py +++ b/rust_tools/rust_uprev.py @@ -33,8 +33,6 @@ the CL to chromium code review. See `--help` for all available options. """ -# pylint: disable=cros-logging-import - import argparse import pathlib import json @@ -53,8 +51,8 @@ RUST_PATH = Path( def get_command_output(command: List[str], *args, **kwargs) -> str: - return subprocess.check_output( - command, encoding='utf-8', *args, **kwargs).strip() + return subprocess.check_output(command, encoding='utf-8', *args, + **kwargs).strip() class RustVersion(NamedTuple): @@ -76,8 +74,8 @@ class RustVersion(NamedTuple): r'\.ebuild$') m = input_re.match(ebuild_name) assert m, f'failed to parse {ebuild_name!r}' - return RustVersion( - int(m.group('major')), int(m.group('minor')), int(m.group('patch'))) + return RustVersion(int(m.group('major')), int(m.group('minor')), + int(m.group('patch'))) @staticmethod def parse(x: str) -> 'RustVersion': @@ -88,8 +86,8 @@ class RustVersion(NamedTuple): r'(?:.ebuild)?$') m = input_re.match(x) assert m, f'failed to parse {x!r}' - return RustVersion( - int(m.group('major')), int(m.group('minor')), int(m.group('patch'))) + return RustVersion(int(m.group('major')), int(m.group('minor')), + int(m.group('patch'))) def find_ebuild_path(directory: Path, @@ -103,9 +101,9 @@ def find_ebuild_path(directory: Path, 1.3.4 can match rust-1.3.4.ebuild but also rust-1.3.4-r6.ebuild. """ if version: - pattern = '%s-%s*.ebuild' % (name, version) + pattern = f'{name}-{version}*.ebuild' else: - pattern = '%s-*.ebuild' % (name,) + pattern = f'{name}-*.ebuild' matches = list(Path(directory).glob(pattern)) assert len(matches) == 1, matches return matches[0] @@ -121,7 +119,8 @@ def get_rust_bootstrap_version(): def parse_commandline_args() -> argparse.Namespace: parser = argparse.ArgumentParser( - description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument( '--state_file', required=True, @@ -251,7 +250,7 @@ def parse_commandline_args() -> argparse.Namespace: def prepare_uprev(rust_version: RustVersion, template: Optional[RustVersion] - ) -> Optional[Tuple[RustVersion, str, RustVersion]]: + ) -> Optional[Tuple[RustVersion, str, RustVersion]]: if template is None: ebuild_path = get_command_output(['equery', 'w', 'rust']) ebuild_name = os.path.basename(ebuild_path) @@ -309,22 +308,22 @@ def update_bootstrap_ebuild(new_bootstrap_version: RustVersion) -> None: new_ebuild = old_ebuild.parent.joinpath( f'rust-bootstrap-{new_bootstrap_version}.ebuild') old_text = old_ebuild.read_text(encoding='utf-8') - new_text, changes = re.subn( - r'(RUSTC_FULL_BOOTSTRAP_SEQUENCE=\([^)]*)', - f'\\1\t{old_version}\n', - old_text, - flags=re.MULTILINE) - assert changes == 1, 'Failed to update RUSTC_FULL_BOOTSTRAP_SEQUENCE' + new_text, changes = re.subn(r'(RUSTC_RAW_FULL_BOOTSTRAP_SEQUENCE=\([^)]*)', + f'\\1\t{old_version}\n', + old_text, + flags=re.MULTILINE) + assert changes == 1, 'Failed to update RUSTC_RAW_FULL_BOOTSTRAP_SEQUENCE' new_ebuild.write_text(new_text, encoding='utf-8') -def update_ebuild(ebuild_file: str, new_bootstrap_version: RustVersion) -> None: +def update_ebuild(ebuild_file: str, + new_bootstrap_version: RustVersion) -> None: contents = open(ebuild_file, encoding='utf-8').read() - contents, subs = re.subn( - r'^BOOTSTRAP_VERSION=.*$', - 'BOOTSTRAP_VERSION="%s"' % (new_bootstrap_version,), - contents, - flags=re.MULTILINE) + contents, subs = re.subn(r'^BOOTSTRAP_VERSION=.*$', + 'BOOTSTRAP_VERSION="%s"' % + (new_bootstrap_version, ), + contents, + flags=re.MULTILINE) if not subs: raise RuntimeError('BOOTSTRAP_VERSION not found in rust ebuild') open(ebuild_file, 'w', encoding='utf-8').write(contents) @@ -397,8 +396,8 @@ def update_rust_packages(rust_version: RustVersion, add: bool) -> None: def update_virtual_rust(template_version: RustVersion, new_version: RustVersion) -> None: - template_ebuild = find_ebuild_path( - RUST_PATH.joinpath('../../virtual/rust'), 'rust', template_version) + template_ebuild = find_ebuild_path(RUST_PATH.joinpath('../../virtual/rust'), + 'rust', template_version) virtual_rust_dir = template_ebuild.parent new_name = f'rust-{new_version}.ebuild' new_ebuild = virtual_rust_dir.joinpath(new_name) @@ -433,8 +432,8 @@ def perform_step(state_file: pathlib.Path, return val -def prepare_uprev_from_json(obj: Any - ) -> Optional[Tuple[RustVersion, str, RustVersion]]: +def prepare_uprev_from_json( + obj: Any) -> Optional[Tuple[RustVersion, str, RustVersion]]: if not obj: return None version, ebuild_path, bootstrap_version = obj @@ -444,7 +443,7 @@ def prepare_uprev_from_json(obj: Any def create_rust_uprev(rust_version: RustVersion, maybe_template_version: Optional[RustVersion], skip_compile: bool, run_step: Callable[[], T]) -> None: - template_version, template_ebuild, old_bootstrap_version = run_step( + template_version, template_ebuild, _old_bootstrap_version = run_step( 'prepare uprev', lambda: prepare_uprev(rust_version, maybe_template_version), result_from_json=prepare_uprev_from_json, @@ -452,9 +451,6 @@ def create_rust_uprev(rust_version: RustVersion, if template_ebuild is None: return - run_step( - 'copy bootstrap patches', lambda: copy_patches(rust_bootstrap_path( - ), old_bootstrap_version, template_version)) run_step('update bootstrap ebuild', lambda: update_bootstrap_ebuild( template_version)) run_step( @@ -469,8 +465,9 @@ def create_rust_uprev(rust_version: RustVersion, run_step('update manifest to add new version', lambda: update_manifest( Path(ebuild_file))) if not skip_compile: - run_step('emerge rust', lambda: subprocess.check_call( - ['sudo', 'emerge', 'dev-lang/rust'])) + run_step( + 'emerge rust', lambda: subprocess.check_call( + ['sudo', 'emerge', 'dev-lang/rust'])) run_step('insert version into rust packages', lambda: update_rust_packages( rust_version, add=True)) run_step('upgrade virtual/rust', lambda: update_virtual_rust( @@ -479,8 +476,7 @@ def create_rust_uprev(rust_version: RustVersion, def find_rust_versions_in_chroot() -> List[Tuple[RustVersion, str]]: return [(RustVersion.parse_from_ebuild(x), os.path.join(RUST_PATH, x)) - for x in os.listdir(RUST_PATH) - if x.endswith('.ebuild')] + for x in os.listdir(RUST_PATH) if x.endswith('.ebuild')] def find_oldest_rust_version_in_chroot() -> Tuple[RustVersion, str]: @@ -509,9 +505,6 @@ def remove_files(filename: str, path: str) -> None: def remove_rust_bootstrap_version(version: RustVersion, run_step: Callable[[], T]) -> None: prefix = f'rust-bootstrap-{version}' - run_step( - 'remove old bootstrap patches', lambda: remove_files( - f'files/{prefix}-*.patch', rust_bootstrap_path())) run_step('remove old bootstrap ebuild', lambda: remove_files( f'{prefix}*.ebuild', rust_bootstrap_path())) ebuild_file = get_command_output(['equery', 'w', 'rust-bootstrap']) @@ -521,7 +514,6 @@ def remove_rust_bootstrap_version(version: RustVersion, def remove_rust_uprev(rust_version: Optional[RustVersion], run_step: Callable[[], T]) -> None: - def find_desired_rust_version(): if rust_version: return rust_version, find_ebuild_for_rust_version(rust_version) @@ -549,8 +541,8 @@ def remove_rust_uprev(rust_version: Optional[RustVersion], def remove_virtual_rust(delete_version: RustVersion) -> None: - ebuild = find_ebuild_path( - RUST_PATH.joinpath('../../virtual/rust'), 'rust', delete_version) + ebuild = find_ebuild_path(RUST_PATH.joinpath('../../virtual/rust'), 'rust', + delete_version) subprocess.check_call(['git', 'rm', str(ebuild.name)], cwd=ebuild.parent) diff --git a/rust_tools/rust_uprev_test.py b/rust_tools/rust_uprev_test.py index b35f1db7..7b3c9e66 100755 --- a/rust_tools/rust_uprev_test.py +++ b/rust_tools/rust_uprev_test.py @@ -6,7 +6,6 @@ """Tests for rust_uprev.py""" -# pylint: disable=cros-logging-import import os import shutil import subprocess @@ -84,10 +83,9 @@ class PrepareUprevTest(unittest.TestCase): self.version_old = rust_uprev.RustVersion(1, 2, 3) self.version_new = rust_uprev.RustVersion(1, 3, 5) - @mock.patch.object( - rust_uprev, - 'find_ebuild_for_rust_version', - return_value='/path/to/ebuild') + @mock.patch.object(rust_uprev, + 'find_ebuild_for_rust_version', + return_value='/path/to/ebuild') @mock.patch.object(rust_uprev, 'find_ebuild_path') @mock.patch.object(rust_uprev, 'get_command_output') def test_success_with_template(self, mock_command, mock_find_ebuild, @@ -97,20 +95,19 @@ class PrepareUprevTest(unittest.TestCase): f'rust-bootstrap-{self.bootstrap_version}.ebuild') mock_find_ebuild.return_value = bootstrap_ebuild_path expected = (self.version_old, '/path/to/ebuild', self.bootstrap_version) - actual = rust_uprev.prepare_uprev( - rust_version=self.version_new, template=self.version_old) + actual = rust_uprev.prepare_uprev(rust_version=self.version_new, + template=self.version_old) self.assertEqual(expected, actual) mock_command.assert_not_called() - @mock.patch.object( - rust_uprev, - 'find_ebuild_for_rust_version', - return_value='/path/to/ebuild') + @mock.patch.object(rust_uprev, + 'find_ebuild_for_rust_version', + return_value='/path/to/ebuild') @mock.patch.object(rust_uprev, 'get_command_output') def test_return_none_with_template_larger_than_input(self, mock_command, _mock_find_ebuild): - ret = rust_uprev.prepare_uprev( - rust_version=self.version_old, template=self.version_new) + ret = rust_uprev.prepare_uprev(rust_version=self.version_old, + template=self.version_new) self.assertIsNone(ret) mock_command.assert_not_called() @@ -126,8 +123,8 @@ class PrepareUprevTest(unittest.TestCase): f'rust-bootstrap-{self.bootstrap_version}.ebuild') mock_find_ebuild.return_value = bootstrap_ebuild_path expected = (self.version_old, rust_ebuild_path, self.bootstrap_version) - actual = rust_uprev.prepare_uprev( - rust_version=self.version_new, template=None) + actual = rust_uprev.prepare_uprev(rust_version=self.version_new, + template=None) self.assertEqual(expected, actual) mock_command.assert_called_once_with(['equery', 'w', 'rust']) mock_exists.assert_not_called() @@ -137,7 +134,8 @@ class PrepareUprevTest(unittest.TestCase): def test_return_none_with_ebuild_larger_than_input(self, mock_command, mock_exists): mock_command.return_value = f'/path/to/rust/rust-{self.version_new}.ebuild' - ret = rust_uprev.prepare_uprev(rust_version=self.version_old, template=None) + ret = rust_uprev.prepare_uprev(rust_version=self.version_old, + template=None) self.assertIsNone(ret) mock_exists.assert_not_called() @@ -193,32 +191,28 @@ class UpdateManifestTest(unittest.TestCase): f'RESTRICT="{after}"') def test_add_mirror_in_ebuild(self): - self._run_test_flip_mirror( - before='variable1 variable2', - after='variable1 variable2 mirror', - add=True, - expect_write=True) + self._run_test_flip_mirror(before='variable1 variable2', + after='variable1 variable2 mirror', + add=True, + expect_write=True) def test_remove_mirror_in_ebuild(self): - self._run_test_flip_mirror( - before='variable1 variable2 mirror', - after='variable1 variable2', - add=False, - expect_write=True) + self._run_test_flip_mirror(before='variable1 variable2 mirror', + after='variable1 variable2', + add=False, + expect_write=True) def test_add_mirror_when_exists(self): - self._run_test_flip_mirror( - before='variable1 variable2 mirror', - after='variable1 variable2 mirror', - add=True, - expect_write=False) + self._run_test_flip_mirror(before='variable1 variable2 mirror', + after='variable1 variable2 mirror', + add=True, + expect_write=False) def test_remove_mirror_when_not_exists(self): - self._run_test_flip_mirror( - before='variable1 variable2', - after='variable1 variable2', - add=False, - expect_write=False) + self._run_test_flip_mirror(before='variable1 variable2', + after='variable1 variable2', + add=False, + expect_write=False) @mock.patch.object(rust_uprev, 'flip_mirror_in_ebuild') @mock.patch.object(rust_uprev, 'ebuild_actions') @@ -237,18 +231,17 @@ class UpdateBootstrapEbuildTest(unittest.TestCase): def test_update_bootstrap_ebuild(self): # The update should do two things: # 1. Create a copy of rust-bootstrap's ebuild with the new version number. - # 2. Add the old PV to RUSTC_FULL_BOOTSTRAP_SEQUENCE. + # 2. Add the old PV to RUSTC_RAW_FULL_BOOTSTRAP_SEQUENCE. with tempfile.TemporaryDirectory() as tmpdir_str, \ mock.patch.object(rust_uprev, 'find_ebuild_path') as mock_find_ebuild: tmpdir = Path(tmpdir_str) bootstrapdir = Path.joinpath(tmpdir, 'rust-bootstrap') bootstrapdir.mkdir() old_ebuild = bootstrapdir.joinpath('rust-bootstrap-1.45.2.ebuild') - old_ebuild.write_text( - encoding='utf-8', - data=""" + old_ebuild.write_text(encoding='utf-8', + data=""" some text -RUSTC_FULL_BOOTSTRAP_SEQUENCE=( +RUSTC_RAW_FULL_BOOTSTRAP_SEQUENCE=( \t1.43.1 \t1.44.1 ) @@ -262,7 +255,7 @@ some more text self.assertEqual( text, """ some text -RUSTC_FULL_BOOTSTRAP_SEQUENCE=( +RUSTC_RAW_FULL_BOOTSTRAP_SEQUENCE=( \t1.43.1 \t1.44.1 \t1.45.2 @@ -377,7 +370,8 @@ class RustUprevOtherStagesTests(unittest.TestCase): @mock.patch.object(rust_uprev, 'find_ebuild_path') @mock.patch.object(subprocess, 'check_call') def test_remove_virtual_rust(self, mock_call, mock_find_ebuild): - ebuild_path = Path(f'/some/dir/virtual/rust/rust-{self.old_version}.ebuild') + ebuild_path = Path( + f'/some/dir/virtual/rust/rust-{self.old_version}.ebuild') mock_find_ebuild.return_value = Path(ebuild_path) rust_uprev.remove_virtual_rust(self.old_version) mock_call.assert_called_once_with( diff --git a/seccomp_tools/mass_seccomp_editor/mass_seccomp_editor.py b/seccomp_tools/mass_seccomp_editor/mass_seccomp_editor.py new file mode 100755 index 00000000..d8dd7626 --- /dev/null +++ b/seccomp_tools/mass_seccomp_editor/mass_seccomp_editor.py @@ -0,0 +1,273 @@ +#!/usr/bin/env python3 + +# Copyright 2021 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. + +"""Script to make mass, CrOS-wide seccomp changes.""" + +import argparse +import re +import subprocess +import sys +import shutil +from typing import Any, Iterable, Optional +from dataclasses import dataclass, field + +# Pre-compiled regexes. +AMD64_RE = re.compile(r'.*(amd|x86_)64.*\.policy') +X86_RE = re.compile(r'.*x86.*\.policy') +AARCH64_RE = re.compile(r'.*a(arch|rm)64.*\.policy') +ARM_RE = re.compile(r'.*arm(v7)?.*\.policy') + + +@dataclass(frozen=True) +class Policies: + """Dataclass to hold lists of policies which match certain types.""" + arm: list[str] = field(default_factory=list) + x86_64: list[str] = field(default_factory=list) + x86: list[str] = field(default_factory=list) + arm64: list[str] = field(default_factory=list) + none: list[str] = field(default_factory=list) + + def to_dict(self) -> dict[str, list[str]]: + """Convert this class to a dictionary.""" + return {**self.__dict__} + + +def main(): + """Run the program from cmd line""" + args = parse_args() + if all(x is None for x in [args.all, args.b64, args.b32, args.none]): + print('Require at least one of {--all, --b64, --b32, --none}', + file=sys.stderr) + sys.exit(1) + matches, success = find_potential_policy_files(args.packages) + + separated = Policies() + + for m in matches: + if AMD64_RE.match(m): + separated.x86_64.append(m) + continue + if X86_RE.match(m): + separated.x86.append(m) + continue + if AARCH64_RE.match(m): + separated.arm64.append(m) + continue + if ARM_RE.match(m): + separated.arm.append(m) + continue + separated.none.append(m) + + syscall_lookup_table = _make_syscall_lookup_table(args) + + for (type_, val) in separated.to_dict().items(): + for fp in val: + syscalls = syscall_lookup_table[type_] + missing = check_missing_syscalls(syscalls, fp) + if missing is None: + print(f'E ({type_}) {fp}') + elif len(missing) == 0: + print(f'_ ({type_}) {fp}') + else: + missing_str = ','.join(missing) + print(f'M ({type_}) {fp} :: {missing_str}') + + if not args.edit: + sys.exit(0 if success else 2) + + for (type_, val) in separated.to_dict().items(): + for fp in val: + syscalls = syscall_lookup_table[type_] + if args.force: + _confirm_add(fp, syscalls, args.yes) + continue + missing = check_missing_syscalls(syscalls, fp) + if missing is None or len(missing) == 0: + print(f'Already good for {fp} ({type_})') + else: + _confirm_add(fp, missing, args.yes) + + sys.exit(0 if success else 2) + + +def _make_syscall_lookup_table(args: Any) -> dict[str, list[str]]: + """Make lookup table, segmented by all/b32/b64/none policies. + + Args: + args: Direct output from parse_args. + + Returns: + dict of syscalls we want to search for in each policy file, + where the key is the policy file arch, and the value is + a list of syscalls as strings. + """ + syscall_lookup_table = Policies().to_dict() + if args.all: + split_syscalls = [x.strip() for x in args.all.split(',')] + for v in syscall_lookup_table.values(): + v.extend(split_syscalls) + if args.b32: + split_syscalls = [x.strip() for x in args.b32.split(',')] + syscall_lookup_table['x86'].extend(split_syscalls) + syscall_lookup_table['arm'].extend(split_syscalls) + if args.b64: + split_syscalls = [x.strip() for x in args.b64.split(',')] + syscall_lookup_table['x86_64'].extend(split_syscalls) + syscall_lookup_table['arm64'].extend(split_syscalls) + if args.none: + split_syscalls = [x.strip() for x in args.none.split(',')] + syscall_lookup_table['none'].extend(split_syscalls) + return syscall_lookup_table + + +def _confirm_add(fp: str, syscalls: Iterable[str], noninteractive=None): + """Interactive confirmation check you wish to add a syscall. + + Args: + fp: filepath of the file to edit. + syscalls: list-like of syscalls to add to append to the files. + noninteractive: Just add the syscalls without asking. + """ + if noninteractive: + _update_seccomp(fp, list(syscalls)) + return + syscalls_str = ','.join(syscalls) + user_input = input(f'Add {syscalls_str} for {fp}? [y/N]> ') + if user_input.lower().startswith('y'): + _update_seccomp(fp, list(syscalls)) + print('Edited!') + else: + print(f'Skipping {fp}') + + +def check_missing_syscalls(syscalls: list[str], fp: str) -> Optional[set[str]]: + """Return which specified syscalls are missing in the given file.""" + missing_syscalls = set(syscalls) + with open(fp) as f: + try: + lines = f.readlines() + for syscall in syscalls: + for line in lines: + if re.match(syscall + r':\s*1', line): + missing_syscalls.remove(syscall) + except UnicodeDecodeError: + return None + return missing_syscalls + + +def _update_seccomp(fp: str, missing_syscalls: list[str]): + """Update the seccomp of the file based on the seccomp change type.""" + with open(fp, 'a') as f: + sorted_syscalls = sorted(missing_syscalls) + for to_write in sorted_syscalls: + f.write(to_write + ': 1\n') + + +def _search_cmd(query: str, use_fd=True) -> list[str]: + if use_fd and shutil.which('fdfind') is not None: + return [ + 'fdfind', + '-t', + 'f', + '--full-path', + f'^.*{query}.*\\.policy$', + ] + return [ + 'find', + '.', + '-regex', + f'^.*{query}.*\\.policy$', + '-type', + 'f', + ] + + +def find_potential_policy_files(packages: list[str]) -> tuple[list[str], bool]: + """Find potentially related policy files to the given packages. + + Returns: + (policy_files, successful): A list of policy file paths, and a boolean + indicating whether all queries were successful in finding at least + one related policy file. + """ + all_queries_succeeded = True + matches = [] + for p in packages: + # It's quite common that hyphens are translated to underscores + # and similarly common that underscores are translated to hyphens. + # We make them agnostic here. + hyphen_agnostic = re.sub(r'[-_]', '[-_]', p) + cmd = subprocess.run( + _search_cmd(hyphen_agnostic), + stdout=subprocess.PIPE, + check=True, + ) + new_matches = [a for a in cmd.stdout.decode('utf-8').split('\n') if a] + if not new_matches: + print(f'WARNING: No matches found for {p}', file=sys.stderr) + all_queries_succeeded = False + else: + matches.extend(new_matches) + return matches, all_queries_succeeded + + +def parse_args() -> Any: + """Handle command line arguments.""" + parser = argparse.ArgumentParser( + description='Check for missing syscalls in' + ' seccomp policy files, or make' + ' mass seccomp changes.\n\n' + 'The format of this output follows the template:\n' + ' status (arch) local/policy/filepath :: syscall,syscall,syscall\n' + 'Where the status can be "_" for present, "M" for missing,' + ' or "E" for Error\n\n' + 'Example:\n' + ' mass_seccomp_editor.py --all fstatfs --b32 fstatfs64' + ' modemmanager\n\n' + 'Exit Codes:\n' + " '0' for successfully found specific policy files\n" + " '1' for python-related error.\n" + " '2' for no matched policy files for a given query.", + formatter_class=argparse.RawTextHelpFormatter, + ) + parser.add_argument('packages', nargs='+') + parser.add_argument( + '--all', + type=str, + metavar='syscalls', + help='comma separated syscalls to check in all policy files') + parser.add_argument( + '--b64', + type=str, + metavar='syscalls', + help='Comma separated syscalls to check in 64bit architectures') + parser.add_argument( + '--b32', + type=str, + metavar='syscalls', + help='Comma separated syscalls to check in 32bit architectures') + parser.add_argument( + '--none', + type=str, + metavar='syscalls', + help='Comma separated syscalls to check in unknown architectures') + parser.add_argument('--edit', + action='store_true', + help='Make changes to the listed files,' + ' rather than just printing out what is missing') + parser.add_argument('-y', + '--yes', + action='store_true', + help='Say "Y" to all interactive checks') + parser.add_argument('--force', + action='store_true', + help='Edit all files, regardless of missing status.' + ' Does nothing without --edit.') + return parser.parse_args() + + +if __name__ == '__main__': + main() diff --git a/seccomp_tools/mass_seccomp_editor/test_mass_seccomp_editor.py b/seccomp_tools/mass_seccomp_editor/test_mass_seccomp_editor.py new file mode 100755 index 00000000..3e7aa4cc --- /dev/null +++ b/seccomp_tools/mass_seccomp_editor/test_mass_seccomp_editor.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 + +# Copyright 2021 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. + +"""Unit tests for mass_seccomp_editor.py""" + +import unittest +from unittest import mock + +import mass_seccomp_editor + +BASE_SECCOMP_CONTENTS = """ +fstat: 1 +poll: 1 +foobar: 1 +""" + +TEST_FP = 'foo' + + +class TestMassSeccompEditor(unittest.TestCase): + """Test the mass_seccomp_editor.""" + + def test_check_missing_sycalls(self): + """Test we can find missing syscalls.""" + with mock.patch('builtins.open', + mock.mock_open(read_data=BASE_SECCOMP_CONTENTS)): + out = mass_seccomp_editor.check_missing_syscalls( + ['fstat', 'dup', 'fizzbuzz'], TEST_FP) + self.assertEqual(out, set(['dup', 'fizzbuzz'])) + + +if __name__ == '__main__': + unittest.main() diff --git a/upstream_workon/upstream_workon.bash b/upstream_workon/upstream_workon.bash new file mode 100755 index 00000000..f066bbe3 --- /dev/null +++ b/upstream_workon/upstream_workon.bash @@ -0,0 +1,273 @@ +#!/bin/bash -eu +# +# Copyright 2021 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. + +USAGE=\ +'Usage: upstream-workon [-h] + init <PACKAGE> <DEV_WORK_DIR> + link <PACKAGE> <DEV_WORK_DIR> + build <PACKAGE> + install <PACKAGE> + clean <PACKAGE> + help' + +set +e +read -r -d '' HELP <<'EOF' +Usage: upstream-workon [-h] + init <PACKAGE> <DEV_WORK_DIR> + link <PACKAGE> <DEV_WORK_DIR> + build <PACKAGE> + install <PACKAGE> + clean <PACKAGE> + help + +Flags: + -h --help Print this help message + +Commands: + init Initialize in a developer workdir using a new tree + link Link an existing developer source dir to portage workdir + build Build the package using ebuild ... compile + install Install the package using ebuild ... install + clean Clean up your work without deleting the developer workdir + help Print this help message + +Examples: + + # Start work + mkdir "$HOME/llvm" + upstream-workon init sys-devel/llvm "$HOME/llvm" + + # Link your existing work + upstream-workon link sys-devel/llvm "$HOME/llvm" + + # Compile your work + upstream-workon build sys-devel/llvm + + # Install your changes to the chroot + upstream-workon install sys-devel/llvm + + # Clean up + upstream-workon clean sys-devel/llvm + +EOF +set -e + +incorrect_number_of_arguments() { + echo 'ERROR: Please use correct command syntax' >&2 + echo "${USAGE}" >&2 + exit 1 +} + +print_experimental_warning() { + echo >&2 + echo '!!! WARNING: This tool is EXPERIMENTAL--please do not rely on the API.' >&2 + echo '!!! WARNING: Please recommend new features for Version 2, but this' >&2 + echo '!!! WARNING: implementation will not be actively developed and' >&2 + echo '!!! WARNING: exists only to receive feedback and minor fixes.' >&2 +} + +# ------------------------------------------------------------------------------ +# Actual logic +# ------------------------------------------------------------------------------ + +# We probably can just pass through "USE", but I think this gives a bit more +# flexibility in the future. +USE_FLAGS="${USE:-}" + +if [[ -n "${USE_FLAGS}" ]]; then + echo 'USE flags set to:' + echo " ${USE_FLAGS}" +fi + +init() { + local package="$1" + local desired_src_loc="$2" + local ebuild_loc + ebuild_loc="$(resolve_ebuild_for "${package}")" + + local ebuild_name + ebuild_name="$(basename "${ebuild_loc}" | sed 's/\.ebuild$//g')" + local package_name + # SC2001 complains about not using variable replace syntax. + # However, variable remove syntax is not sufficiently expansive + # to do this replacement easily. + # shellcheck disable=2001 + package_name="$(sed 's/-r[0-9]\+$//g' <<< "${ebuild_name}")" + local ebuild_category + ebuild_category="$(basename "$(dirname "$(dirname "${ebuild_loc}")")")" + local portage_dir='/var/tmp/portage' + + local work_dir="${portage_dir}/${ebuild_category}/${ebuild_name}/work/${package_name}" + + ebuild "${ebuild_loc}" clean + USE="${USE_FLAGS}" ebuild "${ebuild_loc}" unpack + + # May need to init git if it doesn't already exist. + # Probably could just use git -C instead of the pushd/popd. + pushd "${work_dir}" >& /dev/null + if [[ ! -d '.git' ]]; then + git init + git add . + git commit -m 'Initial commit' + fi + popd >& /dev/null + + USE="${USE_FLAGS}" ebuild "${ebuild_loc}" configure + + cp -r -p "${work_dir}/." "${desired_src_loc}" + local backup_dir="${work_dir}.bk" + mv "${work_dir}" "${backup_dir}" + ln -s "$(realpath "${desired_src_loc}")" "${work_dir}" + + pushd "${desired_src_loc}" >& /dev/null + + git add . + git commit -m 'Ebuild configure commit' + popd >& /dev/null + + echo + echo '----------------------------------------' + echo 'Successfully created local mirror!' + echo "Developer work directory set up at: ${desired_src_loc}" + echo 'To build the package, run:' + echo " upstream-workon build ${package}" + echo 'To install the package, run:' + echo " sudo upstream-workon install ${package}" + echo "To clean up (without deleting ${desired_src_loc}), run:" + echo " upstream-workon clean ${package}" + echo "WARNING: Moving original workdir to ${backup_dir}, consider deleting" >&2 +} + +clean() { + local package="$1" + echo 'WARNING: You may need to run this with sudo' >&2 + local ebuild_loc + ebuild_loc="$(resolve_ebuild_for "${package}")" + + ebuild "${ebuild_loc}" clean + + echo '----------------------------------------' + echo "Successfully cleaned up ${package}!" +} + + +compile() { + local package="$1" + local ebuild_loc + ebuild_loc="$(resolve_ebuild_for "${package}")" + + USE="${USE_FLAGS}" ebuild "${ebuild_loc}" compile + + echo '----------------------------------------' + echo "Successfully compiled ${package}!" +} + + +install_src() { + local package="$1" + echo 'WARNING: You may need to run this with sudo' >&2 + local ebuild_loc + ebuild_loc="$(resolve_ebuild_for "${package}")" + + USE="${USE_FLAGS}" ebuild "${ebuild_loc}" install + + echo '----------------------------------------' + echo "Successfully installed ${package}!" +} + +link_src() { + local package="$1" + local desired_src_loc="$2" + local ebuild_loc + ebuild_loc="$(resolve_ebuild_for "${package}")" + + local ebuild_name + ebuild_name="$(basename "${ebuild_loc}" | sed 's/\.ebuild$//g')" + local package_name + # shellcheck disable=2001 + package_name="$(sed 's/-r[0-9]\+$//g' <<< "${ebuild_name}")" + local ebuild_category + ebuild_category="$(basename "$(dirname "$(dirname "${ebuild_loc}")")")" + local portage_dir='/var/tmp/portage' + + local work_dir="${portage_dir}/${ebuild_category}/${ebuild_name}/work/${package_name}" + + local backup_dir="${work_dir}.bk" + + # Because of some annoying permissions issues, we have to configure directly in + # /var/tmp/portage/... + # We then copy over those changes into our local source directory. + # To make sure the proper deletions get done, we delete everything except + # your local git directory. + + ebuild "${ebuild_loc}" clean + USE="${USE_FLAGS}" ebuild "${ebuild_loc}" configure + # TODO(ajordanr): This is a rough edge, and I don't want users to delete their + # home directory without knowing what they are doing. So we're copying + # everything instead. + # TODO(ajordanr): This will ignore git submodules, which I don't want. + mv "${desired_src_loc}" "${desired_src_loc}.bk" + mkdir "${desired_src_loc}" + cp -rP "${desired_src_loc}.bk/.git" "${desired_src_loc}/.git" + rsync -a --exclude=".git" "${work_dir}"/* "${desired_src_loc}" + rsync -a --exclude=".git" "${work_dir}"/.[^.]* "${desired_src_loc}" + mv "${work_dir}" "${backup_dir}" + ln -s "$(realpath "${desired_src_loc}")" "${work_dir}" + + echo '----------------------------------------' + echo 'Successfully linked to local mirror!' + echo "Developer work directory linked to: ${desired_src_loc}" + echo "WARNING: Moving original workdir to ${backup_dir}, consider deleting" >&2 + echo "WARNING: Moving original dev dir to ${desired_src_loc}.bk, consider deleting" >&2 +} + +resolve_ebuild_for() { + equery w "$1" +} + +CMD="${1:-}" + +case "${CMD}" in + -h|--help|help) + shift + echo "${HELP}" + print_experimental_warning + exit 1 + ;; + init) + shift + [[ -z "${1:-}" || -z "${2:-}" ]] && incorrect_number_of_arguments + print_experimental_warning + init "$1" "$2" + ;; + link) + shift + [[ -z "${1:-}" || -z "${2:-}" ]] && incorrect_number_of_arguments + print_experimental_warning + link_src "$1" "$2" + ;; + build) + shift + [[ -z "${1:-}" ]] && incorrect_number_of_arguments + print_experimental_warning + compile "$1" + ;; + clean) + shift + [[ -z "${1:-}" ]] && incorrect_number_of_arguments + print_experimental_warning + clean "$1" + ;; + install) + shift + [[ -z "${1:-}" ]] && incorrect_number_of_arguments + print_experimental_warning + install_src "$1" + ;; + *) + incorrect_number_of_arguments + ;; +esac |