Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Mono AOT image

From ReverseEngineering.wiki
Format
Developer Mono / Xamarin / Microsoft
Versions MONO_AOT_FILE_VERSION 187 (dotnet/runtime main)
License MIT
On this wiki Facts · Code · Notes · Topics

Mono's ahead-of-time output: a native shared object or Mach-O/ELF (assembly.dll.so, assembly.dll.dylib, or statically linked into the app on iOS) exporting the symbol mono_aot_file_info (MonoAotFileInfo: format version 187, flags, code range, GOT/PLT sizes, tables) that the runtime matches to the original IL assembly by GUID; the IL assembly is still required.

What it is

The Mono AOT compiler (mono --aot, used by Xamarin.iOS/Android and .NET MAUI, Unity's older AOT, WebAssembly) compiles the methods of an assembly into native code stored in a separate image next to the IL assembly. On iOS, where code must be linked statically, the same data is linked into the app binary and registered at startup. The IL and metadata stay in the original .dll (unless stripped), so IL decompilers still work; the AOT image only matters for native code or when IL is stripped. Files on Android: libaot-<Assembly>.dll.so inside the APK (see Format:Xamarin and .NET for Android assembly store); on desktops <Assembly>.dll.so / .dylib.

Identification

From src/mono/mono/mini/aot-runtime.c/.h (dotnet/runtime): the module exports mono_aot_file_info (older format: a string mono_aot_version), and for static linking mono_aot_module_<NAME>_info. The first u32 is the format version (MONO_AOT_FILE_VERSION, 187 in main); the loader reports 'wrong file format version (expected %d got %d)' on mismatch. In 'static mode' a globals table (hash index + name/pointer pairs) replaces dynamic symbol lookup.

MonoAotFileInfo begins with version, dummy, then pointers (jit_got, mono_eh_frame, llvm entry points, jit_code_start, jit_code_end, method_addresses, ... blob and eleven data tables, assembly_guid, runtime_version, trampoline blocks, globals, assembly_name, plt, plt_end, unwind_info, unbox trampolines) and scalars (plt/got offsets and sizes, nmethods, nextra_methods, flags, opts, simd_opts, gc_name_index, alignment checks, tramp_page_size, call_table_entry_size ...). See Fact:Mono AOT image/struct/MonoAotFileInfo and Fact:Mono AOT image/enum/MonoAotFileFlags.

Modes

Flags: WITH_LLVM 1, FULL_AOT 2 (no JIT fallback), DEBUG 4, LLVM_THUMB 8, LLVM_ONLY 16, SAFEPOINTS 32, SEPARATE_DATA 64 (data in <assembly>.aotdata), EAGER_LOAD 128, INTERP 256 (interpreter + AOT, used by iOS/WASM), CODE_EXEC_ONLY 512, COMPRESSED_INTERFACE_BITMAP 1024. Method flags: HAS_CCTOR, GSHAREDVT_VARIABLE, HAS_PATCHES, HAS_CTX, INTERP_ENTRY_ONLY, HAS_LLVM_INTRINSICS. Tables (MonoAotFileTable): BLOB, CLASS_NAME, CLASS_INFO_OFFSETS, METHOD_INFO_OFFSETS, EX_INFO_OFFSETS, EXTRA_METHOD_INFO_OFFSETS, EXTRA_METHOD_TABLE, GOT_INFO_OFFSETS, LLVM_GOT_INFO_OFFSETS, IMAGE_TABLE, WEAK_FIELD_INDEXES, METHOD_FLAGS_TABLE.

Reversing tips

  • Map method_addresses (indexed by method number from the MethodDef table order) to the Method rows of the IL assembly to name functions: native function i corresponds to MethodDef i+1 (Unverified: derived from reading aot-runtime.c structure names, not tested on a real image).
  • Calls go through the PLT; PLT entries refer to GOT info that names the callee via got_info_offsets.
  • With INTERP flag the app may carry little native code; interpretation then happens over IL, so see Format:.NET metadata (ECMA-335).
  • Compare Format:.NET ReadyToRun (CoreCLR's own AOT) and Technique:Identifying .NET NativeAOT executables. Mono runtime overview: Library:Mono.

Code & repositories

  • https://github.com/dotnet/runtime @ ec0059c08c077e839c6eb8827c846530a891d7e2 · license: MIT
    dotnet/runtime: docs/design/coreclr/botr/readytorun-format.md and src/coreclr/inc/readytorun.h (ReadyToRun), src/coreclr/nativeaot (ModuleHeaders.h) and tools/aot ILCompiler sources (NativeAOT sections), src/mono/mono/mini/aot-runtime.[ch] (Mono AOT).
    Tested on: source read, not run: Read at this commit (October 2026); not built. · checked 2026-10-18; last activity 2026-10-18