diff options
author | Saleem Abdulrasool <abdulras@google.com> | 2021-08-27 15:51:47 +0000 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2021-08-27 18:34:15 +0200 |
commit | 4d6dd0e5ad5c3366cbf701b4fb62b6d91be545f8 (patch) | |
tree | 63147b2b38aba183ba281fe805dcdf74548bd5a7 /lib/system.h | |
parent | 047d09e17edfb220cd6a96129bd19b496d503fc5 (diff) | |
download | elfutils-4d6dd0e5ad5c3366cbf701b4fb62b6d91be545f8.tar.gz |
lib: avoid potential problems with `-fno-common`
This properly homes the fallback function into a translation unit rather
than trying to define an inline common definition for the fallback path.
The intent of the original approach was to actually simply avoid adding
a new source file that is used for the fallback path. However, that may
cause trouble with multiple definitions if the symbol does not get vague
linkage (which itself is not particularly great). This simplifies the
behaviour at the cost of an extra inode.
Diffstat (limited to 'lib/system.h')
-rw-r--r-- | lib/system.h | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/lib/system.h b/lib/system.h index b963fd15..edbc8488 100644 --- a/lib/system.h +++ b/lib/system.h @@ -45,21 +45,8 @@ #if defined(HAVE_ERROR_H) #include <error.h> #elif defined(HAVE_ERR_H) -#include <err.h> - -static int error_message_count = 0; - -static inline 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; -} +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 |