This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFA:] Caveat for ARM in gcc-4.7/changes.html: unaligned accesses
- From: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- To: michael dot hope at linaro dot org
- Cc: gcc-patches at gcc dot gnu dot org, richard dot earnshaw at arm dot com
- Date: Tue, 12 Jun 2012 16:32:24 +0200
- Subject: Re: [RFA:] Caveat for ARM in gcc-4.7/changes.html: unaligned accesses
> From: Hans-Peter Nilsson <hp@axis.com>
> Date: Mon, 11 Jun 2012 00:59:57 +0200
> > From: Michael Hope <michael.hope@linaro.org>
> > Date: Mon, 11 Jun 2012 00:04:19 +0200
>
> > On 8 June 2012 16:53, Hans-Peter Nilsson <hans-peter.nilsson@axis.com> wrote:
> > >> From: Hans-Peter Nilsson <hp@axis.com>
> > >> Date: Fri, 8 Jun 2012 06:29:04 +0200
> > >
> > >> > From: Michael Hope <michael.hope@linaro.org>
> > >> > Date: Fri, 8 Jun 2012 05:50:52 +0200
> > >> > ?The combination of
> > >> > older Linux ARM kernels and GCC 4.7 gives a faulty kernel.
> > >>
> > >> We're in agreement!
> > >
> > > Oh wait sorry, my bad, I misread. ?Instead of "gives a faulty
> > > kernel", I'd say "for ARMv6 and later (not -M), gives faulty
> > > user-space code". ?Maybe the kernel too, I can't say; there was
> > > IIRC no sign of it.
But (at least) after removing some local changed defaults,
there's at boot-time a lot of:
[ 0.950000] Unhandled fault: alignment exception (0x801) at 0xc821ddee
> > Is there a bugzilla ticket logged for this? I'd like to try to reproduce it.
Here's a shorter case I'll attach to a PR for this unless it
gets resolved one way or another soonish. Remember, you'll have
to run this on a pre-3.2 kernel with CONFIG_ALIGNMENT_TRAP on
(the default) and you have to compile for ARM v6 or later (as in
-march=armv6). Using gcc-4.7.1-rc1 should do, most likely
earlier revisions too.
__attribute__ ((__noinline__, __noclone__))
void doit(char *x)
{
asm ("");
__builtin_strcpy (x, "stat");
}
int main(void)
{
char x[30];
doit(x + 1);
doit(x);
__builtin_exit (0);
}
> > It's interesting as we backported the patch into the Linaro GCC that
> > was used to build Ubuntu Precise and didn't find any faults.
I have no idea why you didn't run into this, unless it was one
of the obvious reasons: not building for ARM v6 or the kernel
was 3.2 or later, or configured with CONFIG_ALIGNMENT_TRAP off.
Or other local patches of yours.
brgds, H-P