forked from Imagelibrary/binutils-gdb
Currently aarch64-linux.xml.in is skipped by update-linux-from-src.sh: ... $ ./update-linux-from-src.sh ~/upstream/linux-stable.git/ Skipping aarch64-linux.xml.in, no syscall.tbl ... $ ... and instead we use update-linux.sh. This works fine, but requires an aarch64 system with recent system headers, which makes it harder to pick up the latest changes in the linux kernel. Fix this by updating ./update-linux-from-src.sh to: - build the linux kernel headers for aarch64 - use update-linux.sh with those headers to generate aarch64-linux.xml.in. Regenerating aarch64-linux.xml.in using current trunk of linux-stable gives me these changes: ... + <syscall name="setxattrat" number="463"/> + <syscall name="getxattrat" number="464"/> + <syscall name="listxattrat" number="465"/> + <syscall name="removexattrat" number="466"/> ... which are the same changes I see for the other architectures. Note that the first step, building the linux kernel headers is a cross build and should work on any architecture. But the second step, update-linux.sh uses plain gcc rather than a cross-gcc, so there is scope for problems, but we seem to get away with this on x86_64-linux. So, while we could constrain this to only generate aarch64-linux.xml.in on aarch64-linux, I'm leaving this unconstrained. For aarch64-linux.xml.in, this doesn't matter much to me because I got an aarch64-linux system. But I don't have a longaarch system, and the same approach seems to work there. I'm leaving this for follow-up patch though. Tested on aarch64-linux and x86_64-linux. Verified with shellcheck.
81 lines
1.9 KiB
Bash
Executable File
81 lines
1.9 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# Copyright (C) 2022-2024 Free Software Foundation, Inc.
|
|
#
|
|
# This file is part of GDB.
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# Used to generate .xml.in files, like so:
|
|
#
|
|
# ./update-linux.sh amd64-linux.xml.in
|
|
# ./update-linux.sh i386-linux.xml.in -m32
|
|
|
|
|
|
if [ $# -lt 1 ]; then
|
|
echo "file argument needed"
|
|
exit 1
|
|
fi
|
|
|
|
f="$1"
|
|
shift
|
|
|
|
if [ ! -f "$f" ]; then
|
|
echo "cannot find $f"
|
|
exit 1
|
|
fi
|
|
|
|
startyear=2009
|
|
case "$f" in
|
|
*aarch64-linux.xml.in)
|
|
startyear=2015
|
|
;;
|
|
esac
|
|
|
|
year=$(date +%Y)
|
|
|
|
(
|
|
cat <<EOF
|
|
<?xml version="1.0"?>
|
|
<!-- Copyright (C) $startyear-$year Free Software Foundation, Inc.
|
|
|
|
Copying and distribution of this file, with or without modification,
|
|
are permitted in any medium without royalty provided the copyright
|
|
notice and this notice are preserved. -->
|
|
|
|
<!DOCTYPE feature SYSTEM "gdb-syscalls.dtd">
|
|
|
|
<!-- This file was generated using the following file:
|
|
|
|
<sys/syscall.h>
|
|
|
|
The file mentioned above belongs to the Linux Kernel. -->
|
|
|
|
|
|
EOF
|
|
|
|
echo '<syscalls_info>'
|
|
|
|
echo '#include <asm/unistd.h>' \
|
|
| gcc -E - -dD "$@" \
|
|
| grep -E '#define __NR_' \
|
|
| while read -r line; do
|
|
name=$(echo "$line" | awk '{print $2}' | sed 's/^__NR_//')
|
|
nr=$(echo "$line" | awk '{print $3}')
|
|
echo " <syscall name=\"$name\" number=\"$nr\"/>"
|
|
done
|
|
|
|
echo '</syscalls_info>'
|
|
) > "$f"
|