https://github.com/dscmatter/aegiscc
A minimalistic x86-64 JIT compiler written in C++
https://github.com/dscmatter/aegiscc
assembly compilers cpp jit
Last synced: about 2 months ago
JSON representation
A minimalistic x86-64 JIT compiler written in C++
- Host: GitHub
- URL: https://github.com/dscmatter/aegiscc
- Owner: DSCmatter
- License: mit
- Created: 2024-12-05T12:06:11.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-24T13:04:07.000Z (over 1 year ago)
- Last Synced: 2025-03-24T14:22:38.633Z (over 1 year ago)
- Topics: assembly, compilers, cpp, jit
- Language: C++
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AegisCC
This project demonstrates how to dynamically generate and execute machine code at runtime using executable memory in C++. It includes examples of using machine code embedded in memory, dynamically generated assembly instructions, and calling functions from C++ at runtime.
---
## **Overview**
This program dynamically generates x86-64 assembly instructions to call a global function (`test`) that manipulates a global vector of integers. The machine code is stored in executable memory, and the program executes those instructions by casting the allocated memory to a function pointer.
---
### Prerequisites
- **Linux OS / WSL(used)**
- **g++ Compiler** (Install using: `sudo apt install g++`)
---
## **Steps to Run the Program**
1. Update the system packages:
```
sudo apt update
```
2. Install g++:
```
sudo apt install g++
```
3. Compile and run the programs:
C++ code:
```
g++ -o hello_1 hello_1.cpp
./hello_1
```
Assembly Code:
```
as chunk.s -o chunk.o
objdump -M intel -D chunk.o
```
### Outputs are given in 'read.txt' files in both part1 & part2
### Contributions
Any contributions are welcome! Feel free to fork the repository, submit issues, and create pull requests for improvements or fixes.