[U-Boot] arm: wrong Relocation and not cleared BSS
Heiko Schocher
hs at denx.de
Sun Oct 31 08:43:44 CET 2010
Hello Alexander,
Alexander Holler wrote:
> to give the topic a better meaning and to summarize what I think is
> currently happening along with some "pictures" for a better understanding:
>
> We are starting with code (c) and data (d) somewhere in the memory:
>
> ----------
> |cd |
> ----------
>
> The relocation in start.S should achieve this:
>
> ----------
> | cd|
> ----------
Yep, and this works fine on boards, I have access(
arm1136 qong, arm926ejs tx25, suen3 arm926ejs kirkwood,
mx25 magnesium, armv7 omap3_beagle)
> That means code and data should be moved upwards. What
> currently is happening is the following:
>
> ----------
> | d c |
> ----------
really?
I posted you on 27.10.2010 in u-boot%irc.freenode.org (couldn;t
find this in the history :-( ) a log on the tx25, where this works
fine, and we came to the opinion, that you maybe have problems
with your toolchain! IIRC you use gcc-4.5x ... Alexander, did
you tried (as you thought to do) ELDK-4.2 with gcc-4.2.x ?
Are you sure your toolchain works correct with -pie?
> The code is moved upwards, but that code still uses the data at d.
> This results another problem: Some parts in the code are assuming that d
> is cleared (set to zero in start.S). But what start.S does it to clear
> the new location (z in the picture below).
>
> ----------
> | d cz|
> ----------
which is OK.
> Because the code (c) still uses the data (bss) in d and not in z, some
> hard to find errors might occur because the used data isn't set to zero
> as required.
Yep, an that is, what you(we?) have to find out, why this not works
with your toolchain!
> I have almost no knowledge about how gcc and the binutils are handling
> relocation, therfore I can't help much further here. What I think is
> part of the problem, is that -fPIC was removed. Using -pie in LDFLAGS
> might be used to get relocatable code, but the data will not be
> relocated. And I would wonder if that is possible without instructing
> the compiler to build stuff for relocation (-fPIC).
Try to find out, why -pie not works with your tollchain!
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
More information about the U-Boot
mailing list