

GitHub - michaelforney/cc: Mirror of https://git.sr.ht/~mcf/cc
source link: https://github.com/michaelforney/cc
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md
(mirrored on GitHub)
This is a C11 compiler using QBE as a backend. It is released under the ISC license.
Several GNU C extensions are also implemented.
There is still much to do, but it currently implements most of the language and is capable of building software including itself, mcpp, gcc 4.7, binutils, and more.
It was inspired by several other small C compilers including 8cc, c, lacc, and scc.
Requirements
The compiler itself is written in standard C11 and can be built with any conforming C11 compiler.
The POSIX driver depends on POSIX.1-2008 interfaces, and the Makefile
requires a POSIX-compatible make(1).
At runtime, you will need QBE, an assembler, and a linker for the target system. Currently, my personal QBE branch is recommended, since it may address some issues that have not yet made it upstream. Since the preprocessor is not yet implemented, an external one is currently required as well.
Supported targets
All architectures supported by QBE should work (currently x86_64 and aarch64).
The following targets are tested by the continuous build and known to bootstrap and pass all tests:
x86_64-linux-musl
x86_64-linux-gnu
x86_64-freebsd
aarch64-linux-musl
aarch64-linux-gnu
Building
Run ./configure
to create a config.h
and config.mk
appropriate for
your system. If your system is not supported by the configure script,
you can create these files manually. config.h
should define several
string arrays (static char *[]
):
startfiles
: Objects to pass to the linker at the beginning of the link command.endfiles
: Objects to pass to the linker at the end of the link command (including libc).preprocesscmd
: The preprocessor command, and any necessary flags for the target system.codegencmd
: The QBE command, and possibly explicit target flags.assemblecmd
: The assembler command.linkcmd
: The linker command.
You may also want to customize your environment or config.mk
with the
appropriate CC
, CFLAGS
and LDFLAGS
.
If you don't have QBE installed, you can build it from the included submodule (NOTE: BSD users will need to use gmake here), then add it to your PATH so that the driver will be able to run it.
make qbe
PATH=$PWD/qbe/obj:$PATH
Once this is done, you can build with
make
Bootstrap
The Makefile
includes several other targets that can be used for
bootstrapping. These targets require the ability to run the tools
specified in config.h
.
stage2
: Build the compiler with the initial (stage1
) output.stage3
: Build the compiler with thestage2
output.bootstrap
: Build thestage2
andstage3
compilers, and verify that they are byte-wise identical.
What's missing
- Digraph and trigraph sequences (6.4.6p3 and 5.2.1.1, will not be implemented).
- Wide string literals and character constants (#35 and #36).
- Variable-length arrays (#1).
volatile
-qualified types (#7)._Thread_local
storage-class specifier (#5).long double
type (#3).- Inline assembly (#5).
- Preprocessor (#6).
- Generation of position independent code (i.e. shared libraries, modules, PIEs).
Issue tracker
Please report any issues to https://todo.sr.ht/~mcf/cc-issues.
Contributing
Send patches to me (address in commit log), or pull-requests on the GitHub mirror. Once I decide on a project name, a mailing list will be created, which will then become the preferred form of contribution.
Recommend
-
425
FFmpeg README FFmpeg is a collection of libraries and tools to process multimedia content such as audio, video, subtitles and related metadata. Libraries libavcodec provides implementation of a wider ran...
-
206
README.md ...
-
49
[mirror] DNS over HTTPS
-
5
http/https协议下免输入使用Git 2017-12-21 14:50:42 +08 字数:941 标签: Git 在一些条件下,不方便使用ssh协议来获取、更新Git库。...
-
10
使用 git push –mirror 迁移 Git 项目 2021-07-19 从 Gogs 切换到 Gitea 迁移了不少仓库,记录下命令。使用 git bare 的方式拉下来旧仓库的代码,bare 能拉下来所有项目信息包括分支,TAG。git clone...
-
8
How to convert a GIT SVN mirror into GIT upstream Yesterday
-
8
git 作为当前最受欢迎的版本控制软件,使用是很频繁的。但是…git 作为当前最受欢迎的版本控制软件,使用是很频繁的。但是有的小伙伴发现每次使用 git push 等操作时都要输入密码,实在是麻烦。这里对使用 SSH 与 HTTPS 两种通讯协议介绍一下免密码配置
-
9
samurai samurai is a ninja-compatible build tool written in C99 with a focus on simplicity, speed, and portability. Status samurai implements the ninja build language through version 1.9.0 except for MSVC dependency handli...
-
7
meli/meli master ...
-
13
master Go to file ...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK