Executable module file

This page describes the executable module file format version 0.4

The executable module file doesn't need to store informations about functions, because this functions are never used by other modules. So, the format is simple.

The file is made of sections: header, strings, used functions and used functions relocation.

Header

File's header resides at the beginning and has informations about size and position of each section, besides global module information. The format is:

SizeDescription
16 bytesFile's MD5 fingerprint/message-digest
4 bytesEM04 - ID (Executable Module 0.4)
4 bytesThread stack size
4 bytesModule code start
4 bytesModule code size
4 bytesModule RO data start
4 bytesModule RO data size
4 bytesModule data start
4 bytesModule data size
4 bytesModule uninitialized data size
4 bytesUsed functions section start
4 bytesUsed functions section size
4 bytesUsed functions relocation section start
4 bytesUsed functions relocation section size
4 bytesFile's strings section start
2 bytesFile's strings section size
2 bytesComment index

If a section has 0 size it doesn't exist. So, if data section has 0 size, module has no data.

The MD5 member is used to validate the rest of the file.

The thread stack size member is used to set the stack size in bytes of every thread created to execute this module. Size must be a power of 2, that is, 12 = 4096 bytes, 14 = 16384 bytes, etc and if it's zero a default value is used.

Uninitialized data have 0 as initial value.

File's strings

This section holds all used strings. Strings end with a 0 byte. Is the same type of string used in C/C++.

The first string must be the empty string, that is, the first section's byte is 0.

Strings in this section must be unique.

Used functions

This section holds information about functions used by the module.

Each entry has this format:

SizeDescription
2 bytesInterface name index
2 bytesImplementation name index
3 bytesFunction number
1 byteFunction properties

The interface name and the implementation name can have at most 32 chars each including the terminating zero.

Properties can be:

Used functions relocation

This section holds information about location and type of relocation to apply to call interfaces functions.

This section must be sorted by the offset in crescent order.

Each entry has this format:

SizeDescription
4 bytesOffset inside code where the function is called
1 byteRelocation properties
3 bytesUsed function index

Properties can be:

SizePositionDescription
1 bitbit 01 - absolute relocation; 0 - relative relocation

In absolute relocation used function start address is put in the offset.

In relative relocation used function start address is subtracted of the offset. It's a call relative to the current address.