aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2017-02-13 17:05:57 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2017-02-14 18:50:06 +0000
commit69a9add8425a3ac8a4ce5294354a543c63d35e39 (patch)
tree1cb92f6d6bf1e7d89587d0a66e85fbc74be41372
parent7fac29dc3dc6a41096bf5f204c541b70f967291e (diff)
testing/elfutils: new aport
A collection of utilities and DSOs to handle ELF files and DWARF data http://elfutils.org/
-rw-r--r--testing/elfutils/0001-Fix-TEMP_FAILURE_RETRY-definition-when-not-defined.patch108
-rw-r--r--testing/elfutils/APKBUILD109
-rw-r--r--testing/elfutils/fix-aarch64_fregs.patch22
-rw-r--r--testing/elfutils/fix-uninitialized.patch17
-rw-r--r--testing/elfutils/musl-accessperms.patch13
-rw-r--r--testing/elfutils/musl-canonicalize_file_name.patch22
-rw-r--r--testing/elfutils/musl-cdefs.patch20
-rw-r--r--testing/elfutils/musl-macros.patch68
-rw-r--r--testing/elfutils/musl-qsort_r.patch56
-rw-r--r--testing/elfutils/musl-strerror_r.patch19
-rw-r--r--testing/elfutils/no-werror.patch32
11 files changed, 486 insertions, 0 deletions
diff --git a/testing/elfutils/0001-Fix-TEMP_FAILURE_RETRY-definition-when-not-defined.patch b/testing/elfutils/0001-Fix-TEMP_FAILURE_RETRY-definition-when-not-defined.patch
new file mode 100644
index 00000000000..5a1182d80af
--- /dev/null
+++ b/testing/elfutils/0001-Fix-TEMP_FAILURE_RETRY-definition-when-not-defined.patch
@@ -0,0 +1,108 @@
+From 925f67e86d127c8917f92bde1cf5abd5b07d0768 Mon Sep 17 00:00:00 2001
+From: Luiz Angelo Daros de Luca <luizluca@gmail.com>
+Date: Thu, 29 Dec 2016 21:02:57 -0200
+Subject: [PATCH] Fix TEMP_FAILURE_RETRY definition when not defined.
+
+https://sourceware.org/bugzilla/show_bug.cgi?id=21001
+
+Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
+---
+ lib/ChangeLog | 5 +++++
+ lib/crc32_file.c | 1 +
+ lib/system.h | 2 +-
+ libdwfl/ChangeLog | 6 ++++++
+ libdwfl/dwfl_build_id_find_elf.c | 1 +
+ libdwfl/dwfl_module_getdwarf.c | 1 +
+ libdwfl/libdwfl_crc32_file.c | 1 -
+ 7 files changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/lib/ChangeLog b/lib/ChangeLog
+index 1fe59067..fcf5b105 100644
+--- a/lib/ChangeLog
++++ b/lib/ChangeLog
+@@ -1,3 +1,8 @@
++2016-12-29 Luiz Angelo Daros de Luca <luizluca@gmail.com>
++
++ * crc32_file.c: Include system.h.
++ * system.h: Remove semi-colon after TEMP_FAILURE_RETRY definition.
++
+ 2016-12-24 Mark Wielaard <mark@klomp.org>
+
+ * version.c: New source file.
+diff --git a/lib/crc32_file.c b/lib/crc32_file.c
+index a8434d42..57e42980 100644
+--- a/lib/crc32_file.c
++++ b/lib/crc32_file.c
+@@ -35,6 +35,7 @@
+ #include <unistd.h>
+ #include <sys/stat.h>
+ #include <sys/mman.h>
++#include "system.h"
+
+ int
+ crc32_file (int fd, uint32_t *resp)
+diff --git a/lib/system.h b/lib/system.h
+index ccd99d63..dde7c4a2 100644
+--- a/lib/system.h
++++ b/lib/system.h
+@@ -81,7 +81,7 @@
+ do \
+ __res = expression; \
+ while (__res == -1 && errno == EINTR); \
+- __res; });
++ __res; })
+ #endif
+
+ static inline ssize_t __attribute__ ((unused))
+diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
+index bc627fee..57671eaf 100644
+--- a/libdwfl/ChangeLog
++++ b/libdwfl/ChangeLog
+@@ -1,3 +1,9 @@
++2016-12-29 Luiz Angelo Daros de Luca <luizluca@gmail.com>
++
++ * dwfl_build_id_find_elf.c: Include system.h.
++ * dwfl_module_getdwarf.c: Likewise.
++ * libdwfl_crc32_file.c: Don't define LIB_SYSTEM_H.
++
+ 2016-11-23 Mark Wielaard <mjw@redhat.com>
+
+ * linux-kernel-modules.c: Only include fts.h early if BAD_FTS is
+diff --git a/libdwfl/dwfl_build_id_find_elf.c b/libdwfl/dwfl_build_id_find_elf.c
+index 903e1931..d4737c9f 100644
+--- a/libdwfl/dwfl_build_id_find_elf.c
++++ b/libdwfl/dwfl_build_id_find_elf.c
+@@ -30,6 +30,7 @@
+ #include <inttypes.h>
+ #include <fcntl.h>
+ #include <unistd.h>
++#include "system.h"
+
+
+ int
+diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c
+index 0e8810b1..46caece5 100644
+--- a/libdwfl/dwfl_module_getdwarf.c
++++ b/libdwfl/dwfl_module_getdwarf.c
+@@ -33,6 +33,7 @@
+ #include <unistd.h>
+ #include "../libdw/libdwP.h" /* DWARF_E_* values are here. */
+ #include "../libelf/libelfP.h"
++#include "system.h"
+
+ static inline Dwfl_Error
+ open_elf_file (Elf **elf, int *fd, char **name)
+diff --git a/libdwfl/libdwfl_crc32_file.c b/libdwfl/libdwfl_crc32_file.c
+index 6b6b7d3f..f849128d 100644
+--- a/libdwfl/libdwfl_crc32_file.c
++++ b/libdwfl/libdwfl_crc32_file.c
+@@ -31,6 +31,5 @@
+
+ #define crc32_file attribute_hidden __libdwfl_crc32_file
+ #define crc32 __libdwfl_crc32
+-#define LIB_SYSTEM_H 1
+ #include <libdwflP.h>
+ #include "../lib/crc32_file.c"
+--
+2.11.1
+
diff --git a/testing/elfutils/APKBUILD b/testing/elfutils/APKBUILD
new file mode 100644
index 00000000000..686813cdb40
--- /dev/null
+++ b/testing/elfutils/APKBUILD
@@ -0,0 +1,109 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=elfutils
+pkgver=0.168
+pkgrel=0
+pkgdesc="A collection of utilities and DSOs to handle ELF files and DWARF data"
+url="http://elfutils.org/"
+arch="all"
+license="GPLv3+ and (GPLv2+ or LGPLv3+)"
+depends=""
+makedepends="bison flex-dev zlib-dev bzip2-dev xz-dev argp-standalone
+ bsd-compat-headers autoconf automake libtool"
+install=""
+subpackages="$pkgname-dev $pkgname-libelf"
+source="https://sourceware.org/elfutils/ftp/$pkgver/elfutils-$pkgver.tar.bz2
+ 0001-Fix-TEMP_FAILURE_RETRY-definition-when-not-defined.patch
+ fix-aarch64_fregs.patch
+ fix-uninitialized.patch
+ musl-accessperms.patch
+ musl-canonicalize_file_name.patch
+ musl-cdefs.patch
+ musl-macros.patch
+ musl-qsort_r.patch
+ musl-strerror_r.patch
+ no-werror.patch
+ "
+builddir="$srcdir/elfutils-$pkgver"
+
+prepare() {
+ cd "$builddir"
+ default_prepare || return 1
+ autoreconf -vif || return 1
+
+ cat > src/error.h <<-EOF
+ #ifndef _ERROR_H_
+ #define _ERROR_H_
+
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <errno.h>
+
+ static unsigned int error_message_count = 0;
+
+ static inline void error(int status, int errnum, const char* format, ...)
+ {
+ va_list ap;
+ fprintf(stderr, "%s: ", program_invocation_name);
+ va_start(ap, format);
+ vfprintf(stderr, format, ap);
+ va_end(ap);
+ if (errnum)
+ fprintf(stderr, ": %s", strerror(errnum));
+ fprintf(stderr, "\n");
+ error_message_count++;
+ if (status)
+ exit(status);
+ }
+
+ #endif /* _ERROR_H_ */
+EOF
+ cp src/error.h lib/ || return 1
+ cat > lib/libintl.h <<-EOF
+ #ifndef LIBINTL_H
+ #define LIBINTL_H
+ #define _(x) (x)
+ #endif
+EOF
+
+}
+build() {
+ cd "$builddir"
+ CFLAGS="$CFLAGS -Wno-null-dereference" \
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --localstatedir=/var \
+ --disable-werror \
+ --disable-nls \
+ || return 1
+ # for now we only build libelf
+ cd libelf && make || return 1
+}
+
+package() {
+ cd "$builddir"/libelf
+ make DESTDIR="$pkgdir" install
+}
+
+libelf() {
+ pkgdesc="libelf from elfutils"
+ mkdir -p "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libelf*.so* "$subpkgdir"/usr/lib/
+}
+
+sha512sums="c8f2077ffe6877ad9e9d2f553bf0576361799c601d246f53e1d99a6f7046794c5916e1087b97ad1d1e5f59f9debc20384f864d507ef6c4c75a8e767d15d6eb91 elfutils-0.168.tar.bz2
+eb77cb7712d74a67bbaca83ed2ccf169ba3095b423068176dd26bf340964c89b02574315f42bd4be0e4e4890c647b74a813657e890fbc719296508c625cd396c 0001-Fix-TEMP_FAILURE_RETRY-definition-when-not-defined.patch
+61d38d47e557b54a2dc35b081a80af1b4e56172cf2d16843299506384e8062078edbef116eca5047021b37eb49a5cb364016f7bb6426942f772ec94f91cb02a1 fix-aarch64_fregs.patch
+b9ba55e1b56a8abf694b6d02f022d9a3a0ae6ab53a8c4a71e49552e32411ef410d3a7512fbd1a729696bc2046ac11586829816f0fa3b8226ee77c9dc4b741e58 fix-uninitialized.patch
+0d9858c8437b5185975bb6be1340bcd718a5e723c7f9d683be91c8b14e87dc9b94fc620d752d07a655c602cc2e35d85d62b829a91d43d930d8f0b3ffde6e0e32 musl-accessperms.patch
+46f53041fcbc8b82190c253faecfed1cbdced465923336925088915824a07140a9bc846d5498b22ee54f0dc4e74f19522bce102a162b79b2b4674cf0c58c14eb musl-canonicalize_file_name.patch
+0198194976782ab13bba59491d2d6bbe6189cba1edab174ca61cc7b942564f03b5d61feb6b787c5d09e66b3b493f08a330a8612e04de02d261b72b7996cc50c3 musl-cdefs.patch
+886ab23301f1872d94bcfc3590621196c811252c9a993738e5e480e666c7c3359f25e94c0e873c8fe16dc283e193dba0532a7ced3951e673185dcbb1d062b7c6 musl-macros.patch
+f025d6479c8782275090783ff4dd09eb70a7c3eec1126d3176c02d01124f22864d81e08cb96ac4d255e0316205658459b617f5b661b16dbaf1636591720605f4 musl-qsort_r.patch
+a0d986100c8ff2ef0595645ec1b2eeb1d517b7442aef5f349ebf27fcb66c76e51fadeda25bed5f04b4bb16a61aa23ac6e86a1f34a0087d2136acf0f64c3fa4d1 musl-strerror_r.patch
+26aff757de8c0c67ae7922888c4a842939fb9b4022f3d2fa916591b44921c109f74154175afd431a0e31cf7c876f6d4fbaae26ef283985ae98d96854ea02dce0 no-werror.patch"
diff --git a/testing/elfutils/fix-aarch64_fregs.patch b/testing/elfutils/fix-aarch64_fregs.patch
new file mode 100644
index 00000000000..bafa8012cf9
--- /dev/null
+++ b/testing/elfutils/fix-aarch64_fregs.patch
@@ -0,0 +1,22 @@
+It looks like fregs.vregs[] is an array of double?
+Casting to Dwarf_Word instead of & 0xFFFFFFF should do.
+
+--- a/backends/aarch64_initreg.c 2015-11-27 14:36:29.000000000 +0100
++++ b/backends/aarch64_initreg.c 2016-08-09 03:47:25.428560159 +0200
+@@ -33,7 +33,6 @@
+ #include "system.h"
+ #include <assert.h>
+ #ifdef __aarch64__
+-# include <linux/uio.h>
+ # include <sys/user.h>
+ # include <sys/ptrace.h>
+ /* Deal with old glibc defining user_pt_regs instead of user_regs_struct. */
+@@ -82,7 +82,7 @@
+
+ Dwarf_Word dwarf_fregs[32];
+ for (int r = 0; r < 32; r++)
+- dwarf_fregs[r] = fregs.vregs[r] & 0xFFFFFFFF;
++ dwarf_fregs[r] = (Dwarf_Word)fregs.vregs[r];
+
+ if (! setfunc (64, 32, dwarf_fregs, arg))
+ return false;
diff --git a/testing/elfutils/fix-uninitialized.patch b/testing/elfutils/fix-uninitialized.patch
new file mode 100644
index 00000000000..31ecd9ee58d
--- /dev/null
+++ b/testing/elfutils/fix-uninitialized.patch
@@ -0,0 +1,17 @@
+
+--- a/libcpu/i386_disasm.c 2015-08-21 14:22:37.000000000 +0200
++++ b/libcpu/i386_disasm.c 2015-11-20 06:30:59.250629957 +0100
+@@ -1,4 +1,4 @@
+-/* Disassembler for x86.
++/* Disassembler for x86.
+ Copyright (C) 2007, 2008, 2009, 2011 Red Hat, Inc.
+ This file is part of elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2007.
+@@ -710,6 +710,7 @@
+
+ case 'm':
+ /* Mnemonic. */
++ str = mnebuf;
+
+ if (unlikely (instrtab[cnt].mnemonic == MNE_INVALID))
+ {
diff --git a/testing/elfutils/musl-accessperms.patch b/testing/elfutils/musl-accessperms.patch
new file mode 100644
index 00000000000..0c7d2fa25d7
--- /dev/null
+++ b/testing/elfutils/musl-accessperms.patch
@@ -0,0 +1,13 @@
+--- a/src/strip.c 2015-10-12 12:22:58.000000000 +0200
++++ b/src/strip.c 2015-11-20 07:44:13.626287111 +0100
+@@ -44,6 +44,10 @@
+ #include <libebl.h>
+ #include <system.h>
+
++#if !defined(ACCESSPERMS)
++#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO)
++#endif
++
+ typedef uint8_t GElf_Byte;
+
+ /* Name and version of program. */
diff --git a/testing/elfutils/musl-canonicalize_file_name.patch b/testing/elfutils/musl-canonicalize_file_name.patch
new file mode 100644
index 00000000000..60e22bb5bba
--- /dev/null
+++ b/testing/elfutils/musl-canonicalize_file_name.patch
@@ -0,0 +1,22 @@
+--- a/libdwfl/dwfl_build_id_find_elf.c 2015-10-12 12:22:58.000000000 +0200
++++ b/libdwfl/dwfl_build_id_find_elf.c 2015-11-20 05:13:10.972994172 +0100
+@@ -94,7 +94,7 @@
+ {
+ if (*file_name != NULL)
+ free (*file_name);
+- *file_name = canonicalize_file_name (name);
++ *file_name = realpath (name, NULL);
+ if (*file_name == NULL)
+ {
+ *file_name = name;
+--- a/libdwfl/find-debuginfo.c 2015-10-12 12:22:58.000000000 +0200
++++ b/libdwfl/find-debuginfo.c 2015-11-20 05:18:56.990967176 +0100
+@@ -372,7 +372,7 @@
+ /* If FILE_NAME is a symlink, the debug file might be associated
+ with the symlink target name instead. */
+
+- char *canon = canonicalize_file_name (file_name);
++ char *canon = realpath (file_name, NULL);
+ if (canon != NULL && strcmp (file_name, canon))
+ fd = find_debuginfo_in_path (mod, canon,
+ debuglink_file, debuglink_crc,
diff --git a/testing/elfutils/musl-cdefs.patch b/testing/elfutils/musl-cdefs.patch
new file mode 100644
index 00000000000..8497188515f
--- /dev/null
+++ b/testing/elfutils/musl-cdefs.patch
@@ -0,0 +1,20 @@
+--- a/libelf/elf.h 2015-08-21 14:22:37.000000000 +0200
++++ b/libelf/elf.h 2015-11-20 04:54:33.948081321 +0100
+@@ -21,6 +21,17 @@
+
+ #include <features.h>
+
++#if !defined(__GLIBC__)
++/* C++ needs to know that types and declarations are C, not C++. */
++#ifdef __cplusplus
++# define __BEGIN_DECLS extern "C" {
++# define __END_DECLS }
++#else
++# define __BEGIN_DECLS
++# define __END_DECLS
++#endif
++#endif
++
+ __BEGIN_DECLS
+
+ /* Standard ELF types. */
diff --git a/testing/elfutils/musl-macros.patch b/testing/elfutils/musl-macros.patch
new file mode 100644
index 00000000000..5900bdd7645
--- /dev/null
+++ b/testing/elfutils/musl-macros.patch
@@ -0,0 +1,68 @@
+--- a/src/arlib.h 2015-08-21 14:22:37.000000000 +0200
++++ b/src/arlib.h 2015-11-20 08:02:55.153199611 +0100
+@@ -29,6 +29,16 @@
+ #include <stdint.h>
+ #include <sys/types.h>
+
++#if !defined(ACCESSPERMS)
++# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
++#endif
++#if !defined(ALLPERMS)
++# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
++#endif
++#if !defined(DEFFILEMODE)
++# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/
++#endif
++
+
+ /* State of -D/-U flags. */
+ extern bool arlib_deterministic_output;
+--- a/src/elfcompress.c.orig 2016-04-02 12:51:26.903848894 +0200
++++ b/src/elfcompress.c 2016-04-02 12:55:15.076996338 +0200
+@@ -35,6 +35,14 @@
+ #include <gelf.h>
+ #include "system.h"
+
++#if !defined(FNM_EXTMATCH)
++# define FNM_EXTMATCH 0
++#endif
++
++#if !defined(ALLPERMS)
++# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
++#endif
++
+ /* Name and version of program. */
+ static void print_version (FILE *stream, struct argp_state *state);
+ ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;
+diff --git a/lib/libeu.h b/lib/libeu.h
+index 69fe3d7..e5c99b8 100644
+--- a/lib/libeu.h
++++ b/lib/libeu.h
+@@ -31,6 +31,27 @@
+
+ #include <stddef.h>
+ #include <stdint.h>
++#include <unistd.h>
++#include <alloca.h>
++#include <string.h>
++
++#ifndef TEMP_FAILURE_RETRY
++#define TEMP_FAILURE_RETRY(expression) \
++ (__extension__ \
++ ({ long int __result; \
++ do __result = (long int) (expression); \
++ while (__result == -1L && errno == EINTR); \
++ __result; }))
++#endif
++
++#ifndef strndupa
++#define strndupa(s, n) \
++ (__extension__ ({const char *__in = (s); \
++ size_t __len = strnlen (__in, (n)) + 1; \
++ char *__out = (char *) alloca (__len); \
++ __out[__len-1] = '\0'; \
++ (char *) memcpy (__out, __in, __len-1);}))
++#endif
+
+ extern void *xmalloc (size_t) __attribute__ ((__malloc__));
+ extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__));
diff --git a/testing/elfutils/musl-qsort_r.patch b/testing/elfutils/musl-qsort_r.patch
new file mode 100644
index 00000000000..e1455baf691
--- /dev/null
+++ b/testing/elfutils/musl-qsort_r.patch
@@ -0,0 +1,56 @@
+--- a/src/readelf.c 2015-10-12 12:22:58.000000000 +0200
++++ b/src/readelf.c 2015-11-20 08:11:32.945159213 +0100
+@@ -4366,10 +4366,11 @@
+ return base;
+ }
+
++static const char *listptr_name;
++
+ static int
+-compare_listptr (const void *a, const void *b, void *arg)
++compare_listptr (const void *a, const void *b)
+ {
+- const char *name = arg;
+ struct listptr *p1 = (void *) a;
+ struct listptr *p2 = (void *) b;
+
+@@ -4385,21 +4386,21 @@
+ p1->warned = p2->warned = true;
+ error (0, 0,
+ gettext ("%s %#" PRIx64 " used with different address sizes"),
+- name, (uint64_t) p1->offset);
++ listptr_name, (uint64_t) p1->offset);
+ }
+ if (p1->dwarf64 != p2->dwarf64)
+ {
+ p1->warned = p2->warned = true;
+ error (0, 0,
+ gettext ("%s %#" PRIx64 " used with different offset sizes"),
+- name, (uint64_t) p1->offset);
++ listptr_name, (uint64_t) p1->offset);
+ }
+ if (listptr_base (p1) != listptr_base (p2))
+ {
+ p1->warned = p2->warned = true;
+ error (0, 0,
+ gettext ("%s %#" PRIx64 " used with different base addresses"),
+- name, (uint64_t) p1->offset);
++ listptr_name, (uint64_t) p1->offset);
+ }
+ }
+
+@@ -4464,9 +4465,11 @@
+ static void
+ sort_listptr (struct listptr_table *table, const char *name)
+ {
+- if (table->n > 0)
+- qsort_r (table->table, table->n, sizeof table->table[0],
+- &compare_listptr, (void *) name);
++ if (table->n > 0) {
++ listptr_name = name;
++ qsort (table->table, table->n, sizeof table->table[0],
++ &compare_listptr);
++ }
+ }
+
+ static bool
diff --git a/testing/elfutils/musl-strerror_r.patch b/testing/elfutils/musl-strerror_r.patch
new file mode 100644
index 00000000000..72977951d54
--- /dev/null
+++ b/testing/elfutils/musl-strerror_r.patch
@@ -0,0 +1,19 @@
+--- a/libdwfl/dwfl_error.c 2015-09-29 17:18:51.000000000 +0200
++++ b/libdwfl/dwfl_error.c 2015-11-20 05:11:29.889002058 +0100
+@@ -154,7 +154,16 @@
+ switch (error &~ 0xffff)
+ {
+ case OTHER_ERROR (ERRNO):
++#if defined(__GLIBC__)
+ return strerror_r (error & 0xffff, "bad", 0);
++#else
++ {
++ static __thread char buf[128] = "";
++ if (0 == strerror_r(error & 0xffff, buf, sizeof(buf)))
++ return buf;
++ }
++ return "strerror_r() failed";
++#endif
+ case OTHER_ERROR (LIBELF):
+ return elf_errmsg (error & 0xffff);
+ case OTHER_ERROR (LIBDW):
diff --git a/testing/elfutils/no-werror.patch b/testing/elfutils/no-werror.patch
new file mode 100644
index 00000000000..ddf963244a7
--- /dev/null
+++ b/testing/elfutils/no-werror.patch
@@ -0,0 +1,32 @@
+diff --git a/config/eu.am b/config/eu.am
+index 8fe1e25..afeb095 100644
+--- a/config/eu.am
++++ b/config/eu.am
+@@ -71,7 +71,7 @@ AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
+ -Wold-style-definition -Wstrict-prototypes \
+ $(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \
+ $(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \
+- $(if $($(*F)_no_Werror),,-Werror) \
++ $(if $($(*F)_no_Werror),,$(WERROR)) \
+ $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
+ $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
+ $($(*F)_CFLAGS)
+diff --git a/configure.ac b/configure.ac
+index 4549906..6a74a06 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -57,6 +57,14 @@ AC_CONFIG_FILES([elfutils.spec:config/elfutils.spec.in])
+
+ AC_CANONICAL_HOST
+
++AC_ARG_ENABLE(werror,
++[AS_HELP_STRING([--disable-werror],
++ [turn off -Werror @<:@default=enabled@:>@])])
++if test "x$enable_werror" != "xno"; then
++ WERROR="-Werror"
++fi
++AC_SUBST(WERROR)
++
+ AC_ARG_ENABLE(deterministic-archives,
+ [AS_HELP_STRING([--enable-deterministic-archives],
+ [ar and ranlib default to -D behavior])], [