fil-c README

项目的 README,来自 github.com/pizlonator/fil-c。合并为一个 markdown 文件:README.md。

Fil-C 0.687

Fil-C is a fanatically compatible memory-safe implementation of C and C++. Lots of software compiles and runs with Fil-C with zero or minimal changes. All memory safety errors are caught as Fil-C panics. Fil-C achieves this using a combination of concurrent garbage collection and invisible capabilities (each pointer in memory has a corresponding capability, not visible to the C address space). Every fundamental C operation (as seen in LLVM IR) is checked against the capability. Fil-C has no unsafe statement and only limited FFI to unsafe code.

Fil-C is special because:

License

The compiler (clang + LLVM) is covered by LLVM-LICENSE.txt. The runtime is covered by PAS-LICENSE.txt (see libpas/LICENSE.txt in the source distribution). In the case of the classic musl-based Fil-C distribution, the musl libc is covered by MUSL-LICENSE.txt (see projects/yolomusl/COPYRIGHT and projects/usermusl/COPYRIGHT in the source distribution). For Peregrine Fil-C, the cosmo libc and APE machinery is covered by COSMO-LICENSE.txt (see projects/yolocosmo/LICENSE and projects/usercosmo/LICENSE in the source distribution). In the case of the /opt/fil distribution, glibc is covered by glibc-LICENSE.txt, and all other included programs are covered by the respective -LICENSE.txt files. The C++ libraries (libc++/libc++abi) are covered by LLVM-LICENSE.txt.

You can fetch the source for the compiler, runtime, libc++/libc++abi, libc (musl and glibc), and all included programs from github. The source distribution also includes many additional programs that have been ported to Fil-C in the projects/ and pizlix/ directories, and they have a variety of licenses. The /opt/fil distribution includes builds of a variety of additional programs and their licenses are in additional-licenses/ in that distribution.

Requirements

Fil-C works natively on Linux/X86_64 or Linux/ARM64.

Peregrine Fil-C uses APEs and a Cosmo-derived libs, which allows binaries it produces to run on Linux/X86_64, Darwin/ARM64, and Windows/X86_64. Peregrine Fil-C is still experimental and requires a Linux/x86_64 host to build.

Previous versions natively worked on Darwin/ARM64 and FreeBSD. At some point I switched to focusing on Linux because it allowed me to do a faithful job of implementing all of libc. There's nothing fundamentally stopping Fil-C from working natively on other architectures or OSes other than Linux. Patches welcome.

Getting Started

If you downloaded Fil-C binaries, run:

./setup.sh

This has a different effect depending on which binary distribution you selected:

If you downloaded Fil-C source, run:

./build_all_fast.sh

Then you'll be able to use Fil-C from within this directory.

The binary distribution of Fil-C comes with musl as the libc. Using ./build_all_fast.sh in the source distribution also builds Fil-C using musl. If you are using source, then you can also:

Things That Work

Lots of software packages work in Fil-C with zero or minimal changes, including big ones like openssl, CPython, SQLite, and many others. Fil-C is powerful enough to support a fully memory safe Linux userland.

Fil-C has full support for C and C++ plus almost all of the extensions that clang 20 supports. Fil-C has excellent support for atomics and SIMD intrinsics, for example.

Fil-C catches all of the stuff that makes memory safety in C hard, like:

Fil-C comes with a reasonably complete POSIX libc and even supports tricky features like threads, signal handling, mmap/munmap, longjmp/setjmp, and C++ exceptions.

Learn More

You can learn more about Fil-C by visiting the website.

You can also e-mail me: [email protected]

Follow me on Twitter.

File issues at GH.

fil-c (pizlonator/fil-c)

正在搜索数据库…

3.9K ·GitHub
这是什么?Fil-C 是一个兼容性极强、内存安全的 C 和 C++ 实现:大多数现有的 C/C++ 软件无需修改或只需极少修改即可在其上编译运行,而每一次内存安全违规都会被 Fil-C 作为 panic 捕获,而不是悄无声息地破坏内存。
这是像 AddressSanitizer 那样的检测工具吗,还是更根本的东西?Fil-C 是一个完整的编译器加运行时,而不是附加的检测工具:它基于 clang/LLVM 构建编译器,并配合一个基于能力(capability)的运行时,该运行时采用并发垃圾回收,因此每个指针都带有一个不可见的能力,每次访问时都会进行检查。与 AddressSanitizer、HWAsan 或 MTE 不同,它没有可以绕过的逃生口。
我该怎么让它跑起来?如果你下载的是二进制发行版,直接运行 ./setup.sh 即可(musl 构建会把当前目录配置好,glibc 构建则会安装到 /opt/fil)。如果是从源码开始,运行 ./buildallfast.sh,就能在原地构建出一个可用的 Fil-C 工具链。
我需要的时候,能不能直接写不安全的代码?不能。Fil-C 没有 unsafe 关键字,并且刻意限制只能链接非 Fil-C 的代码,因此不存在像其他内存安全语言那样可以关闭其内存保护的逃生口。
这个编译器实际支持哪些平台?Fil-C 目前只能在 Linux/x86-64 或 Linux/ARM64 上运行;早期版本还支持 Darwin/ARM64 和 FreeBSD,但现在开发工作只专注于 Linux。
已经有哪些软件在 Fil-C 上跑起来了?OpenSSL、CPython、SQLite 以及许多其他软件包都能在 Fil-C 下无需修改或只需极少修改地运行,另外移植的程序还放在源码发行包中的 projects/ 和 pizlix/ 目录里。
Fil-C 与 CHERI 硬件能力相比如何?Fil-C 所达到的安全水平与 CHERI 等硬件能力相近,但它运行在普通的 x86-64 或 ARM64 硬件上,无需专门的 CHERI 芯片。
Fil-C 支持 C++ 异常和线程吗?支持。它内置了一个相当完整的 POSIX libc,支持线程、信号处理、mmap/munmap、longjmp/setjmp 以及 C++ 异常。
有哪些类似的项目?goose, zenc-lang, compiler, rust, mimalloc, gcc, solo, linux
大小
4.1 GB
星标
3.9K
时长
2年
提交 · 90 天