mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: w.sang@pengutronix.de
Cc: barebox@lists.infradead.org
Subject: [PATCH] lib: libubigen math compile error fix
Date: Mon,  6 Jan 2014 09:25:10 +0100	[thread overview]
Message-ID: <1388996710-991-1-git-send-email-robert.jarzmik@free.fr> (raw)

A compile error appears in libubigen on PXA architecture, because of a
division of an long long by a int :
/home/rj/mio_linux/barebox/lib/libubigen.c:105: undefined reference to
`__aeabi_ldivmod' arm-linux-gnueabi-ld: BFD (GNU Binutils for Debian)
2.20.1.20100303 assertion fail ../../bfd/elf32-arm.c:12497

Fix it by using div_u64 instead.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 lib/libubigen.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/libubigen.c b/lib/libubigen.c
index 4026f1d..9006329 100644
--- a/lib/libubigen.c
+++ b/lib/libubigen.c
@@ -29,6 +29,7 @@
 #include <errno.h>
 #include <crc.h>
 #include <fs.h>
+#include <linux/math64.h>
 
 #include <mtd/utils.h>
 #include <mtd/ubi-media.h>
@@ -102,7 +103,7 @@ int ubigen_add_volume(const struct ubigen_info *ui,
 	}
 
 	memset(vtbl_rec, 0, sizeof(struct ubi_vtbl_record));
-	tmp = (vi->bytes + ui->leb_size - 1) / ui->leb_size;
+	tmp = div_u64(vi->bytes + ui->leb_size - 1, ui->leb_size);
 	vtbl_rec->reserved_pebs = cpu_to_be32(tmp);
 	vtbl_rec->alignment = cpu_to_be32(vi->alignment);
 	vtbl_rec->vol_type = vi->type;
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2014-01-06  8:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-06  8:25 Robert Jarzmik [this message]
2014-01-06  9:58 ` Sascha Hauer

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=1388996710-991-1-git-send-email-robert.jarzmik@free.fr \
    --to=robert.jarzmik@free.fr \
    --cc=barebox@lists.infradead.org \
    --cc=w.sang@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox