From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Thu, 19 Jun 2008 22:45:05 +0200 Subject: [U-Boot-Users] Non-static global variables cause relocation to fail In-Reply-To: Your message of "Thu, 19 Jun 2008 13:44:21 CDT." <485AA905.9030907@freescale.com> Message-ID: <20080619204505.48ABD248D2@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de In message <485AA905.9030907@freescale.com> you wrote: > 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? You don't seriously expect any real help given such a vague description? It would be somewhat helpful if you said exactly which changes cause the code to work or fail... 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 I am not now, nor have I ever been, a member of the demigodic party. -- Dennis Ritchie