[m-rev.] for pre-commit review: workaround Mantis bug #453

Julien Fischer jfischer at opturion.com
Sun Jan 19 18:12:02 AEDT 2020


For pre-commit review by Peter.

In particular:

- should we instead handle this by forcing the use of gcc -O0 in asm_fast 
grades on affected systes?

- are there other systems that this workaround needs to be applied to?

I will add an entries to README.Linux and the NEWS file describing the 
problem separately.

--------------------------

Workaround Mantis bug #453.

Force the use of reg instead of asm_fast as the LLDS base grade on i*86 Linux
systems with GCC 5+ when dynamic linking is enabled.

configure.ac:
     Add the above workaround.

     Position the handling of the --enable-dynamic-link option before we
     determine the LLDS base grade.

     Unrelated: fix spelling.

Julien.

diff --git a/configure.ac b/configure.ac
index 65d3e85..5a3c3f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1283,7 +1283,7 @@ AC_ARG_WITH(csharp-compiler,
      mercury_cv_with_csharp_compiler="")
  MERCURY_CHECK_DOTNET

-# The Roslyn (i.e. Microsoft) C# compiler does not support signing assmblies
+# The Roslyn (i.e. Microsoft) C# compiler does not support signing assemblies
  # with a strong name on non-Windows platforms.  If we are using that compiler
  # on a non-Windows platform then only delay sign the assembly.

@@ -3366,6 +3366,13 @@ AC_SUBST([SYMPREFIX])

  #-----------------------------------------------------------------------------#

+AC_ARG_ENABLE(dynamic-link,
+    AC_HELP_STRING([--disable-dynamic-link],
+                   [disable the use of dynamic linking]),
+mercury_cv_enable_dynamic_link="$enableval",mercury_cv_enable_dynamic_link=yes)
+
+#-----------------------------------------------------------------------------#
+
  #
  # Figure out which is the best grade to use for various different purposes.
  # In particular, choose the default grade for compiling applications.
@@ -3452,6 +3459,26 @@ case "$host" in
          ;;
  esac

+# Dynamically linking Mercury libraries does not work with GCC 5+
+# on i*86 in asm_fast grades. Only use asm_fast on such systems
+# if dynamic linking is disabled; otherwise force the use of reg
+# as the llds base grade.
+#
+# This is a workaround for Mantis bug #453. 
+#
+case "$BEST_LLDS_BASE_GRADE,$mercury_cv_enable_dynamic_link" in
+    asm_fast,yes)
+        case "$host" in i*86*linux*)
+            case "$C_COMPILER_TYPE" in
+                gcc_3_*|gcc_4_*) ;;
+                gcc_*) BEST_LLDS_BASE_GRADE=reg ;;
+                *) ;;
+            esac
+        ;;
+        esac
+    ;;
+esac
+
  # BEST_DEBUG_BASE_GRADE is the most efficient base grade that supports
  # debugging (`--trace deep').

@@ -5173,10 +5200,6 @@ AC_SUBST(NSL_LIBRARY)
  # was specified.
  #

-AC_ARG_ENABLE(dynamic-link,
-    AC_HELP_STRING([--disable-dynamic-link],
-                   [disable the use of dynamic linking]),
-mercury_cv_enable_dynamic_link="$enableval",mercury_cv_enable_dynamic_link=yes)

  if test "$mercury_cv_enable_dynamic_link" = "yes"; then
      MERCURY_CHECK_FOR_HEADERS(dlfcn.h)


More information about the reviews mailing list