mailing list of musl libc
 help / color / mirror / code / Atom feed
From: "Alex Rønne Petersen" <alex@alexrp.com>
To: musl@lists.openwall.com
Cc: "Alex Rønne Petersen" <alex@alexrp.com>
Subject: [musl] [PATCH] mips: use `jr $ra` instead of `j $ra` to work around an LLVM assembler bug
Date: Wed, 18 Sep 2024 03:18:42 +0200	[thread overview]
Message-ID: <20240918011842.26118-1-alex@alexrp.com> (raw)

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


             reply	other threads:[~2024-09-18  1:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-18  1:18 Alex Rønne Petersen [this message]
2024-10-22 22:58 ` Rich Felker
2024-10-26 20:13   ` Alex Rønne Petersen

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=20240918011842.26118-1-alex@alexrp.com \
    --to=alex@alexrp.com \
    --cc=musl@lists.openwall.com \
    /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.
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).