[3/3] gdb: syscalls: Update LoongArch xml files

Message ID 20241126085912.30599-4-yangtiezhu@loongson.cn
State New
Headers
Series gdb: Update syscall files for LoongArch |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Tiezhu Yang Nov. 26, 2024, 8:59 a.m. UTC
  There are some new syscalls in the latest upstream Linux kernel, update
the xml files for LoongArch to reflect the reality.

There is no syscall.tbl for LoongArch because it uses generic syscalls,
so it can not generate loongarch-linux.xml.in automatically through the
script update-linux-from-src.sh, make use of the script update-linux.sh
to generate loongarch-linux.xml.in, then make use of the command "make"
to generate loongarch-linux.xml from loongarch-linux.xml.in.

Like this:

  $ git clone https://sourceware.org/git/binutils-gdb.git gdb.git
  $ cd gdb.git/gdb/syscalls/
  $ ./update-linux.sh loongarch-linux.xml.in
  $ make

Note that the system headers may be different with the upstream headers
of Linux kernel, it is better to copy the upstream headers into the system
headers when generating loongarch-linux.xml.in.

/usr/include/asm-generic/unistd.h  --  include/uapi/asm-generic/unistd.h
/usr/include/asm/unistd.h          --  arch/loongarch/include/asm/unistd.h

Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7697a0fe0154
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ff388fe5c481
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6140be90ec70
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 gdb/syscalls/loongarch-linux.xml    | 9 ++++++++-
 gdb/syscalls/loongarch-linux.xml.in | 9 ++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)
  

Comments

Tom de Vries Nov. 26, 2024, 3:46 p.m. UTC | #1
On 11/26/24 09:59, Tiezhu Yang wrote:
> There are some new syscalls in the latest upstream Linux kernel, update
> the xml files for LoongArch to reflect the reality.
> 
> There is no syscall.tbl for LoongArch because it uses generic syscalls,
> so it can not generate loongarch-linux.xml.in automatically through the
> script update-linux-from-src.sh, make use of the script update-linux.sh
> to generate loongarch-linux.xml.in, then make use of the command "make"
> to generate loongarch-linux.xml from loongarch-linux.xml.in.
> 
> Like this:
> 
>    $ git clone https://sourceware.org/git/binutils-gdb.git gdb.git
>    $ cd gdb.git/gdb/syscalls/
>    $ ./update-linux.sh loongarch-linux.xml.in
>    $ make
> 
> Note that the system headers may be different with the upstream headers
> of Linux kernel, it is better to copy the upstream headers into the system
> headers when generating loongarch-linux.xml.in.
> 
> /usr/include/asm-generic/unistd.h  --  include/uapi/asm-generic/unistd.h
> /usr/include/asm/unistd.h          --  arch/loongarch/include/asm/unistd.h
> 

AFAIU you mean better in the sense of getting more recent results.

I understand the motivation: the script update-linux-from-srch generates 
directly from linux kernel sources but doesn't support 
loongarch-linux.xml.in. Instead we use update-linux.sh, but for that we 
need an installed system, which tends to be less recent that upstream 
trunk, so
we try to work around that by copying some files.

Manually copying some files is error-prone, and there's the question of 
completeness, so it would be good to have a different solution.

I've submitted an update to update-linux-from-src.sh that adds handling 
of aarch64-linux.xml.in, and the same can be used for 
loongarch-linux.xml.in.

For now, I think this patch is ok, and the only reason I'm not approving 
this yet is because of the nit below.

> Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7697a0fe0154
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ff388fe5c481
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6140be90ec70

As in the other patch, please rewrite this into foot-note style and add 
references to it, something like:
...
There are some new syscalls in the latest upstream Linux kernel [1][2][3],
...

Thanks,
- Tom

> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>   gdb/syscalls/loongarch-linux.xml    | 9 ++++++++-
>   gdb/syscalls/loongarch-linux.xml.in | 9 ++++++++-
>   2 files changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/syscalls/loongarch-linux.xml b/gdb/syscalls/loongarch-linux.xml
> index 91e7bbc9691..3085da173e8 100644
> --- a/gdb/syscalls/loongarch-linux.xml
> +++ b/gdb/syscalls/loongarch-linux.xml
> @@ -89,6 +89,8 @@
>     <syscall name="splice" number="76" groups="descriptor"/>
>     <syscall name="tee" number="77" groups="descriptor"/>
>     <syscall name="readlinkat" number="78" groups="descriptor,file"/>
> +  <syscall name="fstatat" number="79"/>
> +  <syscall name="fstat" number="80" groups="descriptor"/>
>     <syscall name="sync" number="81"/>
>     <syscall name="fsync" number="82" groups="descriptor"/>
>     <syscall name="fdatasync" number="83" groups="descriptor"/>
> @@ -323,5 +325,10 @@
>     <syscall name="lsm_get_self_attr" number="459"/>
>     <syscall name="lsm_set_self_attr" number="460"/>
>     <syscall name="lsm_list_modules" number="461"/>
> -  <syscall name="syscalls" number="462"/>
> +  <syscall name="mseal" number="462"/>
> +  <syscall name="setxattrat" number="463"/>
> +  <syscall name="getxattrat" number="464"/>
> +  <syscall name="listxattrat" number="465"/>
> +  <syscall name="removexattrat" number="466"/>
> +  <syscall name="syscalls" number="467"/>
>   </syscalls_info>
> diff --git a/gdb/syscalls/loongarch-linux.xml.in b/gdb/syscalls/loongarch-linux.xml.in
> index e6e17b3f2b6..3172a45baf2 100644
> --- a/gdb/syscalls/loongarch-linux.xml.in
> +++ b/gdb/syscalls/loongarch-linux.xml.in
> @@ -93,6 +93,8 @@
>     <syscall name="splice" number="76"/>
>     <syscall name="tee" number="77"/>
>     <syscall name="readlinkat" number="78"/>
> +  <syscall name="fstatat" number="79"/>
> +  <syscall name="fstat" number="80"/>
>     <syscall name="sync" number="81"/>
>     <syscall name="fsync" number="82"/>
>     <syscall name="fdatasync" number="83"/>
> @@ -327,5 +329,10 @@
>     <syscall name="lsm_get_self_attr" number="459"/>
>     <syscall name="lsm_set_self_attr" number="460"/>
>     <syscall name="lsm_list_modules" number="461"/>
> -  <syscall name="syscalls" number="462"/>
> +  <syscall name="mseal" number="462"/>
> +  <syscall name="setxattrat" number="463"/>
> +  <syscall name="getxattrat" number="464"/>
> +  <syscall name="listxattrat" number="465"/>
> +  <syscall name="removexattrat" number="466"/>
> +  <syscall name="syscalls" number="467"/>
>   </syscalls_info>
  

Patch

diff --git a/gdb/syscalls/loongarch-linux.xml b/gdb/syscalls/loongarch-linux.xml
index 91e7bbc9691..3085da173e8 100644
--- a/gdb/syscalls/loongarch-linux.xml
+++ b/gdb/syscalls/loongarch-linux.xml
@@ -89,6 +89,8 @@ 
   <syscall name="splice" number="76" groups="descriptor"/>
   <syscall name="tee" number="77" groups="descriptor"/>
   <syscall name="readlinkat" number="78" groups="descriptor,file"/>
+  <syscall name="fstatat" number="79"/>
+  <syscall name="fstat" number="80" groups="descriptor"/>
   <syscall name="sync" number="81"/>
   <syscall name="fsync" number="82" groups="descriptor"/>
   <syscall name="fdatasync" number="83" groups="descriptor"/>
@@ -323,5 +325,10 @@ 
   <syscall name="lsm_get_self_attr" number="459"/>
   <syscall name="lsm_set_self_attr" number="460"/>
   <syscall name="lsm_list_modules" number="461"/>
-  <syscall name="syscalls" number="462"/>
+  <syscall name="mseal" number="462"/>
+  <syscall name="setxattrat" number="463"/>
+  <syscall name="getxattrat" number="464"/>
+  <syscall name="listxattrat" number="465"/>
+  <syscall name="removexattrat" number="466"/>
+  <syscall name="syscalls" number="467"/>
 </syscalls_info>
diff --git a/gdb/syscalls/loongarch-linux.xml.in b/gdb/syscalls/loongarch-linux.xml.in
index e6e17b3f2b6..3172a45baf2 100644
--- a/gdb/syscalls/loongarch-linux.xml.in
+++ b/gdb/syscalls/loongarch-linux.xml.in
@@ -93,6 +93,8 @@ 
   <syscall name="splice" number="76"/>
   <syscall name="tee" number="77"/>
   <syscall name="readlinkat" number="78"/>
+  <syscall name="fstatat" number="79"/>
+  <syscall name="fstat" number="80"/>
   <syscall name="sync" number="81"/>
   <syscall name="fsync" number="82"/>
   <syscall name="fdatasync" number="83"/>
@@ -327,5 +329,10 @@ 
   <syscall name="lsm_get_self_attr" number="459"/>
   <syscall name="lsm_set_self_attr" number="460"/>
   <syscall name="lsm_list_modules" number="461"/>
-  <syscall name="syscalls" number="462"/>
+  <syscall name="mseal" number="462"/>
+  <syscall name="setxattrat" number="463"/>
+  <syscall name="getxattrat" number="464"/>
+  <syscall name="listxattrat" number="465"/>
+  <syscall name="removexattrat" number="466"/>
+  <syscall name="syscalls" number="467"/>
 </syscalls_info>