{"id":13836087,"url":"https://github.com/tyfkda/xcc","last_synced_at":"2025-04-12T19:43:42.921Z","repository":{"id":40630391,"uuid":"166307267","full_name":"tyfkda/xcc","owner":"tyfkda","description":"Standalone C compiler/assembler/linker/libc for x86-64/aarch64/riscv64/wasm","archived":false,"fork":false,"pushed_at":"2024-10-29T13:31:32.000Z","size":5488,"stargazers_count":252,"open_issues_count":26,"forks_count":17,"subscribers_count":8,"default_branch":"main","last_synced_at":"2024-10-29T16:05:22.579Z","etag":null,"topics":["aarch64","arm64","assembler","c","c-compiler","compiler","elf64","linker","mach-o","posix","preprocessor","riscv64","self-hosting","wasi","wasm","x86-64"],"latest_commit_sha":null,"homepage":"https://tyfkda.github.io/xcc/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tyfkda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-17T22:38:21.000Z","updated_at":"2024-10-28T23:07:49.000Z","dependencies_parsed_at":"2024-03-15T07:30:22.046Z","dependency_job_id":"c155b140-9243-40b6-9793-eed278b462f5","html_url":"https://github.com/tyfkda/xcc","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyfkda%2Fxcc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyfkda%2Fxcc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyfkda%2Fxcc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyfkda%2Fxcc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tyfkda","download_url":"https://codeload.github.com/tyfkda/xcc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625479,"owners_count":21135512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aarch64","arm64","assembler","c","c-compiler","compiler","elf64","linker","mach-o","posix","preprocessor","riscv64","self-hosting","wasi","wasm","x86-64"],"created_at":"2024-08-04T15:00:35.182Z","updated_at":"2025-04-12T19:43:42.884Z","avatar_url":"https://github.com/tyfkda.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"XCC\n===\n\n[![Action Status](https://github.com/tyfkda/xcc/workflows/AllTests/badge.svg)](https://github.com/tyfkda/xcc)\n[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/tyfkda/xcc)\n\nC compiler running on Linux or MacOS.\n\n  * Supporting architecture: x86-64, aarch64 (arm64), riscv64, wasm\n  * Binary format: ELF64\n\n\n### Requirements\n\n  * Linux (or MacOS)\n  * C compiler (gcc or clang)\n  * make\n\n\n### Build\n\n```sh\n$ make\n```\n\nGenerated files:\n\n  * `xcc`: Compiler entry\n  * `cpp`: Preprocessor\n  * `cc1`: C compiler\n  * `as`:  Assembler\n  * `ld`:  Linker\n\n\n### Usage\n\n```sh\n$ ./xcc -o hello examples/hello.c\n$ ./hello\nHello, world!\n```\n\n#### Command line options\n\n  * `-o \u003cfilename\u003e`: Set output filename (default: `a.out`)\n  * `-I \u003cpath\u003e`:     Add include path\n  * `-D \u003clabel\u003e(=value)`:  Define macro\n  * `-S`:            Output assembly code\n  * `-E`:            Preprocess only\n  * `-c`:            Output object file\n  * `-nodefaultlibs`:  Ignore libc\n  * `-nostdlib`:  Ignore libc and crt0\n\n\n### TODO\n\n  * Optimization\n  * Archiver\n\n\n### Reference\n\n  * [低レイヤを知りたい人のためのCコンパイラ作成入門](https://www.sigbus.info/compilerbook)\n  * [rui314/9cc: A Small C Compiler](https://github.com/rui314/9cc)\n\n\n----\n\n### WebAssembly\n\nCompile C to WebAssembly/WASI binary.\n\n[Online demo](https://tyfkda.github.io/xcc/)\n\n#### Requirements\n\n  * node.js, npm\n  * `llvm-ar`\n\n#### Set up\n\n```sh\n$ npm ci\n```\n\n#### Build\n\n```sh\n$ make wcc\n```\n\nGenerated files:\n\n  * `wcc`: C compiler (including preprocessor, and output .wasm directly)\n\n#### Usage\n\nCompile:\n\n```sh\n$ ./wcc -o hello.wasm examples/hello.c\n```\n\nCommand line options:\n\n  * `-o \u003cfilename\u003e`: Set output filename (default: `a.wasm`)\n  * `-I \u003cpath\u003e`:     Add include path\n  * `-D \u003clabel\u003e(=value)`:  Define macro\n  * `-E`:            Preprocess only\n  * `-c`:            Output object file\n  * `--entry-point=func_name`:  Specify entry point (default: `_start`)\n  * `-e func_name,...`:  Export function names (comma separated)\n  * `--stack-size=\u003csize\u003e`:  Set stack size (default: 8192)\n  * `-nodefaultlibs`:  Ignore libc\n  * `-nostdlib`:  Ignore libc and crt0\n  * `--verbose`:  Output debug information\n\n#### Run\n\n```sh\n$ ./tool/runwasi hello.wasm\nHello, world!\n```\n\nYou can also use WASM/WASI runtime (Wasmtime, Wasmer, etc.), too.\n\n#### Missing features\n\n  * `goto` statement\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyfkda%2Fxcc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftyfkda%2Fxcc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyfkda%2Fxcc/lists"}