
Hello Wolfgang,
thanks for your quick reply.
27.06.2005 15:40:25, Wolfgang Denk wd@denx.de wrote:
Dear Andreas,
[cut...]
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.
I'm not quite sure, if I understood you. Just to summerize: 1. Absolute symbols are always relocated (my mail: "Does u-boot relocate absolute symbols?", 14.06.2005). 2. Statically initialized pointers are never relocated.
I do understand the second point (and can live with this behaviour), but I'd like to know, where you loose the required information to relocate the pointers as well. The first point is more important to me. As I understand, absolute symbols shouldn't be relocated at all. But I guess, you've a similar reason as for the statically initialized pointers. Anyway: Is it possible in any way to locate the array at the position I want it to be? Or the other way round: Is it as difficult to prevent absolute symbols from being added to the GOT as adding something?
Regards, Andreas
Best regards,
Wolfgang Denk
-- Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@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_