diff options
Diffstat (limited to 'build-aux')
-rwxr-xr-x | build-aux/embed-sources.h.gen | 4 | ||||
-rwxr-xr-x | build-aux/lint-bin | 15 | ||||
-rwxr-xr-x | build-aux/lint-generic | 2 | ||||
-rwxr-xr-x | build-aux/lint-h | 6 | ||||
-rwxr-xr-x | build-aux/linux-errno.txt.gen | 17 | ||||
-rwxr-xr-x | build-aux/valgrind | 15 |
6 files changed, 29 insertions, 30 deletions
diff --git a/build-aux/embed-sources.h.gen b/build-aux/embed-sources.h.gen index 0329496..ee9eb42 100755 --- a/build-aux/embed-sources.h.gen +++ b/build-aux/embed-sources.h.gen @@ -6,5 +6,5 @@ nm --format=posix "$@" | sed -n -E \ - -e 's/(.*_(end|start)) [DR] .*/extern char \1[];/p' \ - -e 's/(.*_size) A .*/extern size_t \1;/p' + -e 's/(.*_(end|start)) [DR] .*/extern char \1[];/p' \ + -e 's/(.*_size) A .*/extern size_t \1;/p' diff --git a/build-aux/lint-bin b/build-aux/lint-bin index 78ed19f..91f1612 100755 --- a/build-aux/lint-bin +++ b/build-aux/lint-bin @@ -62,7 +62,7 @@ lint_globals() { cd "$rel_base" total=0 while read -r symbol addr size source; do - if (( addr == 0 )); then + if ((addr == 0)); then continue fi case "$source" in @@ -103,8 +103,9 @@ lint_stack() { fi done < <( comm -3 \ - <(sed -En 's/^included: (.*:)?//p' "${in_elffile%.elf}_stack.c" | sort -u) \ - <(readelf_funcs "$in_elffile" | sed -E -e 's/\.part\.[0-9]*$//' -e 's/^__(.*)_veneer$/\1/' | sort -u)) + <(sed -En 's/^included: (.*:)?//p' "${in_elffile%.elf}_stack.c" | sort -u) \ + <(readelf_funcs "$in_elffile" | sed -E -e 's/\.part\.[0-9]*$//' -e 's/^__(.*)_veneer$/\1/' | sort -u) + ) } lint_func_blocklist() { @@ -118,8 +119,8 @@ lint_func_blocklist() { while read -r func; do err "$in_elffile" "Contains blocklisted function: ${func}" done < <(readelf --syms --wide -- "$in_elffile" | - awk '$4 == "FUNC" { print $8 }' | - grep -Fx "${blocklist[@]/#/-e}") + awk '$4 == "FUNC" { print $8 }' | + grep -Fx "${blocklist[@]/#/-e}") } main() { @@ -130,8 +131,8 @@ main() { { echo 'Global variables:' lint_globals "${elf}.map" | sed 's/^/ /' - } > "${elf%.elf}.lint.globals" - (lint_stack "$elf") &> "${elf%.elf}.lint.stack" + } >"${elf%.elf}.lint.globals" + (lint_stack "$elf") &>"${elf%.elf}.lint.stack" lint_func_blocklist "$elf" done diff --git a/build-aux/lint-generic b/build-aux/lint-generic index 290988c..70e814a 100755 --- a/build-aux/lint-generic +++ b/build-aux/lint-generic @@ -25,7 +25,7 @@ for filename in "$@"; do if [ -x "$filename" ] && [ -z "$shebang" ]; then err "$filename" 'is executable but does not have a shebang' elif [ -n "$shebang" ] && ! [ -x "$filename" ]; then - err "$filename" 'has a shebang but is executable' + err "$filename" 'has a shebang but is not executable' fi if ! grep -E -q 'Copyright \(C\) 202[4-9]((-|, )202[5-9])* Luke T. Shumaker' "$filename"; then diff --git a/build-aux/lint-h b/build-aux/lint-h index 26ac13d..7459032 100755 --- a/build-aux/lint-h +++ b/build-aux/lint-h @@ -18,9 +18,9 @@ for filename in "$@"; do guard=${dscname//'/'/'_'} guard=${guard//'.'/'_'} guard="_${guard^^}_" - if ! { grep -Fxq "#ifndef ${guard}" "$filename" && - grep -Fxq "#define ${guard}" "$filename" && - grep -Fxq "#endif /* ${guard} */" "$filename"; }; then + if ! { grep -Fxq "#ifndef ${guard}" "$filename" && + grep -Fxq "#define ${guard}" "$filename" && + grep -Fxq "#endif /* ${guard} */" "$filename"; }; then err "$filename" "does not have ${guard} guard" fi done diff --git a/build-aux/linux-errno.txt.gen b/build-aux/linux-errno.txt.gen deleted file mode 100755 index f94178f..0000000 --- a/build-aux/linux-errno.txt.gen +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -# build-aux/linux-errno.txt.gen - Generate a listing of Linux kernel errnos -# -# Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> -# SPDX-License-Identifier: AGPL-3.0-or-later - -set -e -linux_git=${1:?} -outfile=${2:?} - -( - cd "${linux_git}" - echo "# ${outfile} - Generated from $0 and linux.git $(git describe). DO NOT EDIT!" - git ls-files include/uapi/ | grep errno | - xargs sed -nE 's,#\s*define\s+(E[A-Z0-9]+)\s+([0-9]+)\s+/\* (.*) \*/,\2 \1 \3,p' | - sort --numeric-sort -) >"${outfile}" diff --git a/build-aux/valgrind b/build-aux/valgrind new file mode 100755 index 0000000..728faca --- /dev/null +++ b/build-aux/valgrind @@ -0,0 +1,15 @@ +#!/bin/env bash +# build-aux/valgrind - Wrapper around valgrind to keep flags consistent +# +# Copyright (C) 2025 Luke T. Shumaker <lukeshu@lukeshu.com> +# SPDX-License-Identifier: AGPL-3.0-or-later + +exec \ + valgrind \ + --error-exitcode=2 \ + --leak-check=full \ + --show-leak-kinds=all \ + --errors-for-leak-kinds=all \ + --show-error-list=all \ + -- \ + "$@" |