]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mips: implement __udivdi3
authorLinus Walleij <linus.walleij@linaro.org>
Mon, 18 Sep 2023 06:11:39 +0000 (08:11 +0200)
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Wed, 13 Mar 2024 20:15:40 +0000 (21:15 +0100)
Squashfs wasn't compiling because the lldiv() directives
turn into __udivdi3 and we are using private libgcc.

After this squashfs compiles for MIPS.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Bartel Eerdekens <barteleerdekens@gmail.com>
arch/mips/lib/Makefile
arch/mips/lib/udivdi3.c [new file with mode: 0644]

index 9ee1fcb5c7024046cbb20041f6796665fb821bda..1621cc9a1ff955623fa53e5a739c957de4532f37 100644 (file)
@@ -14,4 +14,4 @@ obj-$(CONFIG_CMD_BOOTM) += bootm.o
 obj-$(CONFIG_CMD_GO) += boot.o
 obj-$(CONFIG_SPL_BUILD) += spl.o
 
-lib-$(CONFIG_USE_PRIVATE_LIBGCC) += ashldi3.o ashrdi3.o lshrdi3.o
+lib-$(CONFIG_USE_PRIVATE_LIBGCC) += ashldi3.o ashrdi3.o lshrdi3.o udivdi3.o
diff --git a/arch/mips/lib/udivdi3.c b/arch/mips/lib/udivdi3.c
new file mode 100644 (file)
index 0000000..4d78011
--- /dev/null
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#include "libgcc.h"
+
+#if BITS_PER_LONG == 32
+
+#include <div64.h>
+
+long long __udivdi3(long long u, word_type b)
+{
+       long long ret = u;
+
+       __div64_32(&ret, b);
+       return ret;
+}
+
+#endif /* BITS_PER_LONG == 32 */