public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Andreas Block <andreas.block@esd-electronics.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Does u-boot relocate absolute symbols?
Date: Fri, 01 Jul 2005 17:06:26 +0200	[thread overview]
Message-ID: <op.ss8pk0hu8n9ctc@pc-block.esd> (raw)
In-Reply-To: <42C554C5.6090205@smiths-aerospace.com>

Hi Jerry,

thanks for your time.

On Fri, 01 Jul 2005 16:35:49 +0200, Jerry Van Baren  
<gerald.vanbaren@smiths-aerospace.com> wrote:

> I ran the code you (Andreas) sent, with the one correction for the
> printf().  The code you sent did not set the test array pointer to
> 0x40000.

I did look at the code, I had sent originally (with the typo you proposed)  
and in line 3 of array.c *test is initialized to 0x40000. I was writing  
big time nonsens that morning, but I wasn't that bad.


>  When I use the code you _ment_ rather than what you _sent_
> (see below - sorry for top-quoting), I get the same effect you get:
>
> vanbaren at sherwood:~/x> ./arrtest
> *test: 0x08048558
> test[]: 0x08048558
>
> vanbaren at sherwood:~/x> ./arrtest-ptr
> *test: 0x00040000
> test[]: 0x08048558
>
> I think I now understand the root of your problem.  You want to place an
> initialized array at a specific location.  C has a way of initializing
> arrays:
>    const unsigned char test[] = { value... };
> and a way of making a pointer to an array:
>    const unsigned char *test = (unsigned char*)0x40000;
> but it doesn't have a way to do _both_ at the same time.  You are trying
> to avoid the need for two initializations in one declaration limitation
> by doing it _differently_ in _two_ different places.  This is confusing
> the compiler and/or the linker.

As I already said, this is no bug in the compiler nor the linker. It is  
C-language and this example isn't supposed to work. It's just to show a  
peculiarity of C-language (or better a peculiarity of how most people  
(incl. me) understand C-language). It took me some time to realize, but I  
realized _before_ posting here. Your suggestion again ends up with changes  
in common.h, which is the only thing I'd like to avoid. Don't get me  
wrong, thanks for the time you've invested in order to help me. But I had  
a workaround (with changes in common code) running, before I posted the  
first time.


> I would guess this is a compiler/linker interaction that could be
> labeled unfortunate lack of communications or a bug, depending on your
> frustration level for the day.
> [...]
> You still may have to resolve relocation issues, depending on where you
> locate the resulting array data and whether it gets copied and whether
> it is available in the ROM location, but that is a red herring at this
> point.

The entire discussion is more about, should/could be something changed in  
U-Boot/linker script in order to make relocation somewhat more  
consistent/generic/orthogonal.

Best regards,
Andreas Block

  reply	other threads:[~2005-07-01 15:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-01  7:57 [U-Boot-Users] Does u-boot relocate absolute symbols? Andreas Block
2005-07-01 14:35 ` Jerry Van Baren
2005-07-01 15:06   ` Andreas Block [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-07-01  8:01 Andreas Block
2005-06-30 16:54 Rune Torgersen
2005-06-30 17:28 ` Jerry Van Baren
2005-06-29 15:46 Rune Torgersen
2005-06-30  7:45 ` Andreas Block
2005-06-30 10:46   ` Wolfgang Denk
2005-06-30 11:42     ` Andreas Block
2005-06-30 12:40       ` Wolfgang Denk
2005-06-30 13:38         ` Andreas Block
2005-06-30 12:05   ` Jerry Van Baren
2005-06-30 12:44     ` Andreas Block
2005-06-14  9:47 Andreas Block

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op.ss8pk0hu8n9ctc@pc-block.esd \
    --to=andreas.block@esd-electronics.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox