[U-Boot] Building for da830 fails

Wolfgang Denk wd at denx.de
Tue May 11 12:39:08 CEST 2010


Dear Nick,

In message <4BE91C64.9050402 at ge.com> you wrote:
>
> True, but the extra library (and abi workaround) bloat is not necessary in
> this particular case.

I agree that we can avoid the 64 bit division here - at the cost of
code that becomes much more difficult to read and understand.

Look at code like this:

+	f = size & ((1ULL << d) - 1);
...
-	if(size % d) {
-		m = (10 * (size - (n * d)) + (d / 2) ) / d;
+	if (f) {
+		m = (10ULL * f + (1 << (d - 1))) >> d;


We make things more easy for the compiler at the cost of making it
way more difficult for us humans.  I think this is a move in the wrong
direction.  Normally we try to go exactly the opposite direction.

> The proper fix is to either insist on a toolchain that supports 64bit divides,

I think we should indeed be able to rely on the tool chain providing
such functions. Of course we will try to support broken ones as far
as possible, but not there is a limit - for example, when we risk
hurting ourself.

> or avoid using features not available in all toolchains that you wish to support.

We never claimed to support "all toolchains" - for example, recent
versions of U-Boot cannot be compiled any more with gcc-2.95.x - but
is this really an issue?  I don't think so.

> In the later case, rewriting the function would be a good idea wouldn't it?

I am not really convinced.  Readability and maintainability are
precious properties of code.

> The eabi stub you submitted is only good as long as C++ and exceptions are not
> used by U-Boot. Exceptions in particular are a powerful way to clean up error
> handling code - can we ever say never?

No, we cannot. But we do :-)


<asbestos underwear>

Here we go:

We will never use C++ code for the implementation of U-Boot.

</asbestos underwear>

:-)

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
To program is to be.


More information about the U-Boot mailing list