From: Coder_Y <zewyang@foxmail.com>
To: gdb-patches@sourceware.org
Cc: Coder_Y <zewyang@foxmail.com>
Subject: [PATCH] fix: support LoongArch64 in my-syscalls.S to resolve step-over-thread-exit-while-stop-all-threads.exp build failure
Date: Tue, 21 Oct 2025 19:30:47 +0000 [thread overview]
Message-ID: <tencent_70215D24D00DAB64284F3426AC46E3399A09@qq.com> (raw)
This patch adds syscall wrappers for LoongArch64 to gdb/testsuite/lib/my-syscalls.S.
- Implements the missing `__loongarch64` section
- Uses `lu12i.w` + `ori` to load the syscall number into `$a7`
- Triggers system calls via `syscall 0`
- Returns to caller using `jr $ra`
This change fixes build failures in LoongArch64 when running:
gdb.threads/step-over-thread-exit-while-stop-all-threads.exp
Tested on: loongarch64-unknown-linux-gnu
Result: expected testcases passed
Signed-off-by: Nick Young <zewyang@foxmail.com>
---
gdb/testsuite/lib/my-syscalls.S | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/gdb/testsuite/lib/my-syscalls.S b/gdb/testsuite/lib/my-syscalls.S
index c514b32d..a8862b5c 100644
--- a/gdb/testsuite/lib/my-syscalls.S
+++ b/gdb/testsuite/lib/my-syscalls.S
@@ -63,6 +63,19 @@ NAME: ;\
NAME ## _syscall: ;\
svc #0
+#elif defined(__loongarch64)
+
+/* LoongArch 64-bit syscall wrapper */
+#define SYSCALL(NAME, NR) \
+.global NAME ;\
+NAME: ;\
+ lu12i.w $a7, NR >> 12 ;\
+ ori $a7, $a7, NR & 0xfff ;\
+ /* syscall number */ \
+NAME ## _syscall: ;\
+ syscall 0 ;\
+ jr $ra
+
#else
# error "Unsupported architecture"
#endif
--
2.43.0
next reply other threads:[~2025-10-21 11:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-21 19:30 Coder_Y [this message]
2025-10-22 8:48 ` Tiezhu Yang
2025-10-22 9:06 ` Tiezhu Yang
2025-10-23 1:29 ` yangzewei
2025-10-23 1:45 ` [PATCH V2] gdb/testsuite: Add LoongArch case in my-syscalls.S Zewei Yang
2025-10-24 2:44 ` Tiezhu Yang
2025-10-30 14:11 ` Tiezhu Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_70215D24D00DAB64284F3426AC46E3399A09@qq.com \
--to=zewyang@foxmail.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox