* [PATCH] fix: support LoongArch64 in my-syscalls.S to resolve step-over-thread-exit-while-stop-all-threads.exp build failure
@ 2025-10-21 19:30 Coder_Y
2025-10-22 8:48 ` Tiezhu Yang
0 siblings, 1 reply; 7+ messages in thread
From: Coder_Y @ 2025-10-21 19:30 UTC (permalink / raw)
To: gdb-patches; +Cc: Coder_Y
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] fix: support LoongArch64 in my-syscalls.S to resolve step-over-thread-exit-while-stop-all-threads.exp build failure
2025-10-21 19:30 [PATCH] fix: support LoongArch64 in my-syscalls.S to resolve step-over-thread-exit-while-stop-all-threads.exp build failure Coder_Y
@ 2025-10-22 8:48 ` Tiezhu Yang
2025-10-22 9:06 ` Tiezhu Yang
0 siblings, 1 reply; 7+ messages in thread
From: Tiezhu Yang @ 2025-10-22 8:48 UTC (permalink / raw)
To: Coder_Y, gdb-patches
On 2025/10/22 上午3:30, Coder_Y wrote:
> This patch adds syscall wrappers for LoongArch64 to gdb/testsuite/lib/my-syscalls.S.
It is better to change the patch title to:
gdb/testsuite: Add LoongArch case in my-syscalls.S
> - Implements the missing `__loongarch64` section
> - Uses `lu12i.w` + `ori` to load the syscall number into `$a7`
Why not using the instruction "li.w" directly?
> - Triggers system calls via `syscall 0`
> - Returns to caller using `jr $ra`
You can use the instruction "ret" to make it more readable.
please see opcodes/loongarch-opc.c file to get more info.
> 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
Did you meet any real problems when debugging?
If yes, please describe it in the commit message.
> Signed-off-by: Nick Young <zewyang@foxmail.com>
Please use your real name here and make it consistent with 'From'
instead of abbreviation.
> ---
> 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
Thanks,
Tiezhu
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] fix: support LoongArch64 in my-syscalls.S to resolve step-over-thread-exit-while-stop-all-threads.exp build failure
2025-10-22 8:48 ` Tiezhu Yang
@ 2025-10-22 9:06 ` Tiezhu Yang
2025-10-23 1:29 ` yangzewei
0 siblings, 1 reply; 7+ messages in thread
From: Tiezhu Yang @ 2025-10-22 9:06 UTC (permalink / raw)
To: Coder_Y, gdb-patches
On 2025/10/22 下午4:48, Tiezhu Yang wrote:
> On 2025/10/22 上午3:30, Coder_Y wrote:
>> This patch adds syscall wrappers for LoongArch64 to
>> gdb/testsuite/lib/my-syscalls.S.
>
> It is better to change the patch title to:
> gdb/testsuite: Add LoongArch case in my-syscalls.S
>
>> - Implements the missing `__loongarch64` section
>> - Uses `lu12i.w` + `ori` to load the syscall number into `$a7`
>
> Why not using the instruction "li.w" directly?
>
>> - Triggers system calls via `syscall 0`
>> - Returns to caller using `jr $ra`
>
> You can use the instruction "ret" to make it more readable.
> please see opcodes/loongarch-opc.c file to get more info.
>
>> 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
>
> Did you meet any real problems when debugging?
> If yes, please describe it in the commit message.
>
>> Signed-off-by: Nick Young <zewyang@foxmail.com>
>
> Please use your real name here and make it consistent with 'From'
> instead of abbreviation.
Forgot to say, it should use your company email if you are an
employee of Loongson company (we have signed the FSF copyright
assignment), then I can push the updated patch for you.
Thanks,
Tiezhu
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] fix: support LoongArch64 in my-syscalls.S to resolve step-over-thread-exit-while-stop-all-threads.exp build failure
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
0 siblings, 1 reply; 7+ messages in thread
From: yangzewei @ 2025-10-23 1:29 UTC (permalink / raw)
To: yangtiezhu; +Cc: gdb-patches
From: Zewei Yang <yangzewei@loongson.cn>
Got it, thank you for your detailed review and kind reminders.
This patch was mainly intended to fix the build error that occurred during
the execution of gdb.threads/step-over-thread-exit-while-stop-all-threads.exp
due to the missing LoongArch64 case in my-syscalls.S.
As far as I know, there were no other specific debugging issues involved.
I will update the patch with my real name and Loongson company email address,
and will send the updated patch a little later.
Thanks again for your help!
Best regards,
Zewei Yang
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH V2] gdb/testsuite: Add LoongArch case in my-syscalls.S
2025-10-23 1:29 ` yangzewei
@ 2025-10-23 1:45 ` Zewei Yang
2025-10-24 2:44 ` Tiezhu Yang
0 siblings, 1 reply; 7+ messages in thread
From: Zewei Yang @ 2025-10-23 1:45 UTC (permalink / raw)
To: gdb-patches; +Cc: yangtiezhu
This patch adds syscall wrappers for LoongArch64 to gdb/testsuite/lib/my-syscalls.S.
- Implements the missing `__loongarch64` section.
- Uses `li.w` to load the syscall number into `$a7`.
- Triggers system calls via `syscall 0`.
- Returns to the caller using `ret`.
This change fixes build errors when running
`gdb.threads/step-over-thread-exit-while-stop-all-threads.exp`
on LoongArch64 targets caused by the absence of the LoongArch-specific
syscall wrappers in `my-syscalls.S`.
Tested on: loongarch64-unknown-linux-gnu
Result: expected testcases passed.
Signed-off-by: Zewei Yang <yangzewei@loongson.cn>
---
gdb/testsuite/lib/my-syscalls.S | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/gdb/testsuite/lib/my-syscalls.S b/gdb/testsuite/lib/my-syscalls.S
index c514b32d..3e2e397d 100644
--- a/gdb/testsuite/lib/my-syscalls.S
+++ b/gdb/testsuite/lib/my-syscalls.S
@@ -63,6 +63,18 @@ NAME: ;\
NAME ## _syscall: ;\
svc #0
+#elif defined(__loongarch64)
+
+/* LoongArch 64-bit syscall wrapper */
+#define SYSCALL(NAME, NR) \
+.global NAME ;\
+NAME: ;\
+ li.w $a7, NR ;\
+ /* syscall number */ \
+NAME ## _syscall: ;\
+ syscall 0 ;\
+ ret
+
#else
# error "Unsupported architecture"
#endif
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH V2] gdb/testsuite: Add LoongArch case in my-syscalls.S
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
0 siblings, 1 reply; 7+ messages in thread
From: Tiezhu Yang @ 2025-10-24 2:44 UTC (permalink / raw)
To: Zewei Yang, gdb-patches
On 2025/10/23 上午9:45, Zewei Yang wrote:
> This patch adds syscall wrappers for LoongArch64 to gdb/testsuite/lib/my-syscalls.S.
>
> - Implements the missing `__loongarch64` section.
> - Uses `li.w` to load the syscall number into `$a7`.
> - Triggers system calls via `syscall 0`.
> - Returns to the caller using `ret`.
>
> This change fixes build errors when running
> `gdb.threads/step-over-thread-exit-while-stop-all-threads.exp`
> on LoongArch64 targets caused by the absence of the LoongArch-specific
> syscall wrappers in `my-syscalls.S`.
>
> Tested on: loongarch64-unknown-linux-gnu
> Result: expected testcases passed.
>
> Signed-off-by: Zewei Yang <yangzewei@loongson.cn>
> ---
> gdb/testsuite/lib/my-syscalls.S | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/gdb/testsuite/lib/my-syscalls.S b/gdb/testsuite/lib/my-syscalls.S
> index c514b32d..3e2e397d 100644
> --- a/gdb/testsuite/lib/my-syscalls.S
> +++ b/gdb/testsuite/lib/my-syscalls.S
> @@ -63,6 +63,18 @@ NAME: ;\
> NAME ## _syscall: ;\
> svc #0
>
> +#elif defined(__loongarch64)
> +
> +/* LoongArch 64-bit syscall wrapper */
> +#define SYSCALL(NAME, NR) \
> +.global NAME ;\
> +NAME: ;\
> + li.w $a7, NR ;\
> + /* syscall number */ \
> +NAME ## _syscall: ;\
> + syscall 0 ;\
> + ret
> +
> #else
> # error "Unsupported architecture"
> #endif
Looks good to me in general, if there are no more comments or
objections, I will adjust the commit message and code format,
then push this patch in the next week, because it is related
with LoongArch and no side effect for the other archs.
Thanks,
Tiezhu
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH V2] gdb/testsuite: Add LoongArch case in my-syscalls.S
2025-10-24 2:44 ` Tiezhu Yang
@ 2025-10-30 14:11 ` Tiezhu Yang
0 siblings, 0 replies; 7+ messages in thread
From: Tiezhu Yang @ 2025-10-30 14:11 UTC (permalink / raw)
To: Zewei Yang, gdb-patches
On 10/24/25 10:44, Tiezhu Yang wrote:
> On 2025/10/23 上午9:45, Zewei Yang wrote:
>> This patch adds syscall wrappers for LoongArch64 to
>> gdb/testsuite/lib/my-syscalls.S.
>>
>> - Implements the missing `__loongarch64` section.
>> - Uses `li.w` to load the syscall number into `$a7`.
>> - Triggers system calls via `syscall 0`.
>> - Returns to the caller using `ret`.
>>
>> This change fixes build errors when running
>> `gdb.threads/step-over-thread-exit-while-stop-all-threads.exp`
>> on LoongArch64 targets caused by the absence of the LoongArch-specific
>> syscall wrappers in `my-syscalls.S`.
>>
>> Tested on: loongarch64-unknown-linux-gnu
>> Result: expected testcases passed.
>>
>> Signed-off-by: Zewei Yang <yangzewei@loongson.cn>
>> ---
>> gdb/testsuite/lib/my-syscalls.S | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/gdb/testsuite/lib/my-syscalls.S
>> b/gdb/testsuite/lib/my-syscalls.S
>> index c514b32d..3e2e397d 100644
>> --- a/gdb/testsuite/lib/my-syscalls.S
>> +++ b/gdb/testsuite/lib/my-syscalls.S
>> @@ -63,6 +63,18 @@ NAME: ;\
>> NAME ## _syscall: ;\
>> svc #0
>> +#elif defined(__loongarch64)
>> +
>> +/* LoongArch 64-bit syscall wrapper */
>> +#define SYSCALL(NAME, NR) \
>> +.global NAME ;\
>> +NAME: ;\
>> + li.w $a7, NR ;\
>> + /* syscall number */ \
>> +NAME ## _syscall: ;\
>> + syscall 0 ;\
>> + ret
>> +
>> #else
>> # error "Unsupported architecture"
>> #endif
>
> Looks good to me in general, if there are no more comments or
> objections, I will adjust the commit message and code format,
> then push this patch in the next week, because it is related
> with LoongArch and no side effect for the other archs.
Pushed.
Thanks,
Tiezhu
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-10-30 14:11 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-21 19:30 [PATCH] fix: support LoongArch64 in my-syscalls.S to resolve step-over-thread-exit-while-stop-all-threads.exp build failure Coder_Y
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox