[PATCH v3] newlib: fix build with <gcc-5 versions
Mike Frysinger
vapier@gentoo.org
Tue Mar 15 23:53:48 GMT 2022
__builtin_mul_overflow showed up with gcc-5, so stub it out for older
versions.
---
v3
- use style from Richard Earnshaw to avoid gcc-specific syntax
newlib/libc/include/sys/cdefs.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h
index da729092185c..79bce1d1d78d 100644
--- a/newlib/libc/include/sys/cdefs.h
+++ b/newlib/libc/include/sys/cdefs.h
@@ -416,6 +416,10 @@
#define __unreachable() ((void)0)
#endif
+#if !__GNUC_PREREQ__(5, 0)
+#define __builtin_mul_overflow(a, b, size) (*(size) = (a) * (b), 0)
+#endif
+
/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
#define __func__ NULL
--
2.34.1
More information about the Newlib
mailing list