From b4255de024c2225a5a7e407ecf122953eeaa49fc Mon Sep 17 00:00:00 2001 From: Lubomir Sedlacik Date: Wed, 23 Jul 2003 21:03:17 +0000 Subject: [PATCH] Disable optimisations for sha1.c on UltraSPARC cpu if using GCC 2.x. Works around a compiler bug which results in memory exhaustion. --- configure.in.pre | 23 +++++++++++++++++++++++ lib/silccrypt/Makefile.am | 7 +++++++ 2 files changed, 30 insertions(+) diff --git a/configure.in.pre b/configure.in.pre index ea80702f..9b3979f7 100644 --- a/configure.in.pre +++ b/configure.in.pre @@ -361,6 +361,29 @@ else fi fi +# +# Workaround a bug in GCC 2.x which causes memory exhaustion +# when compiling sha1 with optimizations on UltraSPARC. +# +FIX_SHA1='#' +if test "$GCC" -a "$host_cpu" = "sparc64"; then + AC_MSG_CHECKING(whether to enable GCC 2.x workaround for SHA1) + AC_TRY_COMPILE( + [ + #if defined(__sparc64__) && (__GNUC__ == 2) + #else + choke me + #endif + ], + [], + [ + FIX_SHA1='' + AC_MSG_RESULT(yes) + ], + AC_MSG_RESULT(no) + ) +fi +AC_SUBST(FIX_SHA1) ## ## Installation diff --git a/lib/silccrypt/Makefile.am b/lib/silccrypt/Makefile.am index 47f72044..3dd281ca 100644 --- a/lib/silccrypt/Makefile.am +++ b/lib/silccrypt/Makefile.am @@ -73,3 +73,10 @@ endif EXTRA_DIST = *.h tests include $(top_srcdir)/Makefile.defines.in + +# Workaround a bug in GCC 2.x which causes memory exhaustion +# when compiling sha1 with optimizations on UltraSPARC. +# +@FIX_SHA1@sha1.lo: +@FIX_SHA1@ $(LTCOMPILE) -O0 -c -o $@ `test -f 'sha1.c' || echo '$(srcdir)/'`sha1.c +@FIX_SHA1@ -- 2.43.0