From 44586d1fd8e76017cddcb68c71224a2fef044339 Mon Sep 17 00:00:00 2001 From: corubba Date: Wed, 24 Sep 2025 10:22:09 +0200 Subject: [PATCH] instrument functions: Satisfy bfd inclusion guard In 2012 [0] [1] binutils added an inclusion guard to bfd.h, requiring to include the autoconf config.h beforehand. This guard is triggered when enabling instrumentation and development mode: ``` % git clone https://github.com/the-tcpdump-group/tcpdump.git % cd tcpdump % touch .devel % ./autogen.sh % ./configure --enable-instrument-functions --enable-smb --quiet ./mkdep -c gcc -m -M -s . -DHAVE_CONFIG_H -I. fptype.c tcpdump.c print-smb.c smbutil.c instrument-functions.c In file included from ./instrument-functions.c:18: /usr/include/bfd.h:35:2: error: #error config.h must be included before this header 35 | #error config.h must be included before this header | ^~~~~ ``` Note than this does *not* happen on Debian-based systems, because they remove [2] that guard since 2012 [3]. That's also why the Ubuntu-based Linux CI is not affected. [0] https://sourceware.org/bugzilla/show_bug.cgi?id=14072 [1] https://sourceware.org/git/?p=binutils-gdb.git;a=blobdiff;f=bfd/bfd-in.h;h=ae8149a2;hp=d88bcb6c;hb=df7b86aa;hpb=134fa82e [2] https://salsa.debian.org/toolchain-team/binutils/-/blob/38415eb8/debian/rules#L1045-1048 [3] https://code.launchpad.net/~doko/binutils/pkg-2.23-debian --- instrument-functions.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/instrument-functions.c b/instrument-functions.c index ba0a56a53..05f80e788 100644 --- a/instrument-functions.c +++ b/instrument-functions.c @@ -11,6 +11,9 @@ * FOR A PARTICULAR PURPOSE. */ +/* required for bfd.h inclusion guard */ +#include + #include #include #include