This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] handle unaligned arm abs relocs


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]