-
Notifications
You must be signed in to change notification settings - Fork 3
/
README
60 lines (46 loc) · 2.29 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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