<p>pespin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/15025">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Workaround TLS gcc compiler bug in ARM<br><br>Version 8.1.0 is the oldest known to work. We can restrict it more in<br>the future if we find older versions working without the workaround.<br><br>Related: OS#4062<br>Change-Id: Icaac4b6628341effe9d488f907dc4d42897f2065<br>---<br>M src/utils.c<br>1 file changed, 15 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/25/15025/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/utils.c b/src/utils.c</span><br><span>index ea1de0f..b668a21 100644</span><br><span>--- a/src/utils.c</span><br><span>+++ b/src/utils.c</span><br><span>@@ -221,7 +221,19 @@</span><br><span>        return nibblepos >> 1;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#define HEXD_BUFF_SIZE 4096</span><br><span style="color: hsl(120, 100%, 40%);">+/* Check for ARM 32 BIT and gcc smaller than 8.1.0 */</span><br><span style="color: hsl(120, 100%, 40%);">+#if __arm__ && GCC_VERSION < 80100</span><br><span style="color: hsl(120, 100%, 40%);">+#pragma message ("ARM && GCC < 8.1.0, Initiallizing hexd_buff from heap, see OS#4062")</span><br><span style="color: hsl(120, 100%, 40%);">+static __thread void* hexd_buff;</span><br><span style="color: hsl(120, 100%, 40%);">+#define INIT_HEXD_BUFF() do { if (!hexd_buff) hexd_buff = talloc_size(NULL, HEXD_BUFF_SIZE); } while(0)</span><br><span style="color: hsl(120, 100%, 40%);">+#else</span><br><span> static __thread char hexd_buff[4096];</span><br><span style="color: hsl(120, 100%, 40%);">+#define INIT_HEXD_BUFF() do {} while(0)</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static const char hex_chars[] = "0123456789abcdef";</span><br><span> </span><br><span> /*! Convert binary sequence to hexadecimal ASCII string.</span><br><span>@@ -319,6 +331,7 @@</span><br><span>  */</span><br><span> char *osmo_ubit_dump(const uint8_t *bits, unsigned int len)</span><br><span> {</span><br><span style="color: hsl(120, 100%, 40%);">+  INIT_HEXD_BUFF();</span><br><span>    return osmo_ubit_dump_buf(hexd_buff, sizeof(hexd_buff), bits, len);</span><br><span> }</span><br><span> </span><br><span>@@ -335,6 +348,7 @@</span><br><span>  */</span><br><span> char *osmo_hexdump(const unsigned char *buf, int len)</span><br><span> {</span><br><span style="color: hsl(120, 100%, 40%);">+       INIT_HEXD_BUFF();</span><br><span>    osmo_hexdump_buf(hexd_buff, sizeof(hexd_buff), buf, len, " ", true);</span><br><span>       return hexd_buff;</span><br><span> }</span><br><span>@@ -374,6 +388,7 @@</span><br><span>  */</span><br><span> char *osmo_hexdump_nospc(const unsigned char *buf, int len)</span><br><span> {</span><br><span style="color: hsl(120, 100%, 40%);">+       INIT_HEXD_BUFF();</span><br><span>    osmo_hexdump_buf(hexd_buff, sizeof(hexd_buff), buf, len, "", true);</span><br><span>        return hexd_buff;</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/15025">change 15025</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/+/15025"/><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: Icaac4b6628341effe9d488f907dc4d42897f2065 </div>
<div style="display:none"> Gerrit-Change-Number: 15025 </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>