bec3007
diff -rup binutils.orig/libiberty/acinclude.m4 binutils-2.39/libiberty/acinclude.m4
bec3007
--- binutils.orig/libiberty/acinclude.m4	2022-11-23 14:41:57.639262100 +0000
bec3007
+++ binutils-2.39/libiberty/acinclude.m4	2022-11-23 14:43:07.139042148 +0000
bec3007
@@ -24,6 +24,8 @@ AC_CACHE_CHECK([for working strncmp], ac
bec3007
 [AC_TRY_RUN([
bec3007
 /* Test by Jim Wilson and Kaveh Ghazi.
bec3007
    Check whether strncmp reads past the end of its string parameters. */
bec3007
+#include <stdlib.h>
bec3007
+#include <string.h>
bec3007
 #include <sys/types.h>
bec3007
 
bec3007
 #ifdef HAVE_FCNTL_H
bec3007
@@ -51,7 +53,8 @@ AC_CACHE_CHECK([for working strncmp], ac
bec3007
 
bec3007
 #define MAP_LEN 0x10000
bec3007
 
bec3007
-main ()
bec3007
+int
bec3007
+main (void)
bec3007
 {
bec3007
 #if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE)
bec3007
   char *p;
bec3007
@@ -157,7 +160,10 @@ if test $ac_cv_os_cray = yes; then
bec3007
 fi
bec3007
 
bec3007
 AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
bec3007
-[AC_TRY_RUN([find_stack_direction ()
bec3007
+[AC_TRY_RUN([#include <stdlib.h>
bec3007
+
bec3007
+int
bec3007
+find_stack_direction (void)
bec3007
 {
bec3007
   static char *addr = 0;
bec3007
   auto char dummy;
bec3007
@@ -169,7 +175,9 @@ AC_CACHE_CHECK(stack direction for C all
bec3007
   else
bec3007
     return (&dummy > addr) ? 1 : -1;
bec3007
 }
bec3007
-main ()
bec3007
+
bec3007
+int
bec3007
+main (void)
bec3007
 {
bec3007
   exit (find_stack_direction() < 0);
bec3007
 }],
bec3007
diff -rup binutils.orig/libiberty/configure binutils-2.39/libiberty/configure
bec3007
--- binutils.orig/libiberty/configure	2022-11-23 14:41:57.652262059 +0000
bec3007
+++ binutils-2.39/libiberty/configure	2022-11-23 14:46:31.556395168 +0000
bec3007
@@ -1766,7 +1766,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
bec3007
 /* end confdefs.h.  */
bec3007
 $4
bec3007
 int
bec3007
-main ()
bec3007
+main (void)
bec3007
 {
bec3007
 static int test_array [1 - 2 * !(($2) >= 0)];
bec3007
 test_array [0] = 0;
bec3007
@@ -1783,7 +1783,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
bec3007
 /* end confdefs.h.  */
bec3007
 $4
bec3007
 int
bec3007
-main ()
bec3007
+main (void)
bec3007
 {
bec3007
 static int test_array [1 - 2 * !(($2) <= $ac_mid)];
bec3007
 test_array [0] = 0;
bec3007
@@ -1810,7 +1810,7 @@ else
bec3007
 /* end confdefs.h.  */
bec3007
 $4
bec3007
 int
bec3007
-main ()
bec3007
+main (void)
bec3007
 {
bec3007
 static int test_array [1 - 2 * !(($2) < 0)];
bec3007
 test_array [0] = 0;
bec3007
@@ -1827,7 +1827,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
bec3007
 /* end confdefs.h.  */
bec3007
 $4
bec3007
 int
bec3007
-main ()
bec3007
+main (void)
bec3007
 {
bec3007
 static int test_array [1 - 2 * !(($2) >= $ac_mid)];
bec3007
 test_array [0] = 0;
bec3007
@@ -1862,7 +1862,7 @@ while test "x$ac_lo" != "x$ac_hi"; do
bec3007
 /* end confdefs.h.  */
bec3007
 $4
bec3007
 int
bec3007
-main ()
bec3007
+main (void)
bec3007
 {
bec3007
 static int test_array [1 - 2 * !(($2) <= $ac_mid)];
bec3007
 test_array [0] = 0;
bec3007
@@ -1892,7 +1892,7 @@ static unsigned long int ulongval () { r
bec3007
 #include <stdio.h>
bec3007
 #include <stdlib.h>
bec3007
 int
bec3007
-main ()
bec3007
+main (void)
bec3007
 {
bec3007
 
bec3007
   FILE *f = fopen ("conftest.val", "w");
bec3007
@@ -1952,7 +1952,7 @@ else
bec3007
 /* end confdefs.h.  */
bec3007
 $4
bec3007
 int
bec3007
-main ()
bec3007
+main (void)
bec3007
 {
bec3007
 if (sizeof ($2))
bec3007
 	 return 0;
bec3007
@@ -1965,7 +1965,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
bec3007
 /* end confdefs.h.  */
bec3007
 $4
bec3007
 int
bec3007
-main ()
bec3007
+main (void)
bec3007
 {
bec3007
 if (sizeof (($2)))
bec3007
 	    return 0;
bec3007
@@ -2037,7 +2037,7 @@ choke me
bec3007
 #endif
bec3007
 
bec3007
 int
bec3007
-main ()
bec3007
+main (void)
bec3007
 {
bec3007
 return $2 ();
bec3007
   ;
bec3007
@@ -2077,7 +2077,7 @@ else
bec3007
 /* end confdefs.h.  */
bec3007
 $4
bec3007
 int
bec3007
-main ()
bec3007
+main (void)
bec3007
 {
bec3007
 #ifndef $as_decl_name
bec3007
 #ifdef __cplusplus
bec3007
@@ -3459,7 +3459,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
bec3007
 /* end confdefs.h.  */
bec3007
 #include <stdio.h>
bec3007
 int
bec3007
-main ()
bec3007
+main (void)
bec3007
 {
bec3007
 printf ("hello world\n");
bec3007
   ;
bec3007
@@ -3487,7 +3487,7 @@ else
bec3007
 /* end confdefs.h.  */
bec3007
 
bec3007
 int
bec3007
-main ()
bec3007
+main (void)
bec3007
 {
bec3007
 
bec3007
   ;
bec3007
@@ -3627,7 +3627,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_
bec3007
 /* end confdefs.h.  */
bec3007
 #include <stdio.h>
bec3007
 int
bec3007
-main ()
bec3007
+main (void)
bec3007
 {
bec3007
 FILE *f = fopen ("conftest.out", "w");
bec3007
  return ferror (f) || fclose (f) != 0;
bec3007
@@ -3692,7 +3692,7 @@ else
bec3007
 /* end confdefs.h.  */
bec3007
 
bec3007
 int
bec3007
-main ()
bec3007
+main (void)
bec3007
 {
bec3007
 
bec3007
   ;
bec3007
@@ -3743,7 +3743,7 @@ else
bec3007
 /* end confdefs.h.  */
bec3007
 
bec3007
 int
bec3007
-main ()
bec3007
+main (void)
bec3007
 {
bec3007
 #ifndef __GNUC__
bec3007
        choke me
bec3007
@@ -3784,7 +3784,7 @@ else
bec3007
 /* end confdefs.h.  */
bec3007
 
bec3007
 int
bec3007
-main ()
bec3007
+main (void)
bec3007
 {
bec3007
 
bec3007
   ;
bec3007
@@ -3799,7 +3799,7 @@ else
bec3007
 /* end confdefs.h.  */
bec3007
 
bec3007
 int
bec3007
-main ()
bec3007
+main (void)
bec3007
 {
bec3007
 
bec3007
   ;
bec3007
@@ -3815,7 +3815,7 @@ else
bec3007
 /* end confdefs.h.  */
bec3007
 
bec3007
 int
bec3007
-main ()
bec3007
+main (void)
bec3007
 {
bec3007
 
bec3007
   ;
bec3007
@@ -3901,7 +3901,7 @@ int pairnames (int, char **, FILE *(*)(s
bec3007
 int argc;
bec3007
 char **argv;
bec3007
 int
bec3007
-main ()
bec3007
+main (void)
bec3007
 {
bec3007
 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
bec3007
   ;
bec3007
@@ -6919,7 +6919,10 @@ else
bec3007
 else
bec3007
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
bec3007
 /* end confdefs.h.  */
bec3007
-find_stack_direction ()
bec3007
+#include <stdlib.h>
bec3007
+
bec3007
+int
bec3007
+find_stack_direction (void)
bec3007
 {
bec3007
   static char *addr = 0;
bec3007
   auto char dummy;
bec3007
@@ -6931,7 +6934,9 @@ find_stack_direction ()
bec3007
   else
bec3007
     return (&dummy > addr) ? 1 : -1;
bec3007
 }
bec3007
-main ()
bec3007
+
bec3007
+int
bec3007
+main (int)
bec3007
 {
bec3007
   exit (find_stack_direction() < 0);
bec3007
 }
bec3007
@@ -7756,6 +7761,8 @@ else
bec3007
 
bec3007
 /* Test by Jim Wilson and Kaveh Ghazi.
bec3007
    Check whether strncmp reads past the end of its string parameters. */
bec3007
+#include <stdlib.h>
bec3007
+#include <string.h>
bec3007
 #include <sys/types.h>
bec3007
 
bec3007
 #ifdef HAVE_FCNTL_H
bec3007
@@ -7783,7 +7790,8 @@ else
bec3007
 
bec3007
 #define MAP_LEN 0x10000
bec3007
 
bec3007
-main ()
bec3007
+int
bec3007
+main (void)
bec3007
 {
bec3007
 #if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE)
bec3007
   char *p;
bec3007
diff -rup binutils.orig/gas/acinclude.m4 binutils-2.39/gas/acinclude.m4
bec3007
--- binutils.orig/gas/acinclude.m4	2022-11-23 14:56:11.793442492 +0000
bec3007
+++ binutils-2.39/gas/acinclude.m4	2022-11-23 14:59:17.778057190 +0000
bec3007
@@ -23,6 +23,7 @@ AC_DEFUN([GAS_WORKING_ASSERT],
bec3007
 [AC_MSG_CHECKING([for working assert macro])
bec3007
 AC_CACHE_VAL(gas_cv_assert_ok,
bec3007
 AC_TRY_LINK([#include <assert.h>
bec3007
+#include <string.h>
bec3007
 #include <stdio.h>], [
bec3007
 /* check for requoting problems */
bec3007
 static int a, b, c, d;
bec3007
diff -rup binutils.orig/gas/configure binutils-2.39/gas/configure
bec3007
--- binutils.orig/gas/configure	2022-11-23 14:56:12.402441231 +0000
bec3007
+++ binutils-2.39/gas/configure	2022-11-23 14:59:37.266016817 +0000
bec3007
@@ -13758,6 +13758,7 @@ else
bec3007
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
bec3007
 /* end confdefs.h.  */
bec3007
 #include <assert.h>
bec3007
+#include <string.h>
bec3007
 #include <stdio.h>
bec3007
 int
bec3007
 main ()