Skip to content

Commit

Permalink
[aot] Fix emission of external aot data by aligning tables in the file.
Browse files Browse the repository at this point in the history
The table reading code depends on data being aligned, so make sure it is.


Commit migrated from mono/mono@45a86f2
  • Loading branch information
rolfbjarne authored and vargaz committed Jan 6, 2016
1 parent 210ce2c commit e9fac08
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/mono/mono/mini/aot-compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -2338,6 +2338,12 @@ emit_aot_data (MonoAotCompile *acfg, MonoAotFileTable table, const char *symbol,
acfg->table_offsets [(int)table] = acfg->datafile_offset;
fwrite (data,1, size, acfg->data_outfile);
acfg->datafile_offset += size;
// align the data to 8 bytes. Put zeros in the file (so that every build results in consistent output).
int align = 8 - size % 8;
acfg->datafile_offset += align;
guint8 align_buf [16];
memset (&align_buf, 0, sizeof (align_buf));
fwrite (align_buf, align, 1, acfg->data_outfile);
} else if (acfg->llvm) {
mono_llvm_emit_aot_data (symbol, data, size);
} else {
Expand Down

0 comments on commit e9fac08

Please sign in to comment.