- Fix broken configure tests compromised by LTO

This commit is contained in:
Jeff Law 2020-07-20 23:43:00 -06:00
parent 566e9bf7d5
commit 216faaf132
2 changed files with 57 additions and 1 deletions

44
mingw-gcc-config.patch Normal file
View File

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

View File

@ -22,7 +22,7 @@
Name: mingw-gcc
Version: %{gcc_version}
Release: 3%{?dist}
Release: 4%{?dist}
Summary: MinGW Windows cross-compiler (GCC) for C
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions
@ -36,6 +36,7 @@ URL: http://gcc.gnu.org
# rm -rf gcc-dir.tmp
%global srcdir gcc-%{version}-%{DATE}
Source0: %{srcdir}.tar.xz
Patch0: mingw-gcc-config.patch
BuildRequires: gcc-c++
BuildRequires: texinfo
@ -216,6 +217,14 @@ needed for OpenMP v3.0 support for the win32 target.
%autosetup -p1 -n %{srcdir}
echo 'Fedora MinGW %{version}-%{release}' > gcc/DEV-PHASE
# Force updating the configure files after patching the .m4 files
pushd libiberty
autoconf -f
popd
pushd intl
autoconf -f
popd
%build
# Default configure arguments
configure_args="\
@ -647,6 +656,9 @@ ln -sf %{mingw64_bindir}/libssp-0.dll %{buildroot}%{mingw64_libdir}/libssp.dll.a
%changelog
* Mon Jul 20 2020 Jeff Law <law@redhat.com> - 10.1.1-4
- Fix broken configure tests compromised by LTO
* Sun Jul 19 2020 Sandro Mani <manisandro@gmail.com> - 10.1.1-3
- Hack: symlink libssp-0.dll over libssp.dll.a