-
Notifications
You must be signed in to change notification settings - Fork 3
A small self-compiling arm/x86-64 C compiler, linker, C library and ELF loader for command line or library use on macOS, Linux or bare metal
License
ghaerr/ncc
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The NCC Project =============== NCC is an experimental project combining the amazing work of Ali Rudi's neatcc C compiler, neatld ELF linker, and neatlibc C library with an ELF loader for macOS, allowing tiny binaries to be created for direct execution on macOS or Linux, and eventually bare metal. This project is a combined fork of Ali's separate repos to eventually allow the system to be used as a library for extending the functionality of programs by compiling and linking into a running process, or used as a tiny self-compiling language system for bare metal. The C compiler supports a large subset of ANSI C, but most importantly lacks support for bitfields, inline assembly and floating point types. The compiler supports direct optimized compilation into ELF object files for Aarch64 and Intel x86-64, and uses a tiny linker to create static ELF binaries for macOS or Linux. Since the output format is ELF, macOS requires an ELF loader. The application code, data, heap and stack segments can be configured for execution in various parts of the 64-bit address space. The included C library is self-hosted and makes direct system calls to macOS or Linux, producing binaries with no dependencies on any shared libraries. Shared libraries are purposely not supported, for simplification of compiler output and speed. For now, the startup and syscall parts of the C library are assembled using nasm for x86-64, and the included neatas assembler for Aarch64. The compiler output itself is direct to ELF object, no need for assembly. BUILDING ======== Since development has just started and is being done on macOS, currently only macOS has been tested (that should change soon). To build for use on a hosted system: $ make neat # build neatcc, ncc, nld, neatas, libc.a and runs demo/test.c $ make test # run compiler test suite DIRECTORY STRUCTURE =================== neatrun/ Compiler driver 'neatcc' neatcc/ Compiler 'ncc' neatld/ Linker 'nld' neatas/ Aarch64 assembler 'neatas' neatlibc/ C startup and library for Linux and macOS 'start.o/libc.a' neatdbg/ Debug tools demo/ Demo programs test/ Compiler test suite ldelf/ ELF loader for non-ELF systems LICENSE ======= ISC License
About
A small self-compiling arm/x86-64 C compiler, linker, C library and ELF loader for command line or library use on macOS, Linux or bare metal
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published