public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Why are some global vars part of the image, and some not?
Date: Mon, 06 Nov 2006 14:21:01 -0600	[thread overview]
Message-ID: <454F992D.7010402@freescale.com> (raw)
In-Reply-To: <454F9754.8080207@smiths-aerospace.com>

Jerry Van Baren wrote:
> Scott Wood wrote:
>> Jerry Van Baren wrote:
>>> Does the linker create proper zero initialization?
>> Yes.
> 
> [snipped the rest of the "yes" answers - good to know this, thank you]
> 
>> The main things that would take effort are changing all the board linker 
>> scripts, and finding large BSS allocations and changing them to be 
>> dynamically allocated so they don't take up space in flash.
>>
>> The benefit is that bss-related bugs in the pre-RAM code go away and 
>> stay away, and that ugliness such as having to specify __attribute__ 
>> ((section ("data"))) whenever the value is zero also goes away.
>>
>> -Scott
> 
> OK, but you are trading one fixed bss-related bug in the pre-RAM code 
> for a larger u-boot image and more complexity.

No, I don't think that's accurate.

Advantages:

1) Eliminates the one (there may be more in the future) BSS-related bug
2) Eliminates the BSS initialization code
3) It's LESS complex.  I don't know why you think it's more complex.
4) Eliminates the obscure bug that could occur if you expect "int X = 0" to 
actually be 0 instead of 0xFFFFFFFF.

Disadvantes:

1) Larger U-Boot image file.
2) Larger flash storage requirements.

> Pre-RAM code is short and sweet and thus has a pretty limited 
> opportunity for bugs.  On the other hand, changing all the board linker 
> scripts takes effort and regression testing by all the board 
> maintainers.  

I agree that making the change globally would require regression testing.  For 
instance, there could be buggy code out there that depends on the BSS section 
being initialized to FF before the relocation.

> Finding large bss allocations and changing them to be 
> dynamically allocated sounds like a job that is initially large and 
> ultimately never ending.

It could be implemented as a compile-time option that would be disabled by 
default.

-- 
Timur Tabi
Linux Kernel Developer @ Freescale

  reply	other threads:[~2006-11-06 20:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-03 21:58 [U-Boot-Users] Why are some global vars part of the image, and some not? Timur Tabi
2006-11-03 22:19 ` Timur Tabi
2006-11-03 23:47   ` Wolfgang Denk
2006-11-04  0:09     ` Timur Tabi
2006-11-04  0:33       ` Wolfgang Denk
2006-11-03 23:44 ` Wolfgang Denk
2006-11-04  0:07   ` Timur Tabi
2006-11-04  0:31     ` Wolfgang Denk
2006-11-04  1:38       ` Timur Tabi
2006-11-04  2:04         ` Wolfgang Denk
2006-11-06 17:43           ` Scott Wood
2006-11-06 18:03             ` Jerry Van Baren
2006-11-06 18:08               ` Timur Tabi
2006-11-06 18:48                 ` Jerry Van Baren
2006-11-06 18:56                   ` Scott Wood
2006-11-06 19:06                     ` Jerry Van Baren
2006-11-06 19:46                       ` Scott Wood
2006-11-06 19:54                         ` Timur Tabi
2006-11-06 20:13                         ` Jerry Van Baren
2006-11-06 20:21                           ` Timur Tabi [this message]
2006-11-06 20:44                             ` Wolfgang Denk
2006-11-06 20:35                         ` Tolunay Orkun
2006-11-06 20:29                 ` Wolfgang Denk
2006-11-06 20:26             ` Wolfgang Denk
2006-11-06 20:48               ` Scott Wood
2006-11-06 21:15                 ` Wolfgang Denk

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=454F992D.7010402@freescale.com \
    --to=timur@freescale.com \
    --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