[U-Boot-Users] Relocation of symbols?

Wolfgang Denk wd at denx.de
Tue Jun 28 17:21:35 CEST 2005


In message <85W32HGVT4WOKE0XT1Y1XVTND0OM74.42c15f80 at pc-block> you wrote:
> 
> Well, then I don't get it. Perhaps you could have a look at my mail referenced above. 
> There's an example of U-Boot relocating an absolute symbol.

I didn't see it. You claimed that there was an absolute symbol in  an
object  file, but I have not seen the result of the linker run (i. e.
the U-Boot ELF file, the System.map file or the u-boot.map file); nor
do I know what you are doing in your linker script.

Is your symbol "fpgadata" really listed in the GOT?

You mentioned that it contains a bad value, but did you  verify  that
this  was indeed casued by relocation (i. e. was the value really off
by the relocation distance) ?

> Well, I think there has to be a difference for the compiler in the next two cases:
> 
> char *walter = 0x4711;
> char *herbert = "Thommy, the cat";

No. There may be a difference for you, or for the resultof  the  code
execution,  but  for  the  compiler  it's all the same. AFAIK the ESP
module of GCC has not been implemented yet :-)

> The first one shouldn't be relocated by the compiler, but the last one has to be 
> relocated, in order to make the program work. At least as far as I understand it, 
> please correct me, if I'm wrong.

The _compiler_ does not do any relocation at  all.  He  doesn't  even
know that such a thing exists. For the _compiler_ a pointer is just a
pointer, in no way more special than an int.

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

The emphasis is on "understand".

> Again, I'd like to reference my above mentioned first request from 14.06.2005. I think, 
> I know what I'm doing and what I want to do, but the generated absolute symbol is 
> relocated by U-Boot.

You know what you  did,  but  you  posted  here  because  you  didn't
understand  the  results,  right?  I don't understand it either, so I
tend to avoid doing such things ;-)

> Thanks for your suggestions, but my main problem is I'm not wanting to change any 
> common code and want to solve my problem in the problem specific code.


I really don't understand why you need to statically  intialize  this
pointer  at  all,  or why you bother about it being relocated or not.
You mentioned that this is an address to where the code is downloaded
by TFTP first. So you will have to set up a  TFTP  transfer  and  all
these  things  - so the address in RAM should be known. Why don't you
simply use a plain assignment in your code, then?

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
Making files is easy under  the  UNIX  operating  system.  Therefore,
users  tend  to  create  numerous  files  using large amounts of file
space. It has been said that the only standard thing about  all  UNIX
systems  is  the  message-of-the-day  telling users to clean up their
files.                             - System V.2 administrator's guide




More information about the U-Boot mailing list