Change in ...libosmocore[master]: configure: Allow disabling workaround for TLS bug in old ARM gcc vers...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Tue Aug 6 13:59:51 UTC 2019


pespin has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/libosmocore/+/15061 )

Change subject: configure: Allow disabling workaround for TLS bug in old ARM gcc versions
......................................................................

configure: Allow disabling workaround for TLS bug in old ARM gcc versions

Some toolchains (such as sysmobts 201705 one) containing the TLS bug on
old ARM gcc versions (<7.3.0) also crash if the initial workaround found
is aplied (CFLAGS="-mtls-dialect=gnu2"). In that scenario, let's provide
a way to disable the workaround (to avoid "ld" crashing) and warn the
user about requirement to build with -O0 to avoid runtime crashes.

Related: OS#4062
Related: SYS#4628
Change-Id: I04ff8c702eabcf4f6e7b59e11aece2744267cefe
---
M configure.ac
M m4/check_tls_gcc_arm_bug.m4
2 files changed, 23 insertions(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Hoernchen: Looks good to me, but someone else must approve; Verified
  neels: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



diff --git a/configure.ac b/configure.ac
index 3764e29..7ad5908 100644
--- a/configure.ac
+++ b/configure.ac
@@ -123,8 +123,7 @@
 CHECK_TM_INCLUDES_TM_GMTOFF
 
 dnl Check if We need to apply workaround for TLS bug on ARM platform for GCC < 7.3.0:
-CHECK_TLS_GCC_ARM_BUG
-CFLAGS="$CFLAGS $TLS_GCC_ARM_BUG_CFLAGS"
+ARG_ENABLE_DETECT_TLS_GCC_ARM_BUG
 
 dnl Generate the output
 AC_CONFIG_HEADER(config.h)
diff --git a/m4/check_tls_gcc_arm_bug.m4 b/m4/check_tls_gcc_arm_bug.m4
index 73b3e95..cee20e6 100644
--- a/m4/check_tls_gcc_arm_bug.m4
+++ b/m4/check_tls_gcc_arm_bug.m4
@@ -27,3 +27,25 @@
   AC_SUBST([TLS_GCC_ARM_BUG_CFLAGS])
   AC_MSG_RESULT([$TLS_GCC_ARM_BUG_CFLAGS])
 ])
+
+# Allow disabling the check in order to workaround bug by letting user pass
+# CFLAGS="-O0" on toolchains that crash when "-mtls-dialect=gnu2" is used.
+# CFLAGS is updated with workaround if detection is enabled and workaround is needed.
+AC_DEFUN([ARG_ENABLE_DETECT_TLS_GCC_ARM_BUG], [
+  AC_ARG_ENABLE(detect_tls_gcc_arm_bug,
+    [AS_HELP_STRING(
+      [--disable-detect-tls-gcc-arm-bug],
+      [Disable detecting and applying workaround for TLS bug on ARM platform for GCC < 7.3.0]
+    )],
+    [detect_tls_gcc_arm_bug=$enableval], [detect_tls_gcc_arm_bug="yes"])
+  if test x"$detect_tls_gcc_arm_bug" = x"yes"; then
+    CHECK_TLS_GCC_ARM_BUG
+    if test "x$TLS_GCC_ARM_BUG_CFLAGS" != "x"; then
+      CFLAGS="$CFLAGS $TLS_GCC_ARM_BUG_CFLAGS"
+      AC_MSG_WARN([Applying workaround for TLS bug on ARM platform for GCC < 7.3.0
+                  ($TLS_GCC_ARM_BUG_CFLAGS). On some toolchain versions, ld may
+                  crash. In that case you must build with CFLAGS='-O0' and run
+                  ./configure with --disable-detect-tls-gcc-arm-bug])
+    fi
+fi
+])

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/15061
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I04ff8c702eabcf4f6e7b59e11aece2744267cefe
Gerrit-Change-Number: 15061
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Hoernchen <ewild at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190806/86dc9956/attachment.htm>


More information about the gerrit-log mailing list