This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Re: [patch] handle unaligned arm abs relocs
- From: Richard Henderson <rth at twiddle dot net>
- To: Carlos O'Donell <carlos_odonell at mentor dot com>
- Cc: Mike Frysinger <vapier at gentoo dot org>, libc-ports at sourceware dot org
- Date: Thu, 15 Dec 2011 09:48:20 -0800
- Subject: Re: [patch] handle unaligned arm abs relocs
- References: <201112121920.17908.vapier@gentoo.org> <4EE91DA5.90807@mentor.com>
On 12/14/2011 02:05 PM, Carlos O'Donell wrote:
> You might be lucky and get an inlined memcpy or builtin, but you
> might not and if you go through the PLT you'll fault since
> it's not yet setup.
>
> On PARISC we do a byte copy of unaligned relocation.
>
> e.g.
> /* .eh_frame can have unaligned relocs. */
> if ((unsigned long) reloc_addr_arg & 3)
> {
> char *rel_addr = (char *) reloc_addr_arg;
> rel_addr[0] = value >> 24;
> rel_addr[1] = value >> 16;
> rel_addr[2] = value >> 8;
> rel_addr[3] = value;
> return;
> }
Let the compiler do that for you.
struct S { int x; } __attribute__((packed, may_alias));
void f(int *x, int y)
{
((struct S *)x)->x = y;
}
In particular, this will Know that armv[4-6] needs byte-by-byte copy
and armv7 does not.
r~