* [PATCH] linux-user: Fix trivial build error on loongarch64
@ 2022-01-04 13:02 Philippe Mathieu-Daudé
2022-01-04 13:03 ` Philippe Mathieu-Daudé
2022-01-04 13:14 ` WANG Xuerui
0 siblings, 2 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-01-04 13:02 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-trivial, Michael Tokarev, Laurent Vivier, Song Gao,
WANG Xuerui, Philippe Mathieu-Daudé
When building using GCC 8.3.0 on loongarch64 (Loongnix) we get:
In file included from ../linux-user/signal.c:33:
../linux-user/host/loongarch64/host-signal.h: In function ‘host_signal_write’:
../linux-user/host/loongarch64/host-signal.h:57:9: error: a label can only be part of a statement and a declaration is not a statement
uint32_t sel = (insn >> 15) & 0b11111111111;
^~~~~~~~
We don't use the 'sel' variable more than once, so drop it.
Meson output for the record:
Host machine cpu family: loongarch64
Host machine cpu: loongarch64
C compiler for the host machine: cc (gcc 8.3.0 "cc (Loongnix 8.3.0-6.lnd.vec.27) 8.3.0")
C linker for the host machine: cc ld.bfd 2.31.1-system
Fixes: ad812c3bd65 ("linux-user: Implement CPU-specific signal handler for loongarch64 hosts")
Reported-by: Song Gao <gaosong@loongson.cn>
Suggested-by: Song Gao <gaosong@loongson.cn>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
linux-user/host/loongarch64/host-signal.h | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/linux-user/host/loongarch64/host-signal.h b/linux-user/host/loongarch64/host-signal.h
index 05e2c823717..7effa242515 100644
--- a/linux-user/host/loongarch64/host-signal.h
+++ b/linux-user/host/loongarch64/host-signal.h
@@ -54,9 +54,7 @@ static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc)
}
break;
case 0b001110: /* indexed, atomic, bounds-checking memory operations */
- uint32_t sel = (insn >> 15) & 0b11111111111;
-
- switch (sel) {
+ switch ((insn >> 15) & 0b11111111111) {
case 0b00000100000: /* stx.b */
case 0b00000101000: /* stx.h */
case 0b00000110000: /* stx.w */
--
2.33.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] linux-user: Fix trivial build error on loongarch64
2022-01-04 13:02 [PATCH] linux-user: Fix trivial build error on loongarch64 Philippe Mathieu-Daudé
@ 2022-01-04 13:03 ` Philippe Mathieu-Daudé
2022-01-04 13:14 ` WANG Xuerui
1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-01-04 13:03 UTC (permalink / raw)
To: qemu-devel@nongnu.org Developers
Cc: WANG Xuerui, QEMU Trivial, Michael Tokarev, Laurent Vivier, Song Gao
I forgot to add trailing "hosts" in the subject line.
On Tue, Jan 4, 2022 at 2:02 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> When building using GCC 8.3.0 on loongarch64 (Loongnix) we get:
>
> In file included from ../linux-user/signal.c:33:
> ../linux-user/host/loongarch64/host-signal.h: In function ‘host_signal_write’:
> ../linux-user/host/loongarch64/host-signal.h:57:9: error: a label can only be part of a statement and a declaration is not a statement
> uint32_t sel = (insn >> 15) & 0b11111111111;
> ^~~~~~~~
>
> We don't use the 'sel' variable more than once, so drop it.
>
> Meson output for the record:
>
> Host machine cpu family: loongarch64
> Host machine cpu: loongarch64
> C compiler for the host machine: cc (gcc 8.3.0 "cc (Loongnix 8.3.0-6.lnd.vec.27) 8.3.0")
> C linker for the host machine: cc ld.bfd 2.31.1-system
>
> Fixes: ad812c3bd65 ("linux-user: Implement CPU-specific signal handler for loongarch64 hosts")
> Reported-by: Song Gao <gaosong@loongson.cn>
> Suggested-by: Song Gao <gaosong@loongson.cn>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> linux-user/host/loongarch64/host-signal.h | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/linux-user/host/loongarch64/host-signal.h b/linux-user/host/loongarch64/host-signal.h
> index 05e2c823717..7effa242515 100644
> --- a/linux-user/host/loongarch64/host-signal.h
> +++ b/linux-user/host/loongarch64/host-signal.h
> @@ -54,9 +54,7 @@ static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc)
> }
> break;
> case 0b001110: /* indexed, atomic, bounds-checking memory operations */
> - uint32_t sel = (insn >> 15) & 0b11111111111;
> -
> - switch (sel) {
> + switch ((insn >> 15) & 0b11111111111) {
> case 0b00000100000: /* stx.b */
> case 0b00000101000: /* stx.h */
> case 0b00000110000: /* stx.w */
> --
> 2.33.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] linux-user: Fix trivial build error on loongarch64
2022-01-04 13:02 [PATCH] linux-user: Fix trivial build error on loongarch64 Philippe Mathieu-Daudé
2022-01-04 13:03 ` Philippe Mathieu-Daudé
@ 2022-01-04 13:14 ` WANG Xuerui
1 sibling, 0 replies; 3+ messages in thread
From: WANG Xuerui @ 2022-01-04 13:14 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: WANG Xuerui, qemu-trivial, Michael Tokarev, Laurent Vivier, Song Gao
On 2022/1/4 21:02, Philippe Mathieu-Daudé wrote:
> When building using GCC 8.3.0 on loongarch64 (Loongnix) we get:
>
> In file included from ../linux-user/signal.c:33:
> ../linux-user/host/loongarch64/host-signal.h: In function ‘host_signal_write’:
> ../linux-user/host/loongarch64/host-signal.h:57:9: error: a label can only be part of a statement and a declaration is not a statement
> uint32_t sel = (insn >> 15) & 0b11111111111;
> ^~~~~~~~
>
> We don't use the 'sel' variable more than once, so drop it.
>
> Meson output for the record:
>
> Host machine cpu family: loongarch64
> Host machine cpu: loongarch64
> C compiler for the host machine: cc (gcc 8.3.0 "cc (Loongnix 8.3.0-6.lnd.vec.27) 8.3.0")
> C linker for the host machine: cc ld.bfd 2.31.1-system
So this issue indeed only happens on the Loongson-provided toolchain
with the ancient 8.3.0 version of gcc, after all... I'd have to admit
that I was initially reluctant to even investigate this, given the
tendency of Loongson people not verifying things on upstream versions of
their own work, but...
>
> Fixes: ad812c3bd65 ("linux-user: Implement CPU-specific signal handler for loongarch64 hosts")
> Reported-by: Song Gao <gaosong@loongson.cn>
> Suggested-by: Song Gao <gaosong@loongson.cn>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> linux-user/host/loongarch64/host-signal.h | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/linux-user/host/loongarch64/host-signal.h b/linux-user/host/loongarch64/host-signal.h
> index 05e2c823717..7effa242515 100644
> --- a/linux-user/host/loongarch64/host-signal.h
> +++ b/linux-user/host/loongarch64/host-signal.h
> @@ -54,9 +54,7 @@ static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc)
> }
> break;
> case 0b001110: /* indexed, atomic, bounds-checking memory operations */
> - uint32_t sel = (insn >> 15) & 0b11111111111;
> -
> - switch (sel) {
> + switch ((insn >> 15) & 0b11111111111) {
> case 0b00000100000: /* stx.b */
> case 0b00000101000: /* stx.h */
> case 0b00000110000: /* stx.w */
the fix is obvious enough, doesn't harm readability, and solves a real
problem for some (their toolchain being outdated is not their fault,
rather Loongson's).
So after fixing the commit message:
Reviewed-by: WANG Xuerui <git@xen0n.name>
(Or do I just collect this patch and fix the commit message myself,
sending a pull request later? I'm new to QEMU maintenance procedure and
I'm still not quite sure if it is too heavyweight to have you send v2
for just a single typo and R-b tag collection.)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-04 13:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-04 13:02 [PATCH] linux-user: Fix trivial build error on loongarch64 Philippe Mathieu-Daudé
2022-01-04 13:03 ` Philippe Mathieu-Daudé
2022-01-04 13:14 ` WANG Xuerui
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.