Skip to content

Commit

Permalink
tools/elfutils: use locally declared static reallocarray()
Browse files Browse the repository at this point in the history
On macOS, stdlib.h in the standard include paths does not provide
reallocarray() while both elfutils and gnulib do, however they are
declared differently, leading to an error:

  ./system.h:101:1: error: static declaration of 'reallocarray' follows non-static declaration
  reallocarray (void *ptr, size_t nmemb, size_t size)

A normal "configure && make" build cycle results in both declarations
being enabled as a result of both elfutils and gnulib having completely
separate configure checks where gnulib uses an internal placeholder symbol
HAVE_REALLOCARRAY, and elfutils uses a standard autoconf macro
HAVE_DECL_REALLOCARRAY.

Fix this by excluding the import of the reallocarray module which causes
gnulib checks in the configure stage to not even consider whether to
declare reallocarray later on, so the decision is only between the
standard include stdlib.h and the elfutils header.

Tested-by: Georgi Valkov <[email protected]> # MacOS
Signed-off-by: Michael Pratt <[email protected]>
Signed-off-by: Tony Ambardar <[email protected]>
  • Loading branch information
mcprat authored and robimarko committed Apr 25, 2024
1 parent 43be319 commit 20ed56e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tools/elfutils/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ PKG_GNULIB_ARGS = \
--local-dir=$(STAGING_DIR_HOST)/share/gnulib \
--source-base=$(PKG_GNULIB_BASE) \
--libtool \
--avoid=reallocarray \
--import

PKG_GNULIB_MODS = \
Expand Down

0 comments on commit 20ed56e

Please sign in to comment.