This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: overhead of bfd_{get,put}*()


From: Mike Frysinger <vapier@gentoo.org>
Date: Fri, 5 Mar 2010 14:41:56 -0500

> On Tuesday 23 February 2010 14:24:42 Joseph S. Myers wrote:
>> If you want to do unaligned accesses, you can either access byte-by-byte
>> as at present, or use memcpy to an aligned object (plus byte-swapping as
>> needed) and hope the compiler optimizes that, or use packed structures
>> (GCC-specific) (plus byte-swapping as needed).  Simply dereferencing an
>> unaligned pointer is not safe.
> 
> i dont think that has worked for a while now.  if you have a pointer with a 
> certain alignment requirement and give it to memcpy(), gcc has no problem 
> inlining the memcpy() with direct loads even if the source pointer is 
> unaligned.

That doesn't apply here, as discussed elsewhere in this thread,
because the incoming pointer is "void *" and the compiler has
therefore no type information from which to make alignment
decisions.


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