Skip to content

Commit ef817df

Browse files
authored
[mono] Add an 'allow-errors' AOT option. (#64640)
This can be used to avoid aborting the AOT process if a loader error occurs. The methods which fail to load will not be AOTed and the failures will happen at runtime. Related: #63654
1 parent d936a66 commit ef817df

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/mono/mono/mini/aot-compiler.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ typedef struct MonoAotOptions {
230230
gboolean stats;
231231
gboolean verbose;
232232
gboolean deterministic;
233+
gboolean allow_errors;
233234
char *tool_prefix;
234235
char *ld_flags;
235236
char *ld_name;
@@ -528,7 +529,7 @@ report_loader_error (MonoAotCompile *acfg, MonoError *error, gboolean fatal, con
528529
va_end (args);
529530
mono_error_cleanup (error);
530531

531-
if (acfg->is_full_aot && fatal) {
532+
if (acfg->is_full_aot && !acfg->aot_opts.allow_errors && fatal) {
532533
fprintf (output, "FullAOT cannot continue if there are loader errors.\n");
533534
exit (1);
534535
}
@@ -8504,6 +8505,8 @@ mono_aot_parse_options (const char *aot_options, MonoAotOptions *opts)
85048505
opts->profile_only = TRUE;
85058506
} else if (!strcmp (arg, "verbose")) {
85068507
opts->verbose = TRUE;
8508+
} else if (!strcmp (arg, "allow-errors")) {
8509+
opts->allow_errors = TRUE;
85078510
} else if (str_begins_with (arg, "llvmopts=")){
85088511
if (opts->llvm_opts) {
85098512
char *s = g_strdup_printf ("%s %s", opts->llvm_opts, arg + strlen ("llvmopts="));
@@ -8587,6 +8590,7 @@ mono_aot_parse_options (const char *aot_options, MonoAotOptions *opts)
85878590
printf (" threads=\n");
85888591
printf (" write-symbols\n");
85898592
printf (" verbose\n");
8593+
printf (" allow-errors\n");
85908594
printf (" no-opt\n");
85918595
printf (" llvmopts=\n");
85928596
printf (" llvmllc=\n");

0 commit comments

Comments
 (0)