]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Enforce usage -zrelax=transtls when GNU C Compiler is used on Solaris
authorOndřej Surý <ondrej@sury.org>
Wed, 19 Jun 2019 09:21:36 +0000 (11:21 +0200)
committerOndřej Surý <ondrej@sury.org>
Thu, 27 Jun 2019 11:33:26 +0000 (13:33 +0200)
When GNU C Compiler is used on Solaris (11), the Thread Local Storage
is completely broken.  The behaviour doesn't manifest when GNU ld is
used.  Thus, we need to enforce usage of GNU ld when GNU C Compiler is
the compiler of choice.

For more background for this change, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90912

(cherry picked from commit d584223653e17930109f37f5203acecca4090ca6)

configure
configure.ac

index 028839fd88f3cc00f0cc06a214da52c584df85bd..7f7bc2026c012ba35f53dc506d7bb647faadaffa 100755 (executable)
--- a/configure
+++ b/configure
 
 
 
+#
+# Using Solaris linker with gcc on Solaris breaks Thread Local Storage
+#
+case $host in #(
+  *-solaris*) :
+
+           if test "$GCC" = "yes"; then :
+  LDFLAGS="$LDFLAGS -zrelax=transtls"
+                  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: When using GNU C Compiler on Solaris, -zrelax=transtls linker flag is used to fix bug in Thread Local Storage" >&5
+$as_echo "$as_me: WARNING: When using GNU C Compiler on Solaris, -zrelax=transtls linker flag is used to fix bug in Thread Local Storage" >&2;}
+
+fi
+        ;; #(
+  *) :
+     ;;
+esac
+
 #
 # CCNOOPT defaults to -O0 on gcc and disables optimization when is last
 #
index 858d9a0529778cdfc04bdd9ee48b79eff737d68f..e20cca72cf52162925c3534c90b0738db43d0995 100644 (file)
@@ -355,6 +355,17 @@ esac
 AC_PROG_CC
 AC_PROG_CC_C99
 
+#
+# Using Solaris linker with gcc on Solaris breaks Thread Local Storage
+#
+AS_CASE([$host],
+       [*-solaris*],[
+           AS_IF([test "$GCC" = "yes"],
+                 [LDFLAGS="$LDFLAGS -zrelax=transtls"
+                  AC_MSG_WARN([When using GNU C Compiler on Solaris, -zrelax=transtls linker flag is used to fix bug in Thread Local Storage])
+                 ])
+       ])
+
 #
 # CCNOOPT defaults to -O0 on gcc and disables optimization when is last
 #