blob: 3e5530cc83a462a8b1ba2dbce9796411fd86b737 [file] [log] [blame]
#!/usr/bin/env bash
# Copyright 2022 The Fuchsia Authors
#
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT
header() {
echo "// This file is generated by $0. DO NOT EDIT."
echo
echo '#include <stdint.h>'
echo '#include "vdso-code.h"'
echo
echo "constexpr uint64_t kSysretOffsets[] = {"
}
footer() {
echo '};'
}
scan() {
while read define symbol rest; do
case "$symbol" in
VDSO_CODE_SYSRET_*)
echo " ${symbol},"
;;
esac
done
}
set -e
case $# in
1)
exec < "$1"
;;
2)
trap "rm -f '$2'" ERR HUP INT TERM
exec < "$1" > "$2"
;;
esac
header
scan < "$1"
footer