public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Carlos O'Donell <carlos_odonell@mentor.com>
Cc: Mike Frysinger <vapier@gentoo.org>, libc-ports@sourceware.org
Subject: Re: [patch] handle unaligned arm abs relocs
Date: Thu, 15 Dec 2011 17:48:00 -0000	[thread overview]
Message-ID: <4EEA32E4.7010307@twiddle.net> (raw)
In-Reply-To: <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~

  parent reply	other threads:[~2011-12-15 17:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-13  0:20 Mike Frysinger
2011-12-14 22:05 ` Carlos O'Donell
2011-12-14 22:29   ` Mike Frysinger
2011-12-14 22:44     ` Carlos O'Donell
2011-12-15 17:48   ` Richard Henderson [this message]
2011-12-19 17:45 ` Joseph S. Myers
2011-12-19 18:27   ` Mike Frysinger
2011-12-19 19:57     ` Joseph S. Myers
2012-08-12  5:50 ` [PATCH v2] arm: handle unaligned ABS relocs Mike Frysinger
2012-08-12 13:01   ` Joseph S. Myers
2012-08-12 14:35     ` Mike Frysinger
2012-08-12 15:55       ` Joseph S. Myers
2012-08-12 18:51         ` Mike Frysinger
2012-08-12 13:26   ` Carlos O'Donell
2012-08-12 14:05     ` Andreas Schwab
2012-08-12 15:57     ` Joseph S. Myers
2012-08-14 21:49   ` Roland McGrath
2012-08-15  1:38     ` Mike Frysinger

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=4EEA32E4.7010307@twiddle.net \
    --to=rth@twiddle.net \
    --cc=carlos_odonell@mentor.com \
    --cc=libc-ports@sourceware.org \
    --cc=vapier@gentoo.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 read-only IMAP folder(s) and NNTP newsgroup(s).