| # 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 hook asserts that there are "File format not recognized"-type errors |
| # in the build logs, that may result from using objcopy/strip binaries |
| # built for a different architecture. |
| # This is done to avoid shipping non-stripped binaries. |
| |
| # Main entry point for this hook. |
| check_debug_symbol_strip_errors() { |
| # Set arguments to "${T}/build.log" if none given. |
| [[ $# -eq 0 ]] && set -- "${T}/build.log" |
| |
| unstripped_files=$(grep -e "Unable to recognise the format of the input" \ |
| -e "File format not recognized" "$@") |
| if [[ -n "${unstripped_files}" ]]; then |
| die "objcopy/strip failed to recognize the format of some files: |
| ${unstripped_files} |
| Is your toolchain using the right architecture?" |
| fi |
| } |
| |
| check_debug_symbol_strip_errors "$@" |
| : # guarantee successful exit |
| |
| # vim:ft=sh |