[U-Boot-Users] Relocation of symbols?

Wolfgang Denk wd at denx.de
Mon Jun 27 15:40:25 CEST 2005


Dear Andreas,

in message <3YJEA6HGSNLF3264765ZTQSQYSRNJI43.42bffa31 at pc-block> you wrote:
> 
> I've posted another question regarding this topic on 14th June 2005. Since I haven't 
> received any answers, I'm unsure, if I'm in the correct mailinglist or if my problem 
> was that trivial. In case of the latter one, please, give me a hint, where to post my 
> questions instead.

You are on the right list here.

It's just that not many people really understand all the details  how
the relocation works.

> The u-boot boots from flash and relocates itself into RAM. After relocation the array 
> is relocated into RAM and so is its content (the pointers to strings). But the actual 
> strings are still located in flash. "walter" is a global symbol located in ".data" 
> section of the compiled object. Is this the behaviour I should expect, or is it a 
> problem with u-boots relocation code?

If you look at the code, then you  will  find  that  the  same  thing
happens  to  all  pointers with static initialization. If you think a
bit about it you will probably be not  surprised  -  how  should  the
compiler  know  that  the addresses of your strings might change? and
after the compiler generated code with a  static  initializer  -  who
should  then know that the contents of this variable might need to be
relocated?

See for example how we manually adjust (= relocate) the command table
and other pointer constants in board_init_r().

I guess you can probably tell  GCC  to  add  GOT  entries  for  these
pointers,  but  I have to admit that I don't know off-hand what's the
most efficient way.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
He had quite a powerful intellect, but it  was  as  powerful  like  a
locomotive,  and  ran on rails and was therefore almost impossible to
steer.                          - Terry Pratchett, _Lords and Ladies_




More information about the U-Boot mailing list