[U-Boot-Users] Does u-boot relocate absolute symbols?

Wolfgang Denk wd at denx.de
Thu Jun 30 14:40:10 CEST 2005

In message <S6Z4ZJE2ZD9OKTKIA9EBQPNIHC652U.42c3dac1 at pc-block> you wrote:
> Hmm? This example was sent to Rune Torgersen in order to show him, that "char *bla" 
> isn't the same as "char bli[]", so I'm not sure, why it doesn't explain anything.

I think most of us are aware of the differences between a pointer and
an array, but this is not your point. Your problem was how you  could
keep  existing  code (which uses an array, as I understand), and both
Rune and me said that the existing difference might be worked  around
one way or another.

> Thanks, I'll take a deeper look into this, but actually I thought, I had already 
> generated an absolute symbol (with those small assembly lines), which obviously isn't 
> treated as an absolute symbol by the linker script (or U-Boot?).

I think that "absolute symbol" does not work as you expect it to work
when it comes to relocation.  I  don't  know  enough  of  the  linker
internals  to  make  a  definitive  statement  if this is an issue of
misunderstanding, or an error in the use of the  linker  (i.  e.  the
linker script), or the linker itself.

> 1) Is U-Boot supposed to relocate absolute symbols located in any objects, that are 
> linked against it?

U-Boot doesn't know anything about any symbols. It just walsk the GOT
and adjusts the addresses it finds there.

> 1a) If not, would you be interested in a patch for U-Boot? (For me, I will be able to 
> live with my workaround and putting any effort into it, pays only, if these changes 
> make their way into the U-Boot tree.)

In my understanding you want to find a way  that  "absolute  symbols"
(and  eventually staticlaly initialized function pointers, too ?) get
relocated correctly. Of course I will accept patches that improve the
current code.

> 2) Is it correct, that the linker script creates relocation tags inside of .text-
> segments, only? Which would lead to the observed behaviour, that statically initialized 
> pointers, which normnally result in relocation tags in .data segments, aren't 
> relocated.

No, this is not correct. You can access variables  in  data  and  bss
segments  after relocation, so it's obvious that these got relocated,

> 2b) If 2a) is yes, can you estimate, how many code-pieces needed a rewrite, in case 
> this would be fixed (of course all manual relocation points wouldn't be needed 
> anymore)? Only estimate, just to get a thought, if it's a hand full, hundreds or 
> thousands...

A handfull. All this is pretty concentrated in one place.

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
"I didn't know it was impossible when I did it."

More information about the U-Boot mailing list