Fix Ruby 3.1 build on sparc64, and possibly other GCC arches

Didn't build before on sparc64, so no bump. Not sure if it built before
on other GCC arches.  No effect on clang arches.
This commit is contained in:
jeremy 2022-01-18 19:51:19 +00:00
parent 743fc3b23f
commit c43f17ef16

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-include_ruby_internal_has_builtin_h,v 1.1 2022/01/18 19:51:19 jeremy Exp $
builtin_bswap32 and builtin_bswap64 don't appear to be
defined on OpenBSD/sparc64, and maybe other GCC arches.
Backport of upstream commit e7b4abf3845ef006653ef4b951454647e54affe8.
Index: include/ruby/internal/has/builtin.h
--- include/ruby/internal/has/builtin.h.orig
+++ include/ruby/internal/has/builtin.h
@@ -53,8 +53,10 @@
# define RBIMPL_HAS_BUILTIN___builtin_assume 0
# /* See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624 for bswap16. */
# define RBIMPL_HAS_BUILTIN___builtin_bswap16 RBIMPL_COMPILER_SINCE(GCC, 4, 8, 0)
+#ifndef __OpenBSD__
# define RBIMPL_HAS_BUILTIN___builtin_bswap32 RBIMPL_COMPILER_SINCE(GCC, 3, 6, 0)
# define RBIMPL_HAS_BUILTIN___builtin_bswap64 RBIMPL_COMPILER_SINCE(GCC, 3, 6, 0)
+#endif
# define RBIMPL_HAS_BUILTIN___builtin_clz RBIMPL_COMPILER_SINCE(GCC, 3, 6, 0)
# define RBIMPL_HAS_BUILTIN___builtin_clzl RBIMPL_COMPILER_SINCE(GCC, 3, 6, 0)
# define RBIMPL_HAS_BUILTIN___builtin_clzll RBIMPL_COMPILER_SINCE(GCC, 3, 6, 0)