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.
File's header resides at the beginning and has informations about size and position of each section, besides global module information. The format is:
Size | Description |
---|---|
16 bytes | File's MD5 fingerprint/message-digest |
4 bytes | EM04 - ID (Executable Module 0.4) |
4 bytes | Thread stack size |
4 bytes | Module code start |
4 bytes | Module code size |
4 bytes | Module RO data start |
4 bytes | Module RO data size |
4 bytes | Module data start |
4 bytes | Module data size |
4 bytes | Module uninitialized data size |
4 bytes | Used functions section start |
4 bytes | Used functions section size |
4 bytes | Used functions relocation section start |
4 bytes | Used functions relocation section size |
4 bytes | File's strings section start |
2 bytes | File's strings section size |
2 bytes | Comment 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.
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.
This section holds information about functions used by the module.
Each entry has this format:
Size | Description |
---|---|
2 bytes | Interface name index |
2 bytes | Implementation name index |
3 bytes | Function number |
1 byte | Function properties |
The interface name and the implementation name can have at most 32 chars each including the terminating zero.
Properties can be:
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:
Size | Description |
---|---|
4 bytes | Offset inside code where the function is called |
1 byte | Relocation properties |
3 bytes | Used function index |
Properties can be:
Size | Position | Description |
---|---|---|
1 bit | bit 0 | 1 - 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.