ARMCOM (.com) File Format
ARMCOM is an executable file format for ARM64 written for CS241. It contains ARM64 machine code, augmented with a table containing relocation and linking information. An ARMCOM .com file has three components, in this order:
- Header: Five halfwords, consisting of
- Magic: The halfword 0x14000005, which is the encoding of the ARM64 instruction b 20.
- EndModule: One word (two halfwords) storing the in bytes of the ARMCOM file.
- EndCode: One word (two halfwords) storing the length of the machine code plus the header (i.e., the location of the end of the code in the file), in bytes.
- ARM64 program: An ARM64 program encoded so that it will execute correctly when loaded at the RAM address 0x14. This is the size of the header, so the implication is that the entire ARMCOM file will run if loaded at address 0x0.
- Footer: Also known as the relocation and linking table. Zero or more table entries in one of the following formats:
- Relocation entry: Two words, in the following format:
- Format code: The value 0x1.
- Location:The location in the ARMCOM file where the relocatable value is encoded.
- External symbol reference: A symbol which needs to be imported from another ARMCOM file, consisting of the following words:
- Format code: The value 0x11.
- Location: The location in the ARMCOM file where the value of the symbol is to be encoded, once known.
- Length: The length of the symbol name.
- Name: The name of the symbol, with one character encoded per word.
- External symbol definition: A symbol which is exported to other ARMCOM files, consisting of the following words:
- Format code: The value 0x12.
- Location: The location in the ARMCOM file where the symbol is defined.
- Length: The length of the symbol name.
- Name: The name of the symbol, with one character encoded per word.