{"id":20009873,"url":"https://github.com/plsyssec/rustc-cet","last_synced_at":"2026-06-05T22:31:23.617Z","repository":{"id":41511691,"uuid":"262481126","full_name":"PLSysSec/rustc-cet","owner":"PLSysSec","description":null,"archived":false,"fork":false,"pushed_at":"2022-04-05T09:02:34.000Z","size":522106,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-01-12T14:37:56.411Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PLSysSec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-09T03:31:18.000Z","updated_at":"2022-07-03T09:44:41.000Z","dependencies_parsed_at":"2022-09-08T14:24:32.018Z","dependency_job_id":null,"html_url":"https://github.com/PLSysSec/rustc-cet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLSysSec%2Frustc-cet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLSysSec%2Frustc-cet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLSysSec%2Frustc-cet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PLSysSec%2Frustc-cet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PLSysSec","download_url":"https://codeload.github.com/PLSysSec/rustc-cet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241447522,"owners_count":19964314,"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":[],"created_at":"2024-11-13T07:17:22.034Z","updated_at":"2025-03-02T01:44:07.134Z","avatar_url":"https://github.com/PLSysSec.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The Rust Programming Language\n\nThis is a modified version of rusts tooling that supports Intel CET.\nThis adds the CET support by default.\nTo setup this toolchain, run the following commands\n\n```bash\n# cd to the current folder\n./x.py build\n# will output the build ../out/rust_build\n./x.py install\n# register the toolchain\nrustup toolchain link rust-cet ../out/rust_build\n```\n\nTo build with CET\n```bash\nCFLAGS=\"-fcf-protection=full\" CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=\"./rust_cet_linker\" cargo +rust-cet build\n```\n\nTo build without CET\n```bash\nRUSTFLAGS=\"--cf_protection_disable_branch --cf_protection_disable_return\" cargo +rust-cet build\n```\n\nThis is the main source code repository for [Rust]. It contains the compiler,\nstandard library, and documentation.\n\n[Rust]: https://www.rust-lang.org\n\n## Quick Start\n\nRead [\"Installation\"] from [The Book].\n\n[\"Installation\"]: https://doc.rust-lang.org/book/ch01-01-installation.html\n[The Book]: https://doc.rust-lang.org/book/index.html\n\n## Installing from Source\n\n_Note: If you wish to contribute to the compiler, you should read [this\nchapter][rustcguidebuild] of the rustc-dev-guide instead of this section._\n\nThe Rust build system has a Python script called `x.py` to bootstrap building\nthe compiler. More information about it may be found by running `./x.py --help`\nor reading the [rustc dev guide][rustcguidebuild].\n\n[rustcguidebuild]: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html\n\n### Building on *nix\n1. Make sure you have installed the dependencies:\n\n   * `g++` 5.1 or later or `clang++` 3.5 or later\n   * `python` 3 or 2.7\n   * GNU `make` 3.81 or later\n   * `cmake` 3.4.3 or later\n   * `curl`\n   * `git`\n   * `ssl` which comes in `libssl-dev` or `openssl-devel`\n   * `pkg-config` if you are compiling on Linux and targeting Linux\n\n2. Clone the [source] with `git`:\n\n   ```sh\n   $ git clone https://github.com/rust-lang/rust.git\n   $ cd rust\n   ```\n\n[source]: https://github.com/rust-lang/rust\n\n3. Configure the build settings:\n\n    The Rust build system uses a file named `config.toml` in the root of the\n    source tree to determine various configuration settings for the build.\n    Copy the default `config.toml.example` to `config.toml` to get started.\n\n    ```sh\n    $ cp config.toml.example config.toml\n    ```\n\n    It is recommended that if you plan to use the Rust build system to create\n    an installation (using `./x.py install`) that you set the `prefix` value\n    in the `[install]` section to a directory that you have write permissions.\n\n    Create install directory if you are not installing in default directory\n\n4. Build and install:\n\n    ```sh\n    $ ./x.py build \u0026\u0026 ./x.py install\n    ```\n\n    When complete, `./x.py install` will place several programs into\n    `$PREFIX/bin`: `rustc`, the Rust compiler, and `rustdoc`, the\n    API-documentation tool. This install does not include [Cargo],\n    Rust's package manager. To build and install Cargo, you may\n    run `./x.py install cargo` or set the `build.extended` key in\n    `config.toml` to `true` to build and install all tools.\n\n[Cargo]: https://github.com/rust-lang/cargo\n\n### Building on Windows\n\nThere are two prominent ABIs in use on Windows: the native (MSVC) ABI used by\nVisual Studio, and the GNU ABI used by the GCC toolchain. Which version of Rust\nyou need depends largely on what C/C++ libraries you want to interoperate with:\nfor interop with software produced by Visual Studio use the MSVC build of Rust;\nfor interop with GNU software built using the MinGW/MSYS2 toolchain use the GNU\nbuild.\n\n#### MinGW\n\n[MSYS2][msys2] can be used to easily build Rust on Windows:\n\n[msys2]: https://msys2.github.io/\n\n1. Grab the latest [MSYS2 installer][msys2] and go through the installer.\n\n2. Run `mingw32_shell.bat` or `mingw64_shell.bat` from wherever you installed\n   MSYS2 (i.e. `C:\\msys64`), depending on whether you want 32-bit or 64-bit\n   Rust. (As of the latest version of MSYS2 you have to run `msys2_shell.cmd\n   -mingw32` or `msys2_shell.cmd -mingw64` from the command line instead)\n\n3. From this terminal, install the required tools:\n\n   ```sh\n   # Update package mirrors (may be needed if you have a fresh install of MSYS2)\n   $ pacman -Sy pacman-mirrors\n\n   # Install build tools needed for Rust. If you're building a 32-bit compiler,\n   # then replace \"x86_64\" below with \"i686\". If you've already got git, python,\n   # or CMake installed and in PATH you can remove them from this list. Note\n   # that it is important that you do **not** use the 'python2' and 'cmake'\n   # packages from the 'msys2' subsystem. The build has historically been known\n   # to fail with these packages.\n   $ pacman -S git \\\n               make \\\n               diffutils \\\n               tar \\\n               mingw-w64-x86_64-python \\\n               mingw-w64-x86_64-cmake \\\n               mingw-w64-x86_64-gcc\n   ```\n\n4. Navigate to Rust's source code (or clone it), then build it:\n\n   ```sh\n   $ ./x.py build \u0026\u0026 ./x.py install\n   ```\n\n#### MSVC\n\nMSVC builds of Rust additionally require an installation of Visual Studio 2017\n(or later) so `rustc` can use its linker.  The simplest way is to get the\n[Visual Studio], check the “C++ build tools” and “Windows 10 SDK” workload.\n\n[Visual Studio]: https://visualstudio.microsoft.com/downloads/\n\n(If you're installing cmake yourself, be careful that “C++ CMake tools for\nWindows” doesn't get included under “Individual components”.)\n\nWith these dependencies installed, you can build the compiler in a `cmd.exe`\nshell with:\n\n```sh\n\u003e python x.py build\n```\n\nCurrently, building Rust only works with some known versions of Visual Studio. If\nyou have a more recent version installed the build system doesn't understand\nthen you may need to force rustbuild to use an older version. This can be done\nby manually calling the appropriate vcvars file before running the bootstrap.\n\n```batch\n\u003e CALL \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat\"\n\u003e python x.py build\n```\n\n### Building rustc with older host toolchains\nIt is still possible to build Rust with the older toolchain versions listed below, but only if the\nLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN option is set to true in the config.toml file.\n\n* Clang 3.1\n* Apple Clang 3.1\n* GCC 4.8\n* Visual Studio 2015 (Update 3)\n\nToolchain versions older than what is listed above cannot be used to build rustc.\n\n#### Specifying an ABI\n\nEach specific ABI can also be used from either environment (for example, using\nthe GNU ABI in PowerShell) by using an explicit build triple. The available\nWindows build triples are:\n- GNU ABI (using GCC)\n    - `i686-pc-windows-gnu`\n    - `x86_64-pc-windows-gnu`\n- The MSVC ABI\n    - `i686-pc-windows-msvc`\n    - `x86_64-pc-windows-msvc`\n\nThe build triple can be specified by either specifying `--build=\u003ctriple\u003e` when\ninvoking `x.py` commands, or by copying the `config.toml` file (as described\nin [Installing From Source](#installing-from-source)), and modifying the\n`build` option under the `[build]` section.\n\n### Configure and Make\n\nWhile it's not the recommended build system, this project also provides a\nconfigure script and makefile (the latter of which just invokes `x.py`).\n\n```sh\n$ ./configure\n$ make \u0026\u0026 sudo make install\n```\n\nWhen using the configure script, the generated `config.mk` file may override the\n`config.toml` file. To go back to the `config.toml` file, delete the generated\n`config.mk` file.\n\n## Building Documentation\n\nIf you’d like to build the documentation, it’s almost the same:\n\n```sh\n$ ./x.py doc\n```\n\nThe generated documentation will appear under `doc` in the `build` directory for\nthe ABI used. I.e., if the ABI was `x86_64-pc-windows-msvc`, the directory will be\n`build\\x86_64-pc-windows-msvc\\doc`.\n\n## Notes\n\nSince the Rust compiler is written in Rust, it must be built by a\nprecompiled \"snapshot\" version of itself (made in an earlier stage of\ndevelopment). As such, source builds require a connection to the Internet, to\nfetch snapshots, and an OS that can execute the available snapshot binaries.\n\nSnapshot binaries are currently built and tested on several platforms:\n\n| Platform / Architecture    | x86 | x86_64 |\n|----------------------------|-----|--------|\n| Windows (7, 8, 10, ...)    | ✓   | ✓      |\n| Linux (2.6.18 or later)    | ✓   | ✓      |\n| macOS (10.7 Lion or later) | ✓   | ✓      |\n\nYou may find that other platforms work, but these are our officially\nsupported build environments that are most likely to work.\n\nThere is more advice about hacking on Rust in [CONTRIBUTING.md].\n\n[CONTRIBUTING.md]: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md\n\n## Getting Help\n\nThe Rust community congregates in a few places:\n\n* [Stack Overflow] - Direct questions about using the language.\n* [users.rust-lang.org] - General discussion and broader questions.\n* [/r/rust] - News and general discussion.\n\n[Stack Overflow]: https://stackoverflow.com/questions/tagged/rust\n[/r/rust]: https://reddit.com/r/rust\n[users.rust-lang.org]: https://users.rust-lang.org/\n\n## Contributing\n\nTo contribute to Rust, please see [CONTRIBUTING](CONTRIBUTING.md).\n\nMost real-time collaboration happens in a variety of channels on the\n[Rust Discord server][rust-discord], with channels dedicated for getting help,\ncommunity, documentation, and all major contribution areas in the Rust ecosystem.\nA good place to ask for help would be the #help channel.\n\nThe [rustc dev guide] might be a good place to start if you want to find out how\nvarious parts of the compiler work.\n\nAlso, you may find the [rustdocs for the compiler itself][rustdocs] useful.\n\n[rust-discord]: https://discord.gg/rust-lang\n[rustc dev guide]: https://rustc-dev-guide.rust-lang.org/about-this-guide.html\n[rustdocs]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/\n\n## License\n\nRust is primarily distributed under the terms of both the MIT license\nand the Apache License (Version 2.0), with portions covered by various\nBSD-like licenses.\n\nSee [LICENSE-APACHE](LICENSE-APACHE), [LICENSE-MIT](LICENSE-MIT), and\n[COPYRIGHT](COPYRIGHT) for details.\n\n## Trademark\n\nThe Rust programming language is an open source, community project governed\nby a core team. It is also sponsored by the Mozilla Foundation (“Mozilla”),\nwhich owns and protects the Rust and Cargo trademarks and logos\n(the “Rust Trademarks”).\n\nIf you want to use these names or brands, please read the [media guide][media-guide].\n\nThird-party logos may be subject to third-party copyrights and trademarks. See\n[Licenses][policies-licenses] for details.\n\n[media-guide]: https://www.rust-lang.org/policies/media-guide\n[policies-licenses]: https://www.rust-lang.org/policies/licenses\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplsyssec%2Frustc-cet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplsyssec%2Frustc-cet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplsyssec%2Frustc-cet/lists"}