The compiler now supports running compiled executables in QEMU user mode emulation.
python3 compiler.py test_simd_2.c -o test_simd_2 --qemuThis will:
- Compile the C file to assembly
- Assemble and link it
- Automatically run it in QEMU user mode
./build.sh output.asm output qemu# First compile and build normally
python3 compiler.py test_simd_2.c -o test_simd_2
# Then run in QEMU
./run_qemu.sh test_simd_2On Debian/Ubuntu:
sudo apt-get install qemu-userOn RHEL/CentOS/Fedora:
sudo yum install qemu-user
# or
sudo dnf install qemu-userqemu-x86_64 --version- Fixed
_startfunction: Now properly callsmain()and exits with the return code - Added exit system call: Programs now properly terminate using
sys_exit(syscall 60) - QEMU integration: Added
--qemuflag to compiler and helper scripts
The compiler generates ELF64 executables that can run in:
- Native mode: Directly on your Linux system (
./output) - QEMU user mode: Emulated execution (
qemu-x86_64 output)
QEMU user mode is useful for:
- Testing on different architectures
- Debugging and isolation
- Cross-platform development
Install QEMU user mode (see Installation section above).
You have QEMU system mode but need user mode. Install qemu-user package.
- Check that your program has a
main()function - Verify the program exits properly (the compiler now adds exit system calls automatically)
- Try running natively first:
./output
QEMU user mode translates system calls to the host system. Some advanced system calls may not be fully supported.