public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: J. William Campbell <jwilliamcampbell@comcast.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 0/2] Make sure 85xx bss doesn't start at 0x0
Date: Wed, 07 Oct 2009 07:37:54 -0700	[thread overview]
Message-ID: <4ACCA7C2.7050402@comcast.net> (raw)
In-Reply-To: <OFAD5DB485.D99E97C9-ONC1257648.00397289-C1257648.0039E8C4@transmode.se>

Joakim Tjernlund wrote:
>> On Wed, Oct 7, 2009 at 5:55 PM, Wolfgang Denk <wd@denx.de> wrote:
>>     
>>> Dear Graeme Russ,
>>>
>>> In message <d66caabb0910061824s4165d33bu5d5213f6783c09d0@mail.gmail.com> you wrote:
>>>       
>>>> I think that even the -mrelocatable / .fixup method may not be needed at
>>>> all. -pie / -pic used by themselves creates enough information for an OS
>>>> dynamic loader to relocate an executable, so why not U-Boot? Given that
>>>> the type and location of each section is easily determined, a striped
>>>> down dynamic loader can provide a platform-independent relocation scheme.
>>>>         
>>> One reason for not using ELF images for the boot loader is size. The
>>> ELF header alone is often more than we would be willing to accept, not
>>> to mention the additional code.
>>>
>>>       
>> But the headers get stripped from the final binary. All we are left with in
>> order to locate the ELF section data are the symbols exported from the
>> linker script
>>
>> The extra code is only three very tight for-loops. I had them wrapped in
>> functions to improve readability, but they are good inline candidates (only
>> called once each) and I doubt they use much code space at all (I'll send
>> through actual numbers soon)
>>     
>
> But how much space in the extra sections you link in?
>
> if size is comparable with fixup ptrs we should probably
> consider using the same for ppc. Then we can use -fpic/-fpie and
> that is significantly smaller then -fPIC on PPC.
>
>   
>> Question is, does -mrelocatable result in smaller .got (et al) are is the
>> .fixup section adding extra size for the sake of ease of implementation?
>>     
>
> fixup section expands with lots of ptrs, then fixup is placed just after .got
>
>
>   
There is also a trade-off in using the -mrelocatable / .fixup method 
that should be considered in the general case. -fPIC or even -fpic code 
is almost always larger than the code generated for -mrelocateable, so 
it it the final size of the object blob in prom that matters, not just 
the length of the fixup segment. This effect is architecture dependent, 
where PIC is much cheaper on a PPC than on an Intel 386. So the "best" 
combination may depend on the chip.
I would also strongly encourage the -mrelocateable method be always 
available as an option. Historically, -fPIC has been buggy in initial 
releases of GCC for new architectures, probably because you can do 
useful work with just relocateable code and PIC can come "later". So it 
may be that u-boot would need an -mrelocateable approach for some period 
until -fPIC/-fpic worked. In any case, it would be a good fallback if 
one suspected a bug in PIC.

Best Regards,
Bill Campbell

  reply	other threads:[~2009-10-07 14:37 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-05 23:01 [U-Boot] [PATCH 0/2] Make sure 85xx bss doesn't start at 0x0 Peter Tyser
2009-10-05 23:01 ` [U-Boot] [PATCH 1/2] 85xx: Preprocess link scripts Peter Tyser
2009-10-06  7:28   ` Wolfgang Denk
2009-10-06 11:13     ` Peter Tyser
2009-10-05 23:01 ` [U-Boot] [PATCH 2/2] 85xx: Ensure BSS segment doesn't start at address 0x0 Peter Tyser
2009-10-06  8:54   ` Wolfgang Denk
2009-10-06 12:10     ` Peter Tyser
2009-10-06  7:32 ` [U-Boot] [PATCH 0/2] Make sure 85xx bss doesn't start at 0x0 Wolfgang Denk
2009-10-06 12:01   ` Peter Tyser
2009-10-06 14:01     ` Wolfgang Denk
2009-10-06 14:07       ` Kumar Gala
2009-10-06 14:24         ` Peter Tyser
2009-10-06 15:22           ` Wolfgang Denk
2009-10-06 15:45             ` Peter Tyser
2009-10-06 17:51               ` Wolfgang Denk
2009-10-06 18:08                 ` Peter Tyser
2009-10-06 20:34                   ` J. William Campbell
2009-10-06 20:53                     ` Peter Tyser
2009-10-06 22:34                       ` J. William Campbell
2009-10-06 23:10                         ` Peter Tyser
2009-10-06 23:25                           ` Wolfgang Denk
2009-10-06 23:43                             ` Peter Tyser
2009-10-07  0:09                               ` Peter Tyser
2009-10-07  1:24                                 ` Graeme Russ
2009-10-07  6:55                                   ` Wolfgang Denk
2009-10-07  9:56                                     ` Graeme Russ
2009-10-07 10:07                                       ` Graeme Russ
2009-10-07 10:32                                       ` Joakim Tjernlund
2009-10-07 14:37                                         ` J. William Campbell [this message]
2009-10-07  6:53                               ` Wolfgang Denk
2009-10-07 11:57                                 ` Peter Tyser
2009-10-07 12:19                                   ` Wolfgang Denk
2009-10-06 23:07                       ` Wolfgang Denk
2009-10-06 23:29                         ` Peter Tyser
2009-10-07  6:51                           ` Wolfgang Denk
2009-10-06 20:46                   ` Kumar Gala
2009-10-06 21:13                     ` Peter Tyser
2009-10-06 16:53             ` Stefan Roese
2009-10-06 15:04         ` Wolfgang Denk
2009-10-06 15:20           ` Peter Tyser

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=4ACCA7C2.7050402@comcast.net \
    --to=jwilliamcampbell@comcast.net \
    --cc=u-boot@lists.denx.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