<p>pespin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/15061">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">configure: Allow disabling workaround for TLS bug in old ARM gcc versions<br><br>Some toolchains (such as sysmobts 201705 one) containing the TLS bug on<br>old ARM gcc versions (<7.3.0) also crash if the initial workaround found<br>is aplied (CFLAGS="-mtls-dialect=gnu2"). In that scenario, let's provide<br>a way to disable the workaround (to avoid "ld" crashing) and warn the<br>user about requirement to build with -O0 to avoid runtime crashes.<br><br>Related: OS#4062<br>Related: SYS#4628<br>Change-Id: I04ff8c702eabcf4f6e7b59e11aece2744267cefe<br>---<br>M configure.ac<br>M m4/check_tls_gcc_arm_bug.m4<br>2 files changed, 23 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/61/15061/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/configure.ac b/configure.ac</span><br><span>index 3764e29..7ad5908 100644</span><br><span>--- a/configure.ac</span><br><span>+++ b/configure.ac</span><br><span>@@ -123,8 +123,7 @@</span><br><span> CHECK_TM_INCLUDES_TM_GMTOFF</span><br><span> </span><br><span> dnl Check if We need to apply workaround for TLS bug on ARM platform for GCC < 7.3.0:</span><br><span style="color: hsl(0, 100%, 40%);">-CHECK_TLS_GCC_ARM_BUG</span><br><span style="color: hsl(0, 100%, 40%);">-CFLAGS="$CFLAGS $TLS_GCC_ARM_BUG_CFLAGS"</span><br><span style="color: hsl(120, 100%, 40%);">+ARG_ENABLE_DETECT_TLS_GCC_ARM_BUG</span><br><span> </span><br><span> dnl Generate the output</span><br><span> AC_CONFIG_HEADER(config.h)</span><br><span>diff --git a/m4/check_tls_gcc_arm_bug.m4 b/m4/check_tls_gcc_arm_bug.m4</span><br><span>index 73b3e95..cee20e6 100644</span><br><span>--- a/m4/check_tls_gcc_arm_bug.m4</span><br><span>+++ b/m4/check_tls_gcc_arm_bug.m4</span><br><span>@@ -27,3 +27,25 @@</span><br><span>   AC_SUBST([TLS_GCC_ARM_BUG_CFLAGS])</span><br><span>   AC_MSG_RESULT([$TLS_GCC_ARM_BUG_CFLAGS])</span><br><span> ])</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Allow disabling the check in order to workaround bug by letting user pass</span><br><span style="color: hsl(120, 100%, 40%);">+# CFLAGS="-O0" on toolchains that crash when "-mtls-dialect=gnu2" is used.</span><br><span style="color: hsl(120, 100%, 40%);">+# CFLAGS is updated with workaround if detection is enabled and workaround is needed.</span><br><span style="color: hsl(120, 100%, 40%);">+AC_DEFUN([ARG_ENABLE_DETECT_TLS_GCC_ARM_BUG], [</span><br><span style="color: hsl(120, 100%, 40%);">+  AC_ARG_ENABLE(detect_tls_gcc_arm_bug,</span><br><span style="color: hsl(120, 100%, 40%);">+    [AS_HELP_STRING(</span><br><span style="color: hsl(120, 100%, 40%);">+      [--disable-detect-tls-gcc-arm-bug],</span><br><span style="color: hsl(120, 100%, 40%);">+      [Disable detecting and applying workaround for TLS bug on ARM platform for GCC < 7.3.0]</span><br><span style="color: hsl(120, 100%, 40%);">+    )],</span><br><span style="color: hsl(120, 100%, 40%);">+    [detect_tls_gcc_arm_bug=$enableval], [detect_tls_gcc_arm_bug="yes"])</span><br><span style="color: hsl(120, 100%, 40%);">+  if test x"$detect_tls_gcc_arm_bug" = x"yes"; then</span><br><span style="color: hsl(120, 100%, 40%);">+    CHECK_TLS_GCC_ARM_BUG</span><br><span style="color: hsl(120, 100%, 40%);">+    if test "x$TLS_GCC_ARM_BUG_CFLAGS" != "x"; then</span><br><span style="color: hsl(120, 100%, 40%);">+      CFLAGS="$CFLAGS $TLS_GCC_ARM_BUG_CFLAGS"</span><br><span style="color: hsl(120, 100%, 40%);">+      AC_MSG_WARN([Applying workaround for TLS bug on ARM platform for GCC < 7.3.0</span><br><span style="color: hsl(120, 100%, 40%);">+                  ($TLS_GCC_ARM_BUG_CFLAGS). On some toolchain versions, ld may</span><br><span style="color: hsl(120, 100%, 40%);">+                  crash. In that case you must build with CFLAGS='-O0' and run</span><br><span style="color: hsl(120, 100%, 40%);">+                  ./configure with --disable-detect-tls-gcc-arm-bug])</span><br><span style="color: hsl(120, 100%, 40%);">+    fi</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+])</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/15061">change 15061</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/libosmocore/+/15061"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I04ff8c702eabcf4f6e7b59e11aece2744267cefe </div>
<div style="display:none"> Gerrit-Change-Number: 15061 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>