Skip to content

NeverSight/NeverC

Repository files navigation

Languages: English | 简体中文 | 繁體中文 | 日本語 | 한국어 | Français | Deutsch | Español | Italiano | Русский | العربية

NeverC

The AI-friendly C23 compiler for security research, built on LLVM

Integrated linker · Shellcode pipeline · Built-in runtimes (string · mimalloc · xorstr)

AGPL-3.0 C23 Platform Arch

Documentation · Shellcode Guide · Built-in Runtimes · Plugin API · Roadmap


Note: GitHub always shows README.md as the repository homepage (no automatic locale detection). Use the language links above; follow in-page links and breadcrumbs to keep the same locale in docs and the shellcode guide.

Overview

NeverC compiles standard C into hosted binaries, freestanding executables, and position-independent shellcode — all from a single toolchain. It targets x86_64 and AArch64 (little-endian only). Future releases will add EVM (Ethereum smart contracts) and Solana eBPF (on-chain programs) as compilation targets.

Why NeverC?

C is already the simplest systems language. NeverC makes it even simpler:

  • Pure C23, nothing more — No templates, no RAII, no operator overloading, no hidden control flow. What you read is what runs.
  • Built-in string — Value-semantic strings with +, ==, .starts_with() and automatic cleanup — no C++ required.
  • No exceptions — Error handling stays explicit. No stack unwinding, no performance surprises.
  • Single binary — Compiler + linker + runtimes ship as one executable. Zero external dependencies to set up.
  • LLM-friendly — Minimal grammar and deterministic semantics mean AI-generated NeverC code compiles correctly more often than C++ alternatives.
  • True cross-compilation — Build Windows PE, Linux ELF, macOS Mach-O, Android ELF, and shellcode from macOS or Linux — no VM, no dual boot, no SDK hunting. Platform SDKs ship inside the compiler.
  • Extensible with zero friction — A single C header, 20+ hook points, and you have a compiler plugin that can intercept any stage from IR optimization to final binary output — no LLVM knowledge needed.
  • Security research built in — Shellcode compilation, compile-time string encryption, and cross-platform PE generation are native to the toolchain — not afterthoughts bolted on with external scripts.

Features

  • Shellcode compiler — multi-stage IR/MIR pipeline, cross-platform extraction, import/syscall lowering, kernel-mode support, bad-byte auditing, and a plugin architecture
  • Integrated linker — COFF, ELF, and Mach-O in one binary; no external ld or link.exe
  • Cross-compilation — build Windows PE, Linux ELF, macOS Mach-O, and Android ELF from any host with bundled platform SDKs
  • Built-in runtimes — opt-in LLVM bitcode runtimes embedded in the compiler: string (value-semantic string with dot-call methods and automatic memory management), mimalloc (transparent high-performance allocator override), and xorstr (compile-time string encryption with anti-signature decryption)
  • Plugin API — pure C ABI for out-of-tree pass plugins; single-header SDK with zero LLVM/CRT dependencies, supporting IR, MIR, binary, and linker hook points
  • .nc extension — use .nc as file extension to auto-enable all NeverC features (string, Rust-style integer types) without extra flags
  • Lean LLVM build — only x86_64 and AArch64 backends; C++/ObjC/OpenMP paths stripped

Quick Example

#include <stdio.h>

typedef struct { string user; string pass; } creds;

int main(void) {
    string msg = "Hello " + "NeverC!";
    printf("%s\n", msg.c_str());

    // Compile-time encryption — `strings ./bin` cannot find these literals
    creds login = {.user = "admin".encrypt(), .pass = "s3cret".encrypt()};
    string paths[] = {"/api/v1".encrypt(), "/api/v2".encrypt()};

    // Zero-allocation decrypt-and-compare (plaintext never fully in memory)
    if (login.user == "admin".encrypt() && login.pass == "s3cret".encrypt()) {
        for (int i = 0; i < 2; i++)
            if (msg.starts_with(paths[i]))
                printf("route matched: %s\n", paths[i].c_str());
    }
    return 0;
}

Note: The built-in string type requires -fbuiltin-string for .c files. It is enabled automatically for .nc files and in -fshellcode mode.

# macOS arm64 / x86_64
neverc -fshellcode -target arm64-apple-macos hello.c -o hello.bin
neverc -fshellcode -target x86_64-apple-macos hello.c -o hello.bin

# iOS arm64
neverc -fshellcode -target arm64-apple-ios hello.c -o hello.bin

# Linux x86_64 / arm64
neverc -fshellcode -target x86_64-linux-gnu hello.c -o hello.bin
neverc -fshellcode -target aarch64-linux-gnu hello.c -o hello.bin

# Android arm64 / x86_64
neverc -fshellcode -target aarch64-linux-android hello.c -o hello.bin
neverc -fshellcode -target x86_64-linux-android hello.c -o hello.bin

# Windows x86_64 / arm64
neverc -fshellcode -target x86_64-pc-windows-msvc hello.c -o hello.bin
neverc -fshellcode -target aarch64-pc-windows-msvc hello.c -o hello.bin

See the documentation index for detailed design notes, platform matrix, CLI reference, and examples. For complete buildable samples, see the examples directory.

Building

See Local Development for build requirements, build commands, prebuilt macOS binaries, cross-compiling to Windows, PATH setup, and environment configuration.

Contributing

The default development branch is dev. Clone and check it out before you start work; open pull requests against dev.

git clone https://github.com/NeverSight/NeverC.git
cd NeverC
git checkout dev

License

AGPL-3.0

LLVM components retain their Apache-2.0 WITH LLVM-exception license.

About

The AI-friendly C23 compiler for security research, built on LLVM [WIP]

Resources

License

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors