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] Non-static global variables cause relocation to fail
Date: Thu, 19 Jun 2008 13:44:21 -0500	[thread overview]
Message-ID: <485AA905.9030907@freescale.com> (raw)

I tried to find documentation on this, but couldn't.

I've discovered, on PowerPC 85xx systems at least, that the mere presence of a
non-static global variable, even if it isn't used by any code, will cause
relocation to fail.  Exactly how it fails, I can't say, but U-Boot does hang.

If I make the global variable static, the problem goes away.  Note that I have
no code that actually references the variable.  It just sits there, occupying space.

Fortunately, the data structure doesn't need to be non-static.  I just forgot to
put 'static' in its definition.  Of course, it would have been nice to know this
up front.

Can someone explain why this is the case?  Do I need to do anything special in
my code to access global variables, static or not static?

-- 
Timur Tabi
Linux kernel developer at Freescale

             reply	other threads:[~2008-06-19 18:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-19 18:44 Timur Tabi [this message]
2008-06-19 20:45 ` [U-Boot-Users] Non-static global variables cause relocation to fail Wolfgang Denk
2008-06-19 20:47   ` Timur Tabi
2008-06-19 20:52     ` Wolfgang Denk
2008-06-19 21:12       ` Timur Tabi
2008-06-19 21:55         ` Wolfgang Denk
2008-06-20  3:33     ` Jerry Van Baren
2008-06-20 14:47       ` Timur Tabi
2008-06-21  0:27         ` Wolfgang Denk
2008-06-22 17:17         ` Jerry Van Baren

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=485AA905.9030907@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