From 452372b3f917edeea71d250b228d2cf673bb4f70 Mon Sep 17 00:00:00 2001 From: Cem Keylan Date: Mon, 3 Aug 2020 21:29:37 +0300 Subject: libelf: switch to elfutils --- core/libelf/build | 22 +++++++++++++++++----- core/libelf/checksums | 4 +++- core/libelf/depends | 1 + core/libelf/files/error.h | 27 +++++++++++++++++++++++++++ core/libelf/patches/musl-decls.patch | 20 ++++++++++++++++++++ core/libelf/sources | 4 +++- core/libelf/version | 2 +- 7 files changed, 72 insertions(+), 8 deletions(-) create mode 100644 core/libelf/depends create mode 100644 core/libelf/files/error.h create mode 100644 core/libelf/patches/musl-decls.patch (limited to 'core/libelf') diff --git a/core/libelf/build b/core/libelf/build index 94916479..bd5cf230 100755 --- a/core/libelf/build +++ b/core/libelf/build @@ -1,11 +1,23 @@ #!/bin/sh -e -sed 's/-I/-isystem /g' libelf.pc.in > _ -cat _ > libelf.pc.in; rm -f _ +patch -p1 < musl-decls.patch + +# Build sometimes forces -Werror. +export CFLAGS="$CFLAGS -Wno-error" + +# Disable configure error for missing argp. +sed -i 's/as_fn_error.*libargp/: "/g' configure + +# Don't compile two unrelated C files which require argp. +sed -i 's/color.*printversion../#/g' lib/Makefile.in ./configure \ --prefix=/usr \ - --enable-nls=auto + --disable-symbol-versioning \ + --disable-debuginfod \ + --disable-nls -make -make prefix="$1/usr" install +# Skip the default make target and build only what we need. +make -C lib +make -C libelf +make -C libelf DESTDIR="$1" install diff --git a/core/libelf/checksums b/core/libelf/checksums index 46a6d9a8..e978fe84 100644 --- a/core/libelf/checksums +++ b/core/libelf/checksums @@ -1 +1,3 @@ -591a9b4ec81c1f2042a97aa60564e0cb79d041c52faa7416acb38bc95bd2c76d libelf-0.8.13.tar.gz +b827b6e35c59d188ba97d7cf148fa8dc6f5c68eb6c5981888dfdbb758c0b569d elfutils-0.180.tar.bz2 +fd98976f5112b49f6469e7bd2e97d390cf90dc68392218dc713ac0449fc3e395 musl-decls.patch +bf11b56670c7919b44e33b5b0f3a216b7f20cf2859b74bf5e2e837532f8e0579 error.h diff --git a/core/libelf/depends b/core/libelf/depends new file mode 100644 index 00000000..f22003e8 --- /dev/null +++ b/core/libelf/depends @@ -0,0 +1 @@ +zlib diff --git a/core/libelf/files/error.h b/core/libelf/files/error.h new file mode 100644 index 00000000..ef06827a --- /dev/null +++ b/core/libelf/files/error.h @@ -0,0 +1,27 @@ +#ifndef _ERROR_H_ +#define _ERROR_H_ + +#include +#include +#include +#include +#include + +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_ */ diff --git a/core/libelf/patches/musl-decls.patch b/core/libelf/patches/musl-decls.patch new file mode 100644 index 00000000..e3705695 --- /dev/null +++ b/core/libelf/patches/musl-decls.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 + ++#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/core/libelf/sources b/core/libelf/sources index d8f130e7..91cdad42 100644 --- a/core/libelf/sources +++ b/core/libelf/sources @@ -1 +1,3 @@ -https://fossies.org/linux/misc/old/libelf-0.8.13.tar.gz +https://sourceware.org/elfutils/ftp/0.180/elfutils-0.180.tar.bz2 +patches/musl-decls.patch +files/error.h lib diff --git a/core/libelf/version b/core/libelf/version index 5af15bd9..fd3e36c9 100644 --- a/core/libelf/version +++ b/core/libelf/version @@ -1 +1 @@ -0.8.13 2 +0.180 1 -- cgit v1.2.3