bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ld 2.11: unaligned memory access for unions


From: Eberhard Mattes
Subject: ld 2.11: unaligned memory access for unions
Date: Thu, 14 Jun 2001 22:09:14 +0200 (MET DST)

peigen.c of binutils 2.11 does this:

      memcpy (in->_n._n_name, ext->e.e_name, SYMNMLEN);

where IN and EXT may be unaligned pointer unions containing a word (in
members different from those used above).  GCC assumes that the
pointers are aligned (according to the word size) and generates inline
code which copies word by word.  Of course, this fails on machines
which don't support unaligned access to words.

Here's a quick and dirty fix for this problem (add near the beginning
of peigen.c):

------------------------------------------------------------------------------
void xmemcpy (void *dst, const void *src, size_t n)
{
  memcpy (dst, src, n);
}
#define memcpy xmemcpy
------------------------------------------------------------------------------

-- 
  Eberhard Mattes




reply via email to

[Prev in Thread] Current Thread [Next in Thread]