Change in ...libosmocore[master]: Workaround TLS gcc compiler bug in ARM

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
Thu Aug 1 16:29:28 UTC 2019


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/15025


Change subject: Workaround TLS gcc compiler bug in ARM
......................................................................

Workaround TLS gcc compiler bug in ARM

Version 8.1.0 is the oldest known to work. We can restrict it more in
the future if we find older versions working without the workaround.

Related: OS#4062
Change-Id: Icaac4b6628341effe9d488f907dc4d42897f2065
---
M src/utils.c
1 file changed, 15 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/25/15025/1

diff --git a/src/utils.c b/src/utils.c
index ea1de0f..b668a21 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -221,7 +221,19 @@
 	return nibblepos >> 1;
 }
 
+#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+
+#define HEXD_BUFF_SIZE 4096
+/* Check for ARM 32 BIT and gcc smaller than 8.1.0 */
+#if __arm__ && GCC_VERSION < 80100
+#pragma message ("ARM && GCC < 8.1.0, Initiallizing hexd_buff from heap, see OS#4062")
+static __thread void* hexd_buff;
+#define INIT_HEXD_BUFF() do { if (!hexd_buff) hexd_buff = talloc_size(NULL, HEXD_BUFF_SIZE); } while(0)
+#else
 static __thread char hexd_buff[4096];
+#define INIT_HEXD_BUFF() do {} while(0)
+#endif
+
 static const char hex_chars[] = "0123456789abcdef";
 
 /*! Convert binary sequence to hexadecimal ASCII string.
@@ -319,6 +331,7 @@
  */
 char *osmo_ubit_dump(const uint8_t *bits, unsigned int len)
 {
+	INIT_HEXD_BUFF();
 	return osmo_ubit_dump_buf(hexd_buff, sizeof(hexd_buff), bits, len);
 }
 
@@ -335,6 +348,7 @@
  */
 char *osmo_hexdump(const unsigned char *buf, int len)
 {
+	INIT_HEXD_BUFF();
 	osmo_hexdump_buf(hexd_buff, sizeof(hexd_buff), buf, len, " ", true);
 	return hexd_buff;
 }
@@ -374,6 +388,7 @@
  */
 char *osmo_hexdump_nospc(const unsigned char *buf, int len)
 {
+	INIT_HEXD_BUFF();
 	osmo_hexdump_buf(hexd_buff, sizeof(hexd_buff), buf, len, "", true);
 	return hexd_buff;
 }

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Icaac4b6628341effe9d488f907dc4d42897f2065
Gerrit-Change-Number: 15025
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190801/e362727b/attachment.htm>


More information about the gerrit-log mailing list