* [musl] [PATCH] mips: use `jr $ra` instead of `j $ra` to work around an LLVM assembler bug
@ 2024-09-18 1:18 Alex Rønne Petersen
2024-10-22 22:58 ` Rich Felker
0 siblings, 1 reply; 3+ messages in thread
From: Alex Rønne Petersen @ 2024-09-18 1:18 UTC (permalink / raw)
To: musl; +Cc: Alex Rønne Petersen
Details here: https://github.com/llvm/llvm-project/issues/107460
This patch works around the bug by just using the `jr $ra` form, which also more
precisely indicates the encoding intent anyway.
---
crt/mips/crtn.s | 4 ++--
crt/mips64/crtn.s | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/crt/mips/crtn.s b/crt/mips/crtn.s
index 506a04b7..92eb3d0e 100644
--- a/crt/mips/crtn.s
+++ b/crt/mips/crtn.s
@@ -3,11 +3,11 @@
.section .init
lw $gp,24($sp)
lw $ra,28($sp)
- j $ra
+ jr $ra
addu $sp,$sp,32
.section .fini
lw $gp,24($sp)
lw $ra,28($sp)
- j $ra
+ jr $ra
addu $sp,$sp,32
diff --git a/crt/mips64/crtn.s b/crt/mips64/crtn.s
index f3930b24..8f090ed3 100644
--- a/crt/mips64/crtn.s
+++ b/crt/mips64/crtn.s
@@ -3,11 +3,11 @@
.section .init
ld $gp,16($sp)
ld $ra,24($sp)
- j $ra
+ jr $ra
daddu $sp,$sp,32
.section .fini
ld $gp,16($sp)
ld $ra,24($sp)
- j $ra
+ jr $ra
daddu $sp,$sp,32
--
2.40.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [musl] [PATCH] mips: use `jr $ra` instead of `j $ra` to work around an LLVM assembler bug
2024-09-18 1:18 [musl] [PATCH] mips: use `jr $ra` instead of `j $ra` to work around an LLVM assembler bug Alex Rønne Petersen
@ 2024-10-22 22:58 ` Rich Felker
2024-10-26 20:13 ` Alex Rønne Petersen
0 siblings, 1 reply; 3+ messages in thread
From: Rich Felker @ 2024-10-22 22:58 UTC (permalink / raw)
To: Alex Rønne Petersen; +Cc: musl
On Wed, Sep 18, 2024 at 03:18:42AM +0200, Alex Rønne Petersen wrote:
> Details here: https://github.com/llvm/llvm-project/issues/107460
>
> This patch works around the bug by just using the `jr $ra` form, which also more
> precisely indicates the encoding intent anyway.
> ---
> crt/mips/crtn.s | 4 ++--
> crt/mips64/crtn.s | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/crt/mips/crtn.s b/crt/mips/crtn.s
> index 506a04b7..92eb3d0e 100644
> --- a/crt/mips/crtn.s
> +++ b/crt/mips/crtn.s
> @@ -3,11 +3,11 @@
> .section .init
> lw $gp,24($sp)
> lw $ra,28($sp)
> - j $ra
> + jr $ra
> addu $sp,$sp,32
>
> .section .fini
> lw $gp,24($sp)
> lw $ra,28($sp)
> - j $ra
> + jr $ra
> addu $sp,$sp,32
> diff --git a/crt/mips64/crtn.s b/crt/mips64/crtn.s
> index f3930b24..8f090ed3 100644
> --- a/crt/mips64/crtn.s
> +++ b/crt/mips64/crtn.s
> @@ -3,11 +3,11 @@
> .section .init
> ld $gp,16($sp)
> ld $ra,24($sp)
> - j $ra
> + jr $ra
> daddu $sp,$sp,32
>
> .section .fini
> ld $gp,16($sp)
> ld $ra,24($sp)
> - j $ra
> + jr $ra
> daddu $sp,$sp,32
> --
> 2.40.1
Thanks. Applying this with the same applied to mipsn32 too.
Rich
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [musl] [PATCH] mips: use `jr $ra` instead of `j $ra` to work around an LLVM assembler bug
2024-10-22 22:58 ` Rich Felker
@ 2024-10-26 20:13 ` Alex Rønne Petersen
0 siblings, 0 replies; 3+ messages in thread
From: Alex Rønne Petersen @ 2024-10-26 20:13 UTC (permalink / raw)
To: Rich Felker; +Cc: musl
On Wed, Oct 23, 2024 at 12:58 AM Rich Felker <dalias@libc.org> wrote:
>
> On Wed, Sep 18, 2024 at 03:18:42AM +0200, Alex Rønne Petersen wrote:
> > Details here: https://github.com/llvm/llvm-project/issues/107460
> >
> > This patch works around the bug by just using the `jr $ra` form, which also more
> > precisely indicates the encoding intent anyway.
> > ---
> > crt/mips/crtn.s | 4 ++--
> > crt/mips64/crtn.s | 4 ++--
> > 2 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/crt/mips/crtn.s b/crt/mips/crtn.s
> > index 506a04b7..92eb3d0e 100644
> > --- a/crt/mips/crtn.s
> > +++ b/crt/mips/crtn.s
> > @@ -3,11 +3,11 @@
> > .section .init
> > lw $gp,24($sp)
> > lw $ra,28($sp)
> > - j $ra
> > + jr $ra
> > addu $sp,$sp,32
> >
> > .section .fini
> > lw $gp,24($sp)
> > lw $ra,28($sp)
> > - j $ra
> > + jr $ra
> > addu $sp,$sp,32
> > diff --git a/crt/mips64/crtn.s b/crt/mips64/crtn.s
> > index f3930b24..8f090ed3 100644
> > --- a/crt/mips64/crtn.s
> > +++ b/crt/mips64/crtn.s
> > @@ -3,11 +3,11 @@
> > .section .init
> > ld $gp,16($sp)
> > ld $ra,24($sp)
> > - j $ra
> > + jr $ra
> > daddu $sp,$sp,32
> >
> > .section .fini
> > ld $gp,16($sp)
> > ld $ra,24($sp)
> > - j $ra
> > + jr $ra
> > daddu $sp,$sp,32
> > --
> > 2.40.1
>
> Thanks. Applying this with the same applied to mipsn32 too.
Oops, I'd completely forgotten to apply it there because we hadn't yet
imported musl's mipsn32 code in Zig. Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-26 20:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-18 1:18 [musl] [PATCH] mips: use `jr $ra` instead of `j $ra` to work around an LLVM assembler bug Alex Rønne Petersen
2024-10-22 22:58 ` Rich Felker
2024-10-26 20:13 ` Alex Rønne Petersen
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).