From: Daniel Xu <dxu@dxuuu.xyz>
To: rust-for-linux@vger.kernel.org
Subject: How are rustc -Z flags enabled during build?
Date: Wed, 1 Sep 2021 16:07:15 -0700 [thread overview]
Message-ID: <20210901230715.civmnrpmt3c2u72v@kashmir.localdomain> (raw)
Hi,
Context: While hacking on some rust modules, I ran into a bug where
kbuild was trying to generate BTF (from DWARF) for rust kernel modules.
I'm guessing one cannot generate valid BTF from rust debuginfo b/c at
module load time the btf parser complains and errors out the module
load. I know how to fix this and am planning on sending a fix.
In trying to fix the BTF issue, I'm trying to get more familiar w/
kbuild. Specifically, I've run `make V=1 LLVM=1 -j32` to try and figure
out exactly where the .o's are being created. I see the following
command:
RUST_MODFILE=samples/rust/rust_minimal rustc
--emit=dep-info,obj,metadata --edition=2018 -Cpanic=abort
-Cembed-bitcode=n -Clto=n -Crpath=n -Cforce-unwind-tables=n
-Ccodegen-units=1 -Zbinary_dep_depinfo=y
-Zsymbol-mangling-version=v0 -Dunsafe_op_in_unsafe_fn
-Drust_2018_idioms -Wmissing_docs -Cdebug-assertions=y
-Coverflow-checks=y -Copt-level=2 -Cdebuginfo=2 --cfg MODULE
@./include/generated/rustc_cfg
--target=/home/dxu/dev/linux/arch/x86/rust/target.json
-Zallow-features=allocator_api,bench_black_box,concat_idents,global_asm,try_reserve
--extern alloc --extern kernel --crate-type rlib --out-dir /tmp/rust
-L ./rust/ --crate-name rust_minimal samples/rust/rust_minimal.rs
When I try to run it outside of kbuild, I get:
error: the option `Z` is only accepted on the nightly compiler
How does kbuild use the -Z features on a stable rustc?
Thanks,
Daniel
next reply other threads:[~2021-09-01 23:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-01 23:07 Daniel Xu [this message]
2021-09-02 0:50 ` How are rustc -Z flags enabled during build? Gary Guo
2021-09-02 5:50 ` Miguel Ojeda
2021-09-02 18:41 ` Daniel Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210901230715.civmnrpmt3c2u72v@kashmir.localdomain \
--to=dxu@dxuuu.xyz \
--cc=rust-for-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).