diff options
Diffstat (limited to 'build-aux/lint-bin')
-rwxr-xr-x | build-aux/lint-bin | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/build-aux/lint-bin b/build-aux/lint-bin index 0b955de..78ed19f 100755 --- a/build-aux/lint-bin +++ b/build-aux/lint-bin @@ -25,7 +25,7 @@ RESET=$(tput sgr0) err() { printf "${RED}%s${RESET}: %s\n" "$1" "$2" >&2 - #r=1 + r=1 } # Input is `ld --print-map` format. @@ -104,7 +104,22 @@ lint_stack() { done < <( comm -3 \ <(sed -En 's/^included: (.*:)?//p' "${in_elffile%.elf}_stack.c" | sort -u) \ - <(readelf_funcs "$in_elffile" | sed 's/\.part\.[0-9]*$//' | sort -u)) + <(readelf_funcs "$in_elffile" | sed -E -e 's/\.part\.[0-9]*$//' -e 's/^__(.*)_veneer$/\1/' | sort -u)) +} + +lint_func_blocklist() { + local in_elffile + in_elffile=$1 + + local blocklist=( + gpio_default_irq_handler + ) + + 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}") } main() { @@ -116,7 +131,8 @@ main() { echo 'Global variables:' lint_globals "${elf}.map" | sed 's/^/ /' } > "${elf%.elf}.lint.globals" - lint_stack "$elf" &> "${elf%.elf}.lint.stack" + (lint_stack "$elf") &> "${elf%.elf}.lint.stack" + lint_func_blocklist "$elf" done return $r |