We are implementing a brand new executable format, .QR (quantr riscv format), which is specially designed for maximizing the efficacy of RISC-V assembled files during execution. The following will be the walkthrough of our concept and design.
Background
We all know that the most commonly used executable file formats are PE (on Microsoft Windows), ELF (on Linux and most other versions of Unix), Mach-O (on mac OS and iOS), and MZ (on DOS). All these executable file formats have a particular time of development, and there is no doubt about their accessibility and efficiency.
However, when it comes to dealing with RISC-V assembled files, although there are no significant defects with these formats, they failed to take advantage of the CPU to compile the files.
Another notable point is that currently all executable file formats are written in binary format, and the main advantage of this format is that the data can be read and written more efficiently. However, due to the rapid development of CPU technologies, the speed of CPU has been increasing a lot, and the benefits gained from binary format are fainting. Meanwhile, there are two critical defects of it:
- Hard to perform partial data transformation.
- Hard for human to read and understand, making it extremely difficult to edit and extend.
As a result of all the factors combined, we decided to create our new format, .QR (quantr), which aims to solve the shortcomings of other executable file formats while taking advantage of the CPU to speed up the reading and writing process of RISC-V assembly files.
Unique Features
The following are the key features of the Quantr RISC-V executable file format:
- Support custom field: the Quantr RISC-V executable file format has no format constraints and custom fields such as security fields or performance tuning fields, can be added.
- Executable transform: allow to sections to change positions in the file.
- Executable merge: allow users to merge multiple sections into one section.
- Executable trim down: trim down redundant data to free up space, such as ‘0’s used for alignment.
- Executable encrypt: encrypt the content in the file to enhance security.
- Dynamics PLT & GOT combination and optimization.
QR Library
We have implemented a library for processing the Java Structure of our format, QR.
Since we mainly use Java to develop our toolchain, such as our RISC-V simulator, we will also use it to build our library to reduce the program’s complexity.
In our library, we used Jackson to serialize and deserialize the structure of our format and Jsonata as the JSON query language.