From: Ulf Hermann Date: Thu, 16 Feb 2017 09:10:30 +0000 (+0100) Subject: Check for existence of mempcpy X-Git-Tag: elfutils-0.169~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3248e684cedf66239710a5f16a6b45294f183bc;p=thirdparty%2Felfutils.git Check for existence of mempcpy If it doesn't exist, provide a definition based on memcpy. Signed-off-by: Ulf Hermann --- diff --git a/ChangeLog b/ChangeLog index b50f79ee7..48185c361 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-02-15 Ulf Hermann + + * configure.ac: Add check for mempcpy. + 2017-02-09 Mark Wielaard * configure.ac: Add check for adding -D_FORTIFY_SOURCE=2 to CFLAGS. diff --git a/configure.ac b/configure.ac index 46055f262..3c35dac5d 100644 --- a/configure.ac +++ b/configure.ac @@ -285,6 +285,9 @@ AC_CHECK_DECLS([memrchr, rawmemchr],[],[], [#define _GNU_SOURCE #include ]) AC_CHECK_DECLS([powerof2],[],[],[#include ]) +AC_CHECK_DECLS([mempcpy],[],[], + [#define _GNU_SOURCE + #include ]) AC_CHECK_LIB([stdc++], [__cxa_demangle], [dnl AC_DEFINE([USE_DEMANGLE], [1], [Defined if demangling is enabled])]) diff --git a/lib/ChangeLog b/lib/ChangeLog index 6578ddbae..fd63e0390 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2017-02-15 Ulf Hermann + + * system.h: Provide mempcpy if it doesn't exist. + * xstrndup.c: Include system.h. + 2017-02-15 Ulf Hermann * crc32_file.c: Use _SC_PAGESIZE rather than _SC_PAGE_SIZE. diff --git a/lib/system.h b/lib/system.h index dde7c4a22..429b0c332 100644 --- a/lib/system.h +++ b/lib/system.h @@ -68,6 +68,11 @@ #define powerof2(x) (((x) & ((x) - 1)) == 0) #endif +#if !HAVE_DECL_MEMPCPY +#define mempcpy(dest, src, n) \ + ((void *) ((char *) memcpy (dest, src, n) + (size_t) n)) +#endif + /* A special gettext function we use if the strings are too short. */ #define sgettext(Str) \ ({ const char *__res = strrchr (gettext (Str), '|'); \ diff --git a/lib/xstrndup.c b/lib/xstrndup.c index d43e3b9e1..a257aa9a0 100644 --- a/lib/xstrndup.c +++ b/lib/xstrndup.c @@ -33,7 +33,7 @@ #include #include #include "libeu.h" - +#include "system.h" /* Return a newly allocated copy of STRING. */ char * diff --git a/libasm/ChangeLog b/libasm/ChangeLog index fe06007e9..26fc5a951 100644 --- a/libasm/ChangeLog +++ b/libasm/ChangeLog @@ -1,3 +1,7 @@ +2017-02-15 Ulf Hermann + + * disasm_str.c: Include system.h. + 2015-10-11 Akihiko Odaki * asm_align.c: Remove sys/param.h include. diff --git a/libasm/disasm_str.c b/libasm/disasm_str.c index 5b0bb299e..c14e6d5b6 100644 --- a/libasm/disasm_str.c +++ b/libasm/disasm_str.c @@ -31,7 +31,7 @@ #endif #include - +#include #include "libasmP.h" diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 52466cc35..4c9f4f6ac 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,7 @@ +2017-02-15 Ulf Hermann + + * linux-kernel-modules.c: Include system.h. + 2017-02-15 Ulf Hermann * linux-kernel-modules.c: Use sysconf(_SC_PAGESIZE) to get page size. diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c index a7ac19d26..7345e760f 100644 --- a/libdwfl/linux-kernel-modules.c +++ b/libdwfl/linux-kernel-modules.c @@ -34,6 +34,7 @@ #endif #include +#include #include "libdwflP.h" #include diff --git a/libebl/ChangeLog b/libebl/ChangeLog index 0560c6acc..719d08d02 100644 --- a/libebl/ChangeLog +++ b/libebl/ChangeLog @@ -1,3 +1,8 @@ +2017-02-15 Ulf Hermann + + * eblmachineflagname.c: Include system.h. + * eblopenbackend.c: Likewise. + 2016-07-08 Mark Wielaard * Makefile.am (gen_SOURCES): Remove eblstrtab.c. diff --git a/libebl/eblmachineflagname.c b/libebl/eblmachineflagname.c index 6079a613f..5f4407765 100644 --- a/libebl/eblmachineflagname.c +++ b/libebl/eblmachineflagname.c @@ -33,6 +33,7 @@ #include #include +#include #include diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c index aa75b9570..f3a65cfa2 100644 --- a/libebl/eblopenbackend.c +++ b/libebl/eblopenbackend.c @@ -39,6 +39,7 @@ #include #include +#include #include diff --git a/tests/ChangeLog b/tests/ChangeLog index bca47be15..cc6a19bf1 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +2017-02-15 Ulf Hermann + + * elfstrmerge.c: Include system.h. + 2017-02-09 Ulf Hermann * backtrace.c: Add an option to allow unknown symbols in the trace diff --git a/tests/elfstrmerge.c b/tests/elfstrmerge.c index c2c3fb972..8d5b53cb2 100644 --- a/tests/elfstrmerge.c +++ b/tests/elfstrmerge.c @@ -29,6 +29,7 @@ #include #include +#include #include #include ELFUTILS_HEADER(dwelf) #include "elf-knowledge.h"