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

Andreas Block andreas.block at esd-electronics.com
Thu Jun 30 13:42:57 CEST 2005


30.06.2005 12:46:34, Wolfgang Denk <wd at denx.de> wrote:

>In message <NJF2NIMJ61Z631T0787IG4284GAA7.42c3a2fd at pc-block> you wrote:
>> 
>> Sure, I've tried this. This is the point, where my problem arose. Attached you find
>> two small files, you can easily compile under linux (gcc -o arrtest -I ./ ./common.c 
>> ./array.c). The file "common.c" represents the code I can't (don't want to) touch. 
>
>This example does not demonstrate  anything.  Of  course  a  standard
>application  code  example in a Linux environment will not work. Also
>you example code seems to show a different situation that you claimed
>to have.
>

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.


>> "array.c" represents my project dependent code. If you run arrtest it will show to 
>> you, that it is not possible to initialize the array "test" in this manner. After 
>> looking at the disassembly, it is pretty clear, that the compiler has to generate 
>> different code for the two notations.
>
>Remember that in U-Boot you can:
>
>1) play tricks with the linker script
>2) play tricks in your board specific configuration file  which  gets
>   included everwhere
>
>For example, you can can re-#define the variables (like  "walter"  in
>your example) to use a different name and/or to include some trickery
>like  "__attribute__  ((section("???")))"  stuff  to place this array
>into a special section which then  gets  treated  specially  in  your
>linker script, etc.

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


>This is U-Boot, and you have *full* control over what you are  doing,
>which is very unlike compared to a standard Linux application example
>-  you  are comparing apples and bananas here (they have one thing in
>common, though: I like them both :-).

I didn't want to compare U-Boot to Linux, but simply explain a peculiarity of C-
language. This stands inside U-Boot as well as inside Linux as well as nearly anywhere 
else, which is programmable in C.

Now, having read your second reply to this thread (from 13:09), I'm quite sure, that I 
need a lds-guru, to get me any further.
To close this thread, I'd like to ask the questions, which started this thread, again 
and I would like you to answer as short and precise as possible:

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

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

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.

2a) s. 1a)
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...

Best regards,
Andreas Block








More information about the U-Boot mailing list