[U-Boot-Users] Relocation of symbols?

Wolfgang Denk wd at denx.de
Tue Jun 28 16:01:56 CEST 2005


In message <CNLTR94IEOA0NLOJC7FCATQTQJGRO.42c14780 at pc-block> you wrote:
> 
> Just to summerize:
> 1. Absolute symbols are always relocated (my mail: "Does u-boot relocate absolute 
> symbols?", 14.06.2005).

I don't think so. An absolute symbol is, ummm, absolute.

> 2. Statically initialized pointers are never relocated.

Right.

> 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.

We don't lose anything. The compiler /  linker  never  has  any  such
information.

For example, asssume we  have  three  pointers  that  are  statically
initialized.  One  is  initialized  with the physical address of some
peripheral on your board, the  second  one  with  the  address  of  a
function  in  the  U-Boot  code,  and the third one with the constant
0x12345678;

For GCC all three of them are just initialized pointers.  Who  should
decide which of these need relocation, and which not?

> 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 

I can't parse this.

I don't think  that  GCC/gas  will  normally  generate  any  absolute
symbols  at all. If you manually define such symbols you are expected
to understand what you are doing.

> 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?

I mentioned the simple solution before: either you  avoid  statically
initialized  function  pointers  (for  examply  by initializing these
dynamically after relocation), of you manually adjust  your  pointers
after  relocation,  like  we  do for example for the command table. I
also mentioned that there may be ways (like putting your stuff  in  a
special segment and taking care to relocate this) to handle this, but
I don't have a solution ready, nor do I see an urgent need for it.

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
Ever try. Ever fail. No matter. Try again. Fail again.  Fail  better.
                                                        -- S. Beckett




More information about the U-Boot mailing list