overhead of bfd_{get,put}*()
David Miller
davem@davemloft.net
Tue Feb 23 22:38:00 GMT 2010
From: "Joseph S. Myers" <joseph@codesourcery.com>
Date: Tue, 23 Feb 2010 19:24:42 +0000 (UTC)
> 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.
Yes, that works if you do something like use a type with the
'packed' attribute or similar for the unaligned thing. But
as the code stands now the object pointer is of type "void *"
so the compiler can't tell anything about the object size or
alignment.
More information about the Binutils
mailing list