[PATCH] Fix libiberty.h inclusion on non-glibc hosts tree-wide

Nick Alcock nix@esperi.org.uk
Wed Nov 18 00:49:26 GMT 2026


In 2025, Iain Sandoe added memrchr support to libiberty.h. This requires
a new AC_CHECK_FUNCS of memrchr in every project that transitively
includes it, or builds on non-glibc, non-Linux hosts will fail (observed
on FreeBSD 15).

Fix trivial, but a tad invasive, since a lot of projects include
libiberty.h, and it shows up a few places that don't include config.h at
all (including some that include ansidecl.h, which requires config.h for
proper operation).

All relevant configury regenerated.

Also touches GDB machinery, so gdb-patches is Cc:ed.

Iain Sandoe Cc:ed: Iain, if you disagree with my rather nasty approach
here, I'd be interested in anything better. (The need to use %top in
binutils/arlex.l is slightly worrying.  It's not in POSIX, but
we need something like it or we can't include config.h before the
system headers it must precede.  (Including config.h in libiberty.h
won't work for the same reason.)

But if you don't do this, you can't compile binutils/arlex.c on
FreeBSD any more (or any non-Linux, non-glibc system).

bfd/
	* configure.ac: Check for memrchr.
	* config.in: Regenerate.
	* configure: Likewise.
binutils/
	* configure.ac: Check for memrchr.
	* demanguse.c: Include config.h.
	* arlex.l: Likewise.
	* config.in: Regenerate.
	* configure: Likewise.
gas/
	* configure.ac: Check for memrchr.
	* config.in: Regenerate.
	* configure: Likewise.
gdbsupport/
	* libiberty.m4: Check for memrchr.
	* config.in: Regenerate.
	* configure: Likewise.
sim/
	* config.h.in: Regenerate.
	* configure: Likewise.
gdb/
	* config.in: Regenerate.
	* configure: Likewise.
gdbserver/
	* config.in: Regenerate.
	* configure: Likewise.
gprofng/
	* configure.ac: Check for memrchr.
	* common/config.h.in: Regenerate.
	* configure: Likewise.
gold/
	* configure.ac: Check for memrchr.
	* config.in: Regenerate.
	* configure: Likewise.
ld/
	* configure.ac: Check for memrchr.
	* config.in: Regenerate.
	* configure: Likewise.
libctf/
	* configure.ac: Check for memrchr.
	* config.h.in: Regenerate.
	* configure: Likewise.
opcodes/
	* configure.ac: Check for memrchr.
	* config.in: Regenerate.
	* configure: Likewise.
---
 bfd/config.in              |  3 +++
 bfd/configure              |  2 +-
 bfd/configure.ac           |  2 +-
 binutils/arlex.l           |  4 ++++
 binutils/config.in         |  3 +++
 binutils/configure         |  2 +-
 binutils/configure.ac      |  2 +-
 binutils/demanguse.c       |  1 +
 gas/config.in              |  3 +++
 gas/configure              |  9 +++++----
 gas/configure.ac           |  2 +-
 gdb/config.in              |  3 +++
 gdb/configure              | 11 +++++++++++
 gdbserver/config.in        |  3 +++
 gdbserver/configure        | 11 +++++++++++
 gdbsupport/config.in       |  3 +++
 gdbsupport/configure       | 11 +++++++++++
 gdbsupport/libiberty.m4    |  1 +
 gold/config.in             |  3 +++
 gold/configure             |  2 +-
 gold/configure.ac          |  2 +-
 gprofng/common/config.h.in |  3 +++
 gprofng/configure          |  2 +-
 gprofng/configure.ac       |  2 +-
 ld/config.in               |  3 +++
 ld/configure               |  2 +-
 ld/configure.ac            |  2 +-
 libctf/config.h.in         |  3 +++
 libctf/configure           |  9 +++++----
 libctf/configure.ac        |  2 +-
 opcodes/config.in          |  3 +++
 opcodes/configure          | 11 +++++++++++
 opcodes/configure.ac       |  1 +
 sim/config.h.in            |  3 +++
 sim/configure              | 11 +++++++++++
 35 files changed, 120 insertions(+), 20 deletions(-)

diff --git a/bfd/config.in b/bfd/config.in
index 3efd3dc3ce1..0443944891f 100644
--- a/bfd/config.in
+++ b/bfd/config.in
@@ -165,6 +165,9 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the `memrchr' function. */
+#undef HAVE_MEMRCHR
+
 /* Define to 1 if you have a working `mmap' system call. */
 #undef HAVE_MMAP
 
diff --git a/bfd/configure b/bfd/configure
index d010a3f9aa6..30331907315 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -15129,7 +15129,7 @@ done
 
 
 for ac_func in fcntl fdopen fileno fls getgid getpagesize getrlimit getuid \
-	       sysconf
+	       sysconf memrchr
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/bfd/configure.ac b/bfd/configure.ac
index 0630973a11d..d3f761fb158 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -220,7 +220,7 @@ AC_CHECK_HEADERS(fcntl.h sys/file.h sys/resource.h sys/stat.h sys/types.h \
 		 unistd.h)
 
 AC_CHECK_FUNCS(fcntl fdopen fileno fls getgid getpagesize getrlimit getuid \
-	       sysconf)
+	       sysconf memrchr)
 
 AC_CHECK_DECLS([basename, ffs, stpcpy, asprintf, vasprintf, strnlen, strtoull])
 AC_CHECK_DECLS([___lc_codepage_func], [], [], [[#include <locale.h>]])
diff --git a/binutils/arlex.l b/binutils/arlex.l
index 1005aabfced..e8b43e90673 100644
--- a/binutils/arlex.l
+++ b/binutils/arlex.l
@@ -39,6 +39,10 @@ extern int yylex (void);
 int linenumber;
 %}
 
+%top{
+#include "config.h"
+}
+
 %a 10000
 %o 25000
 
diff --git a/binutils/config.in b/binutils/config.in
index 3c3b547e320..c8c7af66bd1 100644
--- a/binutils/config.in
+++ b/binutils/config.in
@@ -117,6 +117,9 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the `memrchr' function. */
+#undef HAVE_MEMRCHR
+
 /* Define to 1 if you have the `mkdtemp' function. */
 #undef HAVE_MKDTEMP
 
diff --git a/binutils/configure b/binutils/configure
index c455cb4c0d9..81e0037e8a2 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -15516,7 +15516,7 @@ rm -f conftest.mmap conftest.txt
 
   ASAN_OPTIONS="$save_ASAN_OPTIONS"
 
-for ac_func in fseeko fseeko64 getc_unlocked mkdtemp mkstemp utimensat utimes
+for ac_func in fseeko fseeko64 getc_unlocked mkdtemp mkstemp utimensat utimes memrchr
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/binutils/configure.ac b/binutils/configure.ac
index e9fda4f42bb..e2e6f416670 100644
--- a/binutils/configure.ac
+++ b/binutils/configure.ac
@@ -198,7 +198,7 @@ AC_CHECK_HEADERS(fcntl.h inttypes.h stdint.h sys/file.h \
 		 sys/stat.h sys/time.h sys/types.h unistd.h)
 AC_HEADER_SYS_WAIT
 GCC_AC_FUNC_MMAP
-AC_CHECK_FUNCS(fseeko fseeko64 getc_unlocked mkdtemp mkstemp utimensat utimes)
+AC_CHECK_FUNCS(fseeko fseeko64 getc_unlocked mkdtemp mkstemp utimensat utimes memrchr)
 
 AC_MSG_CHECKING([for mbstate_t])
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <wchar.h>]],
diff --git a/binutils/demanguse.c b/binutils/demanguse.c
index f5cfefdaf9f..07156d9e29a 100644
--- a/binutils/demanguse.c
+++ b/binutils/demanguse.c
@@ -18,6 +18,7 @@
    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
    02110-1301, USA.  */
 
+#include "config.h"
 #include <stdio.h>
 #include <string.h>
 #include "demangle.h"
diff --git a/gas/config.in b/gas/config.in
index 33482aa73dc..54fc965a676 100644
--- a/gas/config.in
+++ b/gas/config.in
@@ -122,6 +122,9 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the `memrchr' function. */
+#undef HAVE_MEMRCHR
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
diff --git a/gas/configure b/gas/configure
index bf3ccf3006d..dd2a89f976a 100755
--- a/gas/configure
+++ b/gas/configure
@@ -15659,12 +15659,13 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_gas" >&5
 $as_echo "$cross_gas" >&6; }
 
-for ac_func in strsignal
+for ac_func in strsignal memrchr
 do :
-  ac_fn_c_check_func "$LINENO" "strsignal" "ac_cv_func_strsignal"
-if test "x$ac_cv_func_strsignal" = xyes; then :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_STRSIGNAL 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
diff --git a/gas/configure.ac b/gas/configure.ac
index 09089b395c5..caecef436c5 100644
--- a/gas/configure.ac
+++ b/gas/configure.ac
@@ -977,7 +977,7 @@ else
 fi
 AC_MSG_RESULT($cross_gas)
 
-AC_CHECK_FUNCS(strsignal)
+AC_CHECK_FUNCS([strsignal memrchr])
 
 AM_LC_MESSAGES
 
diff --git a/gdb/config.in b/gdb/config.in
index 2e42440d4cc..e86bcce7966 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -316,6 +316,9 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the `memrchr' function. */
+#undef HAVE_MEMRCHR
+
 /* Define to 1 if you have a working `mmap' system call. */
 #undef HAVE_MMAP
 
diff --git a/gdb/configure b/gdb/configure
index e747ffce49f..62fc7c0d962 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -29676,6 +29676,17 @@ _ACEOF
 
 
 
+  for ac_func in memrchr
+do :
+  ac_fn_c_check_func "$LINENO" "memrchr" "ac_cv_func_memrchr"
+if test "x$ac_cv_func_memrchr" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_MEMRCHR 1
+_ACEOF
+
+fi
+done
+
 
 
 
diff --git a/gdbserver/config.in b/gdbserver/config.in
index cf6ebe0a4f2..dd18566aa00 100644
--- a/gdbserver/config.in
+++ b/gdbserver/config.in
@@ -168,6 +168,9 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the `memrchr' function. */
+#undef HAVE_MEMRCHR
+
 /* Define to 1 if you have a working `mmap' system call. */
 #undef HAVE_MMAP
 
diff --git a/gdbserver/configure b/gdbserver/configure
index e00e1e1c1c5..712e417e9fe 100755
--- a/gdbserver/configure
+++ b/gdbserver/configure
@@ -13249,6 +13249,17 @@ _ACEOF
 
 
 
+  for ac_func in memrchr
+do :
+  ac_fn_c_check_func "$LINENO" "memrchr" "ac_cv_func_memrchr"
+if test "x$ac_cv_func_memrchr" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_MEMRCHR 1
+_ACEOF
+
+fi
+done
+
 
 
 ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "#include <sys/types.h>
diff --git a/gdbsupport/config.in b/gdbsupport/config.in
index ff84ab0d600..00f281f6a65 100644
--- a/gdbsupport/config.in
+++ b/gdbsupport/config.in
@@ -147,6 +147,9 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the `memrchr' function. */
+#undef HAVE_MEMRCHR
+
 /* Define to 1 if you have a working `mmap' system call. */
 #undef HAVE_MMAP
 
diff --git a/gdbsupport/configure b/gdbsupport/configure
index 7ed4e259ffe..aeb0246bf98 100755
--- a/gdbsupport/configure
+++ b/gdbsupport/configure
@@ -10587,6 +10587,17 @@ _ACEOF
 
 
 
+  for ac_func in memrchr
+do :
+  ac_fn_c_check_func "$LINENO" "memrchr" "ac_cv_func_memrchr"
+if test "x$ac_cv_func_memrchr" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_MEMRCHR 1
+_ACEOF
+
+fi
+done
+
 
 ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
 if test "x$ac_cv_type_size_t" = xyes; then :
diff --git a/gdbsupport/libiberty.m4 b/gdbsupport/libiberty.m4
index 6c4a83c59a3..4ba571a6d19 100644
--- a/gdbsupport/libiberty.m4
+++ b/gdbsupport/libiberty.m4
@@ -28,4 +28,5 @@ AC_DEFUN([libiberty_INIT],
   AC_CHECK_DECLS_ONCE([ffs, asprintf, vasprintf, snprintf, vsnprintf])
   AC_CHECK_DECLS_ONCE([strtol, strtoul, strtoll, strtoull])
   AC_CHECK_DECLS_ONCE([strverscmp])
+  AC_CHECK_FUNCS([memrchr])
 ])
diff --git a/gold/config.in b/gold/config.in
index 3dcb30da9f4..52920b606a2 100644
--- a/gold/config.in
+++ b/gold/config.in
@@ -154,6 +154,9 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the `memrchr' function. */
+#undef HAVE_MEMRCHR
+
 /* Define to 1 if you have the `mkdtemp' function. */
 #undef HAVE_MKDTEMP
 
diff --git a/gold/configure b/gold/configure
index 36fb3a0085c..c524494279f 100755
--- a/gold/configure
+++ b/gold/configure
@@ -9764,7 +9764,7 @@ fi
 
 done
 
-for ac_func in chsize mmap link
+for ac_func in chsize mmap link memrchr
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/gold/configure.ac b/gold/configure.ac
index 89348b660be..7159034928c 100644
--- a/gold/configure.ac
+++ b/gold/configure.ac
@@ -547,7 +547,7 @@ LFS_CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
 AC_SUBST(LFS_CFLAGS)
 
 AC_CHECK_HEADERS(sys/mman.h)
-AC_CHECK_FUNCS(chsize mmap link)
+AC_CHECK_FUNCS(chsize mmap link memrchr)
 AC_REPLACE_FUNCS(pread ftruncate ffsll)
 
 AC_CACHE_CHECK([mremap with MREMAP_MAYMOVE], [gold_cv_lib_mremap_maymove],
diff --git a/gprofng/common/config.h.in b/gprofng/common/config.h.in
index 5f2c1278c95..9a2f42a830d 100644
--- a/gprofng/common/config.h.in
+++ b/gprofng/common/config.h.in
@@ -28,6 +28,9 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the `memrchr' function. */
+#undef HAVE_MEMRCHR
+
 /* Define if you have POSIX threads libraries and header files. */
 #undef HAVE_PTHREAD
 
diff --git a/gprofng/configure b/gprofng/configure
index 0888933579b..6fe67f23ee6 100755
--- a/gprofng/configure
+++ b/gprofng/configure
@@ -17614,7 +17614,7 @@ cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_BASENAME $ac_have_decl
 _ACEOF
 
-for ac_func in clock_gettime strsignal
+for ac_func in clock_gettime strsignal memrchr
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/gprofng/configure.ac b/gprofng/configure.ac
index 3a2eb0265dd..2cb4b9a4c7f 100644
--- a/gprofng/configure.ac
+++ b/gprofng/configure.ac
@@ -246,7 +246,7 @@ AC_SUBST(GPROFNG_CPPFLAGS, [${gprofng_cppflags}])
 AC_SUBST(NOLTO_CFLAGS, [${nolto_cflags}])
 
 AC_CHECK_DECLS([basename])
-AC_CHECK_FUNCS(clock_gettime strsignal)
+AC_CHECK_FUNCS([clock_gettime strsignal memrchr])
 
 # For riscv builds inside incomplete environments such as during intermediate
 # steps of cross toolchain building, or with outdated Linux headers.
diff --git a/ld/config.in b/ld/config.in
index 1353370340d..4dd2cb1ad49 100644
--- a/ld/config.in
+++ b/ld/config.in
@@ -173,6 +173,9 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the `memrchr' function. */
+#undef HAVE_MEMRCHR
+
 /* Define to 1 if you have the `mkstemp' function. */
 #undef HAVE_MKSTEMP
 
diff --git a/ld/configure b/ld/configure
index cbf80648e1b..f7778869520 100755
--- a/ld/configure
+++ b/ld/configure
@@ -18690,7 +18690,7 @@ fi
 
 done
 
-for ac_func in close getrusage glob lseek mkstemp open realpath waitpid mallinfo mallinfo2
+for ac_func in close getrusage glob lseek mkstemp open realpath waitpid mallinfo mallinfo2 memrchr
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/ld/configure.ac b/ld/configure.ac
index 8c5e9606ac0..bf7976e202b 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -447,7 +447,7 @@ AC_SUBST(NATIVE_LIB_DIRS)
 AC_CHECK_HEADERS(fcntl.h elf-hints.h limits.h inttypes.h stdint.h \
 		 sys/file.h sys/mman.h sys/param.h sys/stat.h sys/time.h \
 		 sys/types.h unistd.h)
-AC_CHECK_FUNCS(close getrusage glob lseek mkstemp open realpath waitpid mallinfo mallinfo2)
+AC_CHECK_FUNCS(close getrusage glob lseek mkstemp open realpath waitpid mallinfo mallinfo2 memrchr)
 
 BFD_BINARY_FOPEN
 
diff --git a/libctf/config.h.in b/libctf/config.h.in
index 359f1f5ae1d..f213e4d60c7 100644
--- a/libctf/config.h.in
+++ b/libctf/config.h.in
@@ -73,6 +73,9 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the `memrchr' function. */
+#undef HAVE_MEMRCHR
+
 /* Define to 1 if you have a working `mmap' system call. */
 #undef HAVE_MMAP
 
diff --git a/libctf/configure b/libctf/configure
index 8ccc9ac4ee1..584ce040694 100755
--- a/libctf/configure
+++ b/libctf/configure
@@ -16949,12 +16949,13 @@ fi
 
 done
 
-for ac_func in pread
+for ac_func in pread memrchr
 do :
-  ac_fn_c_check_func "$LINENO" "pread" "ac_cv_func_pread"
-if test "x$ac_cv_func_pread" = xyes; then :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_PREAD 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
diff --git a/libctf/configure.ac b/libctf/configure.ac
index 1e1b429c98e..31b73f66cae 100644
--- a/libctf/configure.ac
+++ b/libctf/configure.ac
@@ -118,7 +118,7 @@ fi
 
 AC_C_BIGENDIAN
 AC_CHECK_HEADERS(byteswap.h endian.h valgrind/valgrind.h)
-AC_CHECK_FUNCS(pread)
+AC_CHECK_FUNCS([pread memrchr])
 
 dnl Check for bswap_{16,32,64}
 AC_CHECK_DECLS([bswap_16, bswap_32, bswap_64], [], [], [[#include <byteswap.h>]])
diff --git a/opcodes/config.in b/opcodes/config.in
index 36e654292b2..d69ae43f675 100644
--- a/opcodes/config.in
+++ b/opcodes/config.in
@@ -65,6 +65,9 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the `memrchr' function. */
+#undef HAVE_MEMRCHR
+
 /* Define if sigsetjmp is available. */
 #undef HAVE_SIGSETJMP
 
diff --git a/opcodes/configure b/opcodes/configure
index 2ae65d00cbd..1d630c79ccf 100755
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -14032,6 +14032,17 @@ cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_VSNPRINTF $ac_have_decl
 _ACEOF
 
+for ac_func in memrchr
+do :
+  ac_fn_c_check_func "$LINENO" "memrchr" "ac_cv_func_memrchr"
+if test "x$ac_cv_func_memrchr" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_MEMRCHR 1
+_ACEOF
+
+fi
+done
+
 
 # Check if sigsetjmp is available.  Using AC_CHECK_FUNCS won't do
 # since sigsetjmp might only be defined as a macro.
diff --git a/opcodes/configure.ac b/opcodes/configure.ac
index c6d8972aa0a..71d236516ea 100644
--- a/opcodes/configure.ac
+++ b/opcodes/configure.ac
@@ -97,6 +97,7 @@ AC_SUBST(HDEFINES)
 AC_PROG_INSTALL
 
 AC_CHECK_DECLS([asprintf, basename, snprintf, stpcpy, strtoull, vsnprintf])
+AC_CHECK_FUNCS([memrchr])
 
 # Check if sigsetjmp is available.  Using AC_CHECK_FUNCS won't do
 # since sigsetjmp might only be defined as a macro.
diff --git a/sim/config.h.in b/sim/config.h.in
index 44ff51580c7..8a850202fef 100644
--- a/sim/config.h.in
+++ b/sim/config.h.in
@@ -187,6 +187,9 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the `memrchr' function. */
+#undef HAVE_MEMRCHR
+
 /* Define to 1 if you have the `mkdir' function. */
 #undef HAVE_MKDIR
 
diff --git a/sim/configure b/sim/configure
index da4caa57aa1..490d725aaed 100755
--- a/sim/configure
+++ b/sim/configure
@@ -14444,6 +14444,17 @@ _ACEOF
 
 
 
+  for ac_func in memrchr
+do :
+  ac_fn_c_check_func "$LINENO" "memrchr" "ac_cv_func_memrchr"
+if test "x$ac_cv_func_memrchr" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_MEMRCHR 1
+_ACEOF
+
+fi
+done
+
 
 
 

base-commit: 5678a7bfceb3a6ea18bcde1ae68f7e96c43c998b
prerequisite-patch-id: 6bb7a1f3d29820aec4c1fe7c2b30a99b1c33b604
-- 
2.56.1.291.g6a80de6356



More information about the Binutils mailing list