From: Vladimir Serbinenko <phcoder@gmail.com>
To: grub-devel@gnu.org
Cc: Vladimir Serbinenko <phcoder@gmail.com>
Subject: [PATCH v10 10/12] Enable udivdi3 and umoddi3 for mips
Date: Tue, 8 Apr 2025 18:46:27 +0000 [thread overview]
Message-ID: <20250408184800.3517114-11-phcoder@gmail.com> (raw)
In-Reply-To: <20250408184800.3517114-1-phcoder@gmail.com>
Some mips compilers insert 64-bit division into the
code compiled from libgcrypt source and possibly others.
Rether than fighting it, simply provide the function in
question.
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
grub-core/kern/compiler-rt.c | 32 ++++++++++++++++++--------------
include/grub/compiler-rt.h | 4 ++++
2 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/grub-core/kern/compiler-rt.c b/grub-core/kern/compiler-rt.c
index eda689a0c..c83cf3d2d 100644
--- a/grub-core/kern/compiler-rt.c
+++ b/grub-core/kern/compiler-rt.c
@@ -82,20 +82,6 @@ __modsi3 (grub_int32_t a, grub_int32_t b)
return ret;
}
-grub_uint64_t
-__udivdi3 (grub_uint64_t a, grub_uint64_t b)
-{
- return grub_divmod64 (a, b, 0);
-}
-
-grub_uint64_t
-__umoddi3 (grub_uint64_t a, grub_uint64_t b)
-{
- grub_uint64_t ret;
- grub_divmod64 (a, b, &ret);
- return ret;
-}
-
grub_int64_t
__divdi3 (grub_int64_t a, grub_int64_t b)
{
@@ -112,6 +98,24 @@ __moddi3 (grub_int64_t a, grub_int64_t b)
#endif
+#if GRUB_DIVISION_IN_SOFTWARE || defined(__mips__)
+
+grub_uint64_t
+__udivdi3 (grub_uint64_t a, grub_uint64_t b)
+{
+ return grub_divmod64 (a, b, 0);
+}
+
+grub_uint64_t
+__umoddi3 (grub_uint64_t a, grub_uint64_t b)
+{
+ grub_uint64_t ret;
+ grub_divmod64 (a, b, &ret);
+ return ret;
+}
+
+#endif
+
#endif
#ifdef NEED_CTZDI2
diff --git a/include/grub/compiler-rt.h b/include/grub/compiler-rt.h
index 43fd8f4d7..979c3db16 100644
--- a/include/grub/compiler-rt.h
+++ b/include/grub/compiler-rt.h
@@ -45,6 +45,10 @@ EXPORT_FUNC (__divdi3) (grub_int64_t a, grub_int64_t b);
grub_int64_t
EXPORT_FUNC (__moddi3) (grub_int64_t a, grub_int64_t b);
+#endif
+
+#if (defined(GRUB_DIVISION_IN_SOFTWARE) && GRUB_DIVISION_IN_SOFTWARE) || defined(__mips__)
+
grub_uint64_t
EXPORT_FUNC (__udivdi3) (grub_uint64_t a, grub_uint64_t b);
--
2.49.0
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
next prev parent reply other threads:[~2025-04-08 18:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-08 18:46 [PATCH v10 00/12] Upgrade libgcrypt to 1.11 Vladimir Serbinenko
2025-04-08 18:46 ` [PATCH v10 01/12] Import libgcrypt 1.11 Vladimir Serbinenko
2025-04-09 14:29 ` Daniel Kiper
2025-04-08 18:46 ` [PATCH v10 02/12] Import b64dec from gpg-error Vladimir Serbinenko
2025-04-08 18:46 ` [PATCH v10 03/12] b64dec: Adjust for compilation in GRUB environment Vladimir Serbinenko
2025-04-08 18:46 ` [PATCH v10 04/12] Adjust import script, definitions and API users for libgcrypt 1.11 Vladimir Serbinenko
2025-04-08 18:46 ` [PATCH v10 05/12] Add DSA and RSA SEXP tests Vladimir Serbinenko
2025-04-08 18:46 ` [PATCH v10 06/12] keccak: Disable acceleration with SSE asm Vladimir Serbinenko
2025-04-08 18:46 ` [PATCH v10 07/12] libgcrypt: Fix coverity warnings Vladimir Serbinenko
2025-04-08 18:46 ` [PATCH v10 08/12] Remove now unneeded gcrypt compilation flag Vladimir Serbinenko
2025-04-08 18:46 ` [PATCH v10 09/12] Implement __aeabi_uldivmod Vladimir Serbinenko
2025-04-08 18:46 ` Vladimir Serbinenko [this message]
2025-04-08 18:46 ` [PATCH v10 11/12] gcry: Ignore sign-compare warnings Vladimir Serbinenko
2025-04-08 18:46 ` [PATCH v10 12/12] libgcrypt: Import blake family of hashes Vladimir Serbinenko
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=20250408184800.3517114-11-phcoder@gmail.com \
--to=phcoder@gmail.com \
--cc=grub-devel@gnu.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 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.