Skip to content

Commit 921132a

Browse files
authored
[runtime] Make icall tables loadable. (mono#6905)
* [runtime] Make icall tables loadable. Move the icall table code into a separate icall-table.c file, which is either linked into libmono or compiled into a separate libmono-icall-table.a archive which can be linked into an app, and installed by calling mono_icall_table_init (). * Change ClCompile to ClInclude for new .h file.
1 parent d8beb3e commit 921132a

8 files changed

Lines changed: 542 additions & 398 deletions

File tree

configure.ac

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4181,6 +4181,8 @@ if test "x$icall_tables" = "xno"; then
41814181
AC_DEFINE(DISABLE_ICALL_TABLES, 1, [Icall tables disabled])
41824182
fi
41834183

4184+
AM_CONDITIONAL(DISABLE_ICALL_TABLES, test x$icall_tables = xno)
4185+
41844186
if test "x$with_tls" = "x__thread"; then
41854187
AC_DEFINE(HAVE_KW_THREAD, 1, [Have __thread keyword])
41864188
# Pass the information to libgc

mono/metadata/Makefile.am

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,14 @@ if SUPPORT_BOEHM
7777
boehm_libraries = libmonoruntime.la
7878
endif
7979

80+
if DISABLE_ICALL_TABLES
81+
icall_table_libraries = libmono-icall-table.la
82+
endif
83+
8084
noinst_LTLIBRARIES = libmonoruntime-config.la $(boehm_libraries) $(sgen_libraries)
8185

86+
lib_LTLIBRARIES = $(icall_table_libraries)
87+
8288
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/mono $(LIBGC_CPPFLAGS) $(GLIB_CFLAGS) $(SHARED_CFLAGS)
8389

8490
#
@@ -99,6 +105,14 @@ libmonoruntime_config_la_SOURCES = \
99105
mono-config-dirs.c
100106
libmonoruntime_config_la_CPPFLAGS = $(AM_CPPFLAGS) -DMONO_BINDIR=\"$(bindir)/\" -DMONO_ASSEMBLIES=\"$(assembliesdir)\" -DMONO_CFG_DIR=\"$(confdir)\" -DMONO_RELOC_LIBDIR=\"../$(reloc_libdir)\"
101107

108+
#
109+
# This library contains the icall tables if the runtime was configured with --disable-icall-tables
110+
#
111+
if DISABLE_ICALL_TABLES
112+
libmono_icall_table_la_SOURCES = \
113+
icall-table.c
114+
endif
115+
102116
CLEANFILES = mono-bundle.stamp
103117

104118
null_sources = \
@@ -109,6 +123,11 @@ null_gc_sources = \
109123
null-gc-handles.h \
110124
null-gc-handles.c
111125

126+
if !DISABLE_ICALL_TABLES
127+
icall_tables_sources = \
128+
icall-table.c
129+
endif
130+
112131
common_sources = \
113132
$(platform_sources) \
114133
appdomain.c \
@@ -157,6 +176,7 @@ common_sources = \
157176
icall.c \
158177
icall-internals.h \
159178
icall-def.h \
179+
icall-table.h \
160180
image.c \
161181
image-internals.h \
162182
jit-info.c \
@@ -299,11 +319,11 @@ sgen_sources = \
299319
sgen-mono.c \
300320
sgen-client-mono.h
301321

302-
libmonoruntime_la_SOURCES = $(common_sources) $(gc_dependent_sources) $(null_gc_sources) $(boehm_sources)
322+
libmonoruntime_la_SOURCES = $(common_sources) $(icall_tables_sources) $(gc_dependent_sources) $(null_gc_sources) $(boehm_sources)
303323
libmonoruntime_la_CFLAGS = $(BOEHM_DEFINES)
304324
libmonoruntime_la_LIBADD = libmonoruntime-config.la
305325

306-
libmonoruntimesgen_la_SOURCES = $(common_sources) $(gc_dependent_sources) $(sgen_sources)
326+
libmonoruntimesgen_la_SOURCES = $(common_sources) $(icall_tables_sources) $(gc_dependent_sources) $(sgen_sources)
307327
libmonoruntimesgen_la_CFLAGS = $(SGEN_DEFINES)
308328
libmonoruntimesgen_la_LIBADD = libmonoruntime-config.la
309329

mono/metadata/class-internals.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ typedef struct _MonoDynamicMethod MonoDynamicMethod;
4242
#define ICALL_EXPORT MONO_API
4343
#else
4444
#define ICALL_DECL_EXPORT
45-
#define ICALL_EXPORT static
45+
/* Can't be static as icall.c defines icalls referenced by icall-tables.c */
46+
#define ICALL_EXPORT
4647
#endif
4748

4849
typedef enum {

0 commit comments

Comments
 (0)