From 2da6c169a818b18d5b9dee2e08f625e067b5bdc6 Mon Sep 17 00:00:00 2001 From: Harin Date: Sun, 23 Nov 2025 22:04:48 +0530 Subject: [PATCH 1/2] Clarify -Cllvm-args forwarding to GCC in Readme --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index cd6aeae4b42..49b0245bffb 100644 --- a/Readme.md +++ b/Readme.md @@ -159,7 +159,7 @@ $ LIBRARY_PATH="[gcc-path value]" LD_LIBRARY_PATH="[gcc-path value]" rustc +$(ca * _**CG_GCCJIT_DUMP_ALL_MODULES**_: Enables dumping of all compilation modules. When set to "1", a dump is created for each module during compilation and stored in `/tmp/reproducers/`. * _**CG_GCCJIT_DUMP_MODULE**_: Enables dumping of a specific module. When set with the module name, e.g., `CG_GCCJIT_DUMP_MODULE=module_name`, a dump of that specific module is created in `/tmp/reproducers/`. - * _**CG_RUSTFLAGS**_: Send additional flags to rustc. Can be used to build the sysroot without unwinding by setting `CG_RUSTFLAGS=-Cpanic=abort`. + * _**CG_RUSTFLAGS**_: Send additional flags to rustc. Can be used to build the sysroot without unwinding by setting `CG_RUSTFLAGS=-Cpanic=abort`. Note that `-Cllvm-args` flags are forwarded to GCC. * _**CG_GCCJIT_DUMP_TO_FILE**_: Dump a C-like representation to /tmp/gccjit_dumps and enable debug info in order to debug this C-like representation. * _**CG_GCCJIT_DUMP_RTL**_: Dumps RTL (Register Transfer Language) for virtual registers. * _**CG_GCCJIT_DUMP_RTL_ALL**_: Dumps all RTL passes. From e95bba142bf4fb859511bb6019293b405368d196 Mon Sep 17 00:00:00 2001 From: Harin Date: Sun, 23 Nov 2025 22:29:16 +0530 Subject: [PATCH 2/2] docs: Move -Cllvm-args forwarding explanation to tips.md --- Readme.md | 2 +- doc/tips.md | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 49b0245bffb..cd6aeae4b42 100644 --- a/Readme.md +++ b/Readme.md @@ -159,7 +159,7 @@ $ LIBRARY_PATH="[gcc-path value]" LD_LIBRARY_PATH="[gcc-path value]" rustc +$(ca * _**CG_GCCJIT_DUMP_ALL_MODULES**_: Enables dumping of all compilation modules. When set to "1", a dump is created for each module during compilation and stored in `/tmp/reproducers/`. * _**CG_GCCJIT_DUMP_MODULE**_: Enables dumping of a specific module. When set with the module name, e.g., `CG_GCCJIT_DUMP_MODULE=module_name`, a dump of that specific module is created in `/tmp/reproducers/`. - * _**CG_RUSTFLAGS**_: Send additional flags to rustc. Can be used to build the sysroot without unwinding by setting `CG_RUSTFLAGS=-Cpanic=abort`. Note that `-Cllvm-args` flags are forwarded to GCC. + * _**CG_RUSTFLAGS**_: Send additional flags to rustc. Can be used to build the sysroot without unwinding by setting `CG_RUSTFLAGS=-Cpanic=abort`. * _**CG_GCCJIT_DUMP_TO_FILE**_: Dump a C-like representation to /tmp/gccjit_dumps and enable debug info in order to debug this C-like representation. * _**CG_GCCJIT_DUMP_RTL**_: Dumps RTL (Register Transfer Language) for virtual registers. * _**CG_GCCJIT_DUMP_RTL_ALL**_: Dumps all RTL passes. diff --git a/doc/tips.md b/doc/tips.md index e62c3402a29..38bc98c02d9 100644 --- a/doc/tips.md +++ b/doc/tips.md @@ -9,6 +9,14 @@ be useful. CG_RUSTFLAGS="-Clink-args=-save-temps -v" ../y.sh cargo build ``` +### How to send arguments to GCC + +The `-Cllvm-args` `rustc` flag is repurposed by `rustc_codegen_gcc` to pass arguments directly to the GCC backend. You can use it via the `CG_RUSTFLAGS` environment variable. For example, to pass a `-f` flag to GCC: + +``` +CG_RUSTFLAGS="-Cllvm-args=-fflag-name" ../y.sh cargo build +``` + ### How to see the personality functions in the asm dump ```