[Bug #18286] Make builtin binary if sharable in universal binaries

This commit is contained in:
Nobuyoshi Nakada 2023-10-19 20:23:58 +09:00
Родитель e2ef85b109
Коммит 22939382a8
5 изменённых файлов: 31 добавлений и 6 удалений

Просмотреть файл

@ -3,15 +3,15 @@
#include "iseq.h"
#include "builtin.h"
#ifdef CROSS_COMPILING
#include "builtin_binary.inc"
#ifndef BUILTIN_BINARY_SIZE
#define INCLUDED_BY_BUILTIN_C 1
#include "mini_builtin.c"
#else
#include "builtin_binary.inc"
static const unsigned char *
bin4feature(const struct builtin_binary *bb, const char *feature, size_t *psize)
{

Просмотреть файл

@ -1301,9 +1301,12 @@ preludes: {$(srcdir)}golf_prelude.c
$(ECHO) making $@
$(Q) $(BASERUBY) $(tooldir)/mk_builtin_loader.rb $<
builtin_binary.inc: $(PREP) $(BUILTIN_RB_SRCS) $(srcdir)/template/builtin_binary.inc.tmpl
$(BUILTIN_BINARY:yes=built)in_binary.inc: $(PREP) $(BUILTIN_RB_SRCS) $(srcdir)/template/builtin_binary.inc.tmpl
$(Q) $(MINIRUBY) $(tooldir)/generic_erb.rb -o $@ \
$(srcdir)/template/builtin_binary.inc.tmpl -- --cross=$(CROSS_COMPILING)
$(srcdir)/template/builtin_binary.inc.tmpl
$(BUILTIN_BINARY:no=builtin)_binary.inc:
$(Q) echo> $@ // empty $(@F)
$(BUILTIN_RB_INCS): $(top_srcdir)/tool/mk_builtin_loader.rb

Просмотреть файл

@ -1489,6 +1489,25 @@ RUBY_CHECK_SIZEOF(float)
RUBY_CHECK_SIZEOF(double)
RUBY_CHECK_SIZEOF(time_t, [long "long long"], [], [@%:@include <time.h>])
RUBY_CHECK_SIZEOF(clock_t, [], [], [@%:@include <time.h>])
AC_SUBST(X_BUILTIN_BINARY, yes)
AS_IF([test "$cross_compiling" = yes],
[dnl miniruby cannot run if cross compiling
X_BUILTIN_BINARY=no
],
[
AS_CASE([ac_cv_sizeof_voidp],
[[1-9]*], [dnl fixed value
],
[
AC_CACHE_CHECK([word size], [rb_cv_word_size],
[for w in 4 8; do
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@if SIZEOF_VOIDP != ${w}
@%:@error SIZEOF_VOIDP
@%:@endif]])], [rb_cv_word_size=${w}; break])
done])
AS_IF([test -z $rb_cv_word_size], [X_BUILTIN_BINARY=no])
])
])
AC_CACHE_CHECK(packed struct attribute, rb_cv_packed_struct,
[rb_cv_packed_struct=no
@ -4482,7 +4501,7 @@ guard=INCLUDE_RUBY_CONFIG_H
{
echo "#ifndef $guard"
echo "#define $guard 1"
grep -v "^#define PACKAGE_" confdefs.h
sed "/^@%:@define PACKAGE_/d;s/ *$//" confdefs.h
echo "#endif /* $guard */"
} | tr -d '\015' |
(

Просмотреть файл

@ -65,6 +65,7 @@ rubyarchhdrdir = @rubyarchhdrdir@
ruby_version = @ruby_version@
RUBY_VERSION_NAME = @RUBY_VERSION_NAME@
UNIVERSAL_ARCHNAMES = @UNIVERSAL_ARCHNAMES@
BUILTIN_BINARY = @X_BUILTIN_BINARY@
TESTUI = console
TESTS =

Просмотреть файл

@ -433,8 +433,10 @@ THREAD_IMPL_SRC = thread_$(THREAD_MODEL).c
!if "$(CROSS_COMPILING)" == "yes"
PREP = $(arch)-fake.rb
BUILTIN_BINARY = no
!else
PREP = miniruby$(EXEEXT)
BUILTIN_BINARY = yes
!endif
!if !defined(EXTSTATIC)