9218f70
diff -Nrup a/libiberty/aclocal.m4 b/libiberty/aclocal.m4
9218f70
--- a/libiberty/aclocal.m4	2019-01-19 09:01:34.000000000 -0700
9218f70
+++ b/libiberty/aclocal.m4	2020-01-09 22:00:27.183312982 -0700
9218f70
@@ -147,7 +147,7 @@ if test $ac_cv_os_cray = yes; then
9218f70
 fi
9218f70
 
9218f70
 AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
9218f70
-[AC_TRY_RUN([find_stack_direction ()
9218f70
+[AC_TRY_RUN([__attribute__ ((noclone,noinline)) find_stack_direction ()
9218f70
 {
9218f70
   static char *addr = 0;
9218f70
   auto char dummy;
9218f70
diff --git a/config/intdiv0.m4 b/config/intdiv0.m4
9218f70
index 55dddcf1..ba906efc 100644
9218f70
--- a/config/intdiv0.m4
9218f70
+++ b/config/intdiv0.m4
9218f70
@@ -31,10 +31,10 @@ sigfpe_handler (sig) int sig;
9218f70
   exit (sig != SIGFPE);
9218f70
 }
9218f70
 
9218f70
-int x = 1;
9218f70
-int y = 0;
9218f70
-int z;
9218f70
-int nan;
9218f70
+volatile int x = 1;
9218f70
+volatile int y = 0;
9218f70
+volatile int z;
9218f70
+volatile int nan;
9218f70
 
9218f70
 int main ()
9218f70
 {
9218f70
diff --git a/libiberty/configure.ac b/libiberty/configure.ac
9218f70
index f1ce7601..fc20d228 100644
9218f70
--- a/libiberty/configure.ac
9218f70
+++ b/libiberty/configure.ac
9218f70
@@ -661,7 +661,7 @@ if test -z "${setobjs}"; then
9218f70
   for v in $vars; do
9218f70
     AC_MSG_CHECKING([for $v])
9218f70
     AC_CACHE_VAL(libiberty_cv_var_$v,
9218f70
-      [AC_LINK_IFELSE([AC_LANG_PROGRAM([[int *p;]],[[extern int $v []; p = $v;]])],
9218f70
+      [AC_LINK_IFELSE([AC_LANG_PROGRAM([[__attribute__ ((used)) int *p;]],[[extern int $v []; p = $v;]])],
9218f70
 		      [eval "libiberty_cv_var_$v=yes"],
9218f70
 		      [eval "libiberty_cv_var_$v=no"])])
9218f70
     if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then