diff options
author | Colin Cross <ccross@android.com> | 2021-09-09 22:48:43 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-09-09 22:48:43 +0000 |
commit | 32046a8287a10b58a11c75a238b42e3dfa8bcad8 (patch) | |
tree | a05a5e4e7c0f4fca5eee9e67f852d9dbe8bfb740 | |
parent | 4d40dbf702850bdedb744d8bd49872a1b75d39d4 (diff) | |
parent | df5daa1498fe71f4d42d8cf86fca668f423144e5 (diff) | |
download | elfutils-32046a8287a10b58a11c75a238b42e3dfa8bcad8.tar.gz |
Merge changes I9001f472,I324bee2b,I1a634839,I0663d474,I320ee9c2, ... am: 820f86f790 am: 21d650df05 am: df5daa1498
Original change: https://android-review.googlesource.com/c/platform/external/elfutils/+/1819987
Change-Id: Ica3d1ffb6cd374626575f0e91b157390fc4d9eeb
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | config.h | 6 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | debuginfod/ChangeLog | 4 | ||||
-rw-r--r-- | debuginfod/debuginfod.cxx | 1 | ||||
-rw-r--r-- | lib/ChangeLog | 23 | ||||
-rw-r--r-- | lib/Makefile.am | 2 | ||||
-rw-r--r-- | lib/error.c | 49 | ||||
-rw-r--r-- | lib/fixedsizehash.h | 6 | ||||
-rw-r--r-- | lib/system.h | 13 | ||||
-rw-r--r-- | src/ChangeLog | 4 | ||||
-rw-r--r-- | src/elfclassify.c | 1 |
12 files changed, 106 insertions, 10 deletions
@@ -1,3 +1,7 @@ +2021-08-20 Saleem Abdulrasool <abdulras@google.com> + + * Add AC_CHECK_HEADERS for error.h and err.h. + 2021-02-05 Mark Wielaard <mark@klomp.org> * configure.ac (AC_INIT): Set version to 0.183. @@ -55,6 +55,12 @@ don't. */ #define HAVE_DECL_STRERROR_R 1 +/* Define to 1 if you have the <error.h> header file. */ +#define HAVE_ERROR_H 1 + +/* Define to 1 if you have the <err.h> header file. */ +#define HAVE_ERR_H 1 + /* Defined if __attribute__((fallthrough)) is supported */ #define HAVE_FALLTHROUGH 1 diff --git a/configure.ac b/configure.ac index d345495d..9c0671e2 100644 --- a/configure.ac +++ b/configure.ac @@ -428,6 +428,9 @@ AC_CHECK_DECLS([mempcpy],[],[], AC_CHECK_FUNCS([process_vm_readv]) +AC_CHECK_HEADERS([error.h]) +AC_CHECK_HEADERS([err.h]) + old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -D_GNU_SOURCE" AC_FUNC_STRERROR_R() diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog index 8de88522..d133b8e2 100644 --- a/debuginfod/ChangeLog +++ b/debuginfod/ChangeLog @@ -1,3 +1,7 @@ +2021-08-20 Saleem Abdulrasool <abdulras@google.com> + + * debuginfod.cxx: Remove error.h include. + 2021-02-04 Frank Ch. Eigler <fche@redhat.com> PR27092 low-memory handling diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx index b34eacc2..eda1fdbc 100644 --- a/debuginfod/debuginfod.cxx +++ b/debuginfod/debuginfod.cxx @@ -45,7 +45,6 @@ extern "C" { #include <unistd.h> #include <stdlib.h> -#include <error.h> #include <libintl.h> #include <locale.h> #include <pthread.h> diff --git a/lib/ChangeLog b/lib/ChangeLog index 371e2133..5138c88b 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,26 @@ +2021-08-23 Saleem Abdulrasool <abdulras@google.com> + + * system.h: Remove inline definition for error and error_message_count + in the fallback path. + * Makefile.am (libeu_a_SOURCES): Add error.c. + * error.c: New file, moves the previous inline definitions to avoid + multiple definitions properly rather than relying on -fcommon and vague + linkage. + +2021-08-21 Saleem Abdulrasool <abdulras@google.com> + + * fixedsizehash.h: Remove unused STROF macro. + +2021-08-20 Saleem Abdulrasool <abdulras@google.com> + + * system.h: Check for HAVE_ERROR_H and HAVE_ERR_H and define + error_message_cont and error if necessary. + +2021-08-20 Saleem Abdulrasool <abdulras@google.com> + + * fixedsizehash.h: Remove sys/cdefs.h include. Unconditionally + define STROF and CONCAT macros. + 2021-02-05 Mark Wielaard <mark@klomp.org> * printversion.c (print_version): Update copyright year. diff --git a/lib/Makefile.am b/lib/Makefile.am index 97bf7329..766fbcd7 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -35,7 +35,7 @@ noinst_LIBRARIES = libeu.a libeu_a_SOURCES = xstrdup.c xstrndup.c xmalloc.c next_prime.c \ crc32.c crc32_file.c \ - color.c printversion.c + color.c error.c printversion.c noinst_HEADERS = fixedsizehash.h libeu.h system.h dynamicsizehash.h list.h \ eu-config.h color.h printversion.h bpf.h \ diff --git a/lib/error.c b/lib/error.c new file mode 100644 index 00000000..75e964fd --- /dev/null +++ b/lib/error.c @@ -0,0 +1,49 @@ +/* Definitions for error fallback functions. + Copyright (C) 2021 Google, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +#if !defined(HAVE_ERROR_H) && defined(HAVE_ERR_H) +#include <stdarg.h> +#include <stdlib.h> +#include <err.h> + +unsigned int error_message_count = 0; + +void error(int status, int errnum, const char *format, ...) { + va_list argp; + + va_start(argp, format); + verr(status, format, argp); + va_end(argp); + + if (status) + exit(status); + ++error_message_count; +} +#endif diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h index dac2a5f5..14f0fb88 100644 --- a/lib/fixedsizehash.h +++ b/lib/fixedsizehash.h @@ -30,17 +30,11 @@ #include <errno.h> #include <stdlib.h> #include <string.h> -#include <sys/cdefs.h> #include <system.h> -#ifdef __CONCAT -#define CONCAT(t1,t2) __CONCAT (t1,t2) -#else -#define STROF(t2) t2 #define CONCAT_EXPANDED(t1,t2) t1 ## t2 #define CONCAT(t1,t2) CONCAT_EXPANDED(t1,t2) -#endif /* Before including this file the following macros must be defined: diff --git a/lib/system.h b/lib/system.h index 1c478e1c..bf90cbb2 100644 --- a/lib/system.h +++ b/lib/system.h @@ -29,14 +29,25 @@ #ifndef LIB_SYSTEM_H #define LIB_SYSTEM_H 1 +#include <config.h> + #include <errno.h> -#include <error.h> #include <stddef.h> #include <stdint.h> #include <sys/param.h> #include <endian.h> #include <byteswap.h> #include <unistd.h> +#include <stdarg.h> + +#if defined(HAVE_ERROR_H) +#include <error.h> +#elif defined(HAVE_ERR_H) +extern int error_message_count; +void error(int status, int errnum, const char *format, ...); +#else +#error "err.h or error.h must be available" +#endif #if __BYTE_ORDER == __LITTLE_ENDIAN # define LE32(n) (n) diff --git a/src/ChangeLog b/src/ChangeLog index e65620fd..db5b8bf9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2021-08-20 Saleem Abdulrasool <abdulras@google.com> + + * elfclassify.c: Remove error.h include. + 2021-02-03 Timm Bäder <tbaeder@redhat.com> * ar.c (do_oper_extract): Extract should_truncate_fname function diff --git a/src/elfclassify.c b/src/elfclassify.c index ae626bb1..d1f0c96a 100644 --- a/src/elfclassify.c +++ b/src/elfclassify.c @@ -18,7 +18,6 @@ #include <config.h> #include <argp.h> -#include <error.h> #include <fcntl.h> #include <gelf.h> #include <stdbool.h> |