
Dear Andreas,
in message 3YJEA6HGSNLF3264765ZTQSQYSRNJI43.42bffa31@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