diff -Naur elfutils-0.155.orig/configure.ac elfutils-0.155/configure.ac --- elfutils-0.155.orig/configure.ac 2013-01-26 16:27:55.000000000 -0500 +++ elfutils-0.155/configure.ac 2013-01-26 16:32:15.000000000 -0500 @@ -278,6 +278,9 @@ AC_DEFINE([USE_DEMANGLE], [1], [Defined if demangling is enabled])]) AM_CONDITIONAL(DEMANGLE, test "$ac_cv_lib_stdcpp___cxa_demangle" = yes) +dnl Check for __mempcpy +AC_CHECK_FUNCS_ONCE([__mempcpy]) + dnl The directories with content. dnl Documentation. --- elfutils-0.155.orig/libelf/elf_begin.c 2013-01-26 16:27:55.000000000 -0500 +++ elfutils-0.155/libelf/elf_begin.c 2013-01-26 16:39:21.000000000 -0500 @@ -801,7 +801,11 @@ } /* Copy the raw name over to a NUL terminated buffer. */ +#ifdef HAVE___MEMPCPY *((char *) __mempcpy (elf->state.ar.raw_name, ar_hdr->ar_name, 16)) = '\0'; +#else + *((char *) mempcpy (elf->state.ar.raw_name, ar_hdr->ar_name, 16)) = '\0'; +#endif elf_ar_hdr = &elf->state.ar.elf_ar_hdr; @@ -890,6 +894,7 @@ filled in which case we cannot simply use atol/l but instead have to create a temporary copy. */ +#ifdef HAVE___MEMPCPY #define INT_FIELD(FIELD) \ do \ { \ @@ -907,6 +912,25 @@ elf_ar_hdr->FIELD = (__typeof (elf_ar_hdr->FIELD)) atoll (string); \ } \ while (0) +#else +#define INT_FIELD(FIELD) \ + do \ + { \ + char buf[sizeof (ar_hdr->FIELD) + 1]; \ + const char *string = ar_hdr->FIELD; \ + if (ar_hdr->FIELD[sizeof (ar_hdr->FIELD) - 1] != ' ') \ + { \ + *((char *) mempcpy (buf, ar_hdr->FIELD, sizeof (ar_hdr->FIELD))) \ + = '\0'; \ + string = buf; \ + } \ + if (sizeof (elf_ar_hdr->FIELD) <= sizeof (long int)) \ + elf_ar_hdr->FIELD = (__typeof (elf_ar_hdr->FIELD)) atol (string); \ + else \ + elf_ar_hdr->FIELD = (__typeof (elf_ar_hdr->FIELD)) atoll (string); \ + } \ + while (0) +#endif INT_FIELD (ar_date); INT_FIELD (ar_uid);