[Balloon] Re: balloon bootldr gcc 3 considerations

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Wookey
Date:  
To: Balloon-dev
Subject: [Balloon] Re: balloon bootldr gcc 3 considerations
+++ Colin Tuckley [06-03-10 08:35 +0000]:
> I spent quite a bit of time yesterday working out what was going on when
> using gcc 3.3 to compile bootldr.


This discussion should probably be on-list. at least on balloon-dev if you
think it is too esoteric for balloon.

> Since this has ramifications for Balloon 3 can I ask all 4 of you to please
> comment on the things below.
>
> 1) I'm going to be doing a major clean up of the bootldr code at some point
> in the future and if I don't hear anything I'm going to remove pretty much
> *everything* that is not used or explicitly to do with Balloons.


Seems sensible, although if there is code for booting from pcmcia
CF/ethernet, or USB then that might be worth keeping around for someone to
target to the balloon hardware (so we could do netbooting).

> 2) After working through all the various options used in the Makefile the
> following has come to light:
>
> a) -UBOOT_SILENT gets added to the compiler options. A grep for this shows
> that it is only referenced once in boot-sa1100.s so why is it *unset* when
> we never set it? or is this just a hangover from something which got
> removed. There are other options in a similar situation what should we do in
> the general case?
>
> b) -mshort-load-words is set, this is a deprecated alias for
> -mno-alignment-traps which does nothing on ARMv4 and later processors, I've
> removed it.


I not quite sure this actually does _nothing_ on ARMv4 or later, but I agree
it shouldn't be needed and getting rid of it shouldn't make any difference.
It was essentially a hack so that riscPCs would work properly (armv4 with no
halfword loads)

> c) both -fPIC and -fpic were being added to the options for CC, these do
> subtly different things, which should we be using? not both since they
> actually conflict I think.


Presumably they don't fundamentally conflict otherwise gcc would have
complained or produced code that didn't work. The gcc docs suggest that on
arm fpic and fPIC are equivalent. - the diffeence is only the size of the
Global offset table used, which can be extended on some arches.

> 3) This is probably the most important one, my problems with odd-ball things
> happening due to initialised variables not getting set appear to be due to
> the different optimisations done by gcc 2.95 and gcc 3.3 when the -O (-O1)
> option is set.
>
> If I set -O0 (optimisation off) then things work properly. I'm still
> investigating whats actually happening, but so far it looks like gcc 3.3
> includes a lot more optimisation at level 1. The man page mentions 18 flags
> that get turned on in gcc 3.3 at level 1 vs only 4 in gcc 2.95
>
> Is it worth trying to find out which flag is causing the problem and then
> trying to find and fix the bit of code or turn that option off individually?
> Or should we just run bootldr with no optimisation?


The bootloader doesn't have to run more than once each boot so is not
speed-critical in that sense. We do like it to take as
little time as possible to load things, but unless -O0 is obvioulsy slower
(time a boot with a watch), then I think just turn it off.

Wookey
-- 
Aleph One Ltd, Bottisham, CAMBRIDGE, CB5 9BA, UK  Tel +44 (0) 1223 811679
work: http://www.aleph1.co.uk/     play: http://www.chaos.org.uk/~wookey/