From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: TCM memory bug on newer compilers
Date: Tue, 25 May 2010 21:16:32 +0100 [thread overview]
Message-ID: <20100525201632.GC16204@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1274805947-414-1-git-send-email-linus.walleij@stericsson.com>
On Tue, May 25, 2010 at 06:45:47PM +0200, Linus Walleij wrote:
> Apparently newer compilers don't like you to refer to linker
> symbols as extern char *foo, we must use char foo and refer to
> the address of the char instead.
afaik, that's always been the case.
Let's take an example. Location 0x1234 contains value 0x89abcdef.
The symbol __tcm_start has the address of 0x1234.
Now:
extern char *__tcm_start;
declares a pointer to a char. The address of the __tcm_start storage
will be 0x1234. The value of __tcm_start will be 0x89abcdef - and
this is the value that would be passed to __pa(__tcm_start). The
value of __tcm_start[0] is whatever is stored at the address
0x89abcdef.
extern char __tcm_start[];
declares an array of char. The address of the __tcm_start storage will
be 0x1234. The value of __tcm_start is in this case defined to be the
same as the value of a pointer to the first element - so 0x1234.
The value of __tcm_start[0] will be whatever is stored at 0x1234, and in
LE that will be 0xef.
extern char __tcm_start;
declares a single char. The address of the __tcm_start storage will be
0x1234. The value of __tcm_start is the value at this address, and
still assuming LE, 0xef.
So, either use:
extern char __tcm_start;
pa_start = __pa(&__tcm_start);
or:
extern char __tcm_start[];
pa_start = __pa(__tcm_start);
which reveal the same answer. However, this will give you something
completely different:
extern char *__tcm_start;
pa_start = __pa(__tcm_start);
next prev parent reply other threads:[~2010-05-25 20:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-25 16:45 [PATCH] ARM: TCM memory bug on newer compilers Linus Walleij
2010-05-25 20:16 ` Russell King - ARM Linux [this message]
2010-05-26 6:23 ` Linus WALLEIJ
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=20100525201632.GC16204@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).