Skip to content

Commit d735a27

Browse files
SpriteOvOMingcongBai
authored andcommitted
FROMLIST: rust: add a Kconfig function to test for support of bindgen options
Add a new `bindgen-backend-option` Kconfig function to test whether the bindgen backend supports a given flag. A subsequent commit will use this function to test for RISC-V extension flags. Signed-off-by: Asuna Yang <SpriteOvO@gmail.com> Link: https://lore.kernel.org/r/20251204-gcc-rust-v5-v5-3-2d4f20d86c24@gmail.com Signed-off-by: Han Gao <gaohan@iscas.ac.cn> Signed-off-by: Mingcong Bai <jeffbai@aosc.io>
1 parent 47515ce commit d735a27

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

scripts/Kconfig.include

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,8 @@ rustc-llvm-version := $(shell,$(srctree)/scripts/rustc-llvm-version.sh $(RUSTC))
7676
# If you are testing for unstable features, consider testing RUSTC_VERSION
7777
# instead, as features may have different completeness while available.
7878
rustc-option = $(success,trap "rm -rf .tmp_$$" EXIT; mkdir .tmp_$$; $(RUSTC) $(1) --crate-type=rlib /dev/null --out-dir=.tmp_$$ -o .tmp_$$/tmp.rlib)
79+
80+
# $(bindgen-backend-option,<flag>)
81+
# Return y if bindgen backend supports <flag>, n otherwise
82+
# For now, the backend refers only to libclang, so more specifically, this function tests whether the given flag is recognized by the libclang used by bindgen.
83+
bindgen-backend-option = $(success,trap "rm -f .tmp_$$.h" EXIT; touch .tmp_$$.h; $(BINDGEN) .tmp_$$.h -- --target=$(BINDGEN_TARGET) $(1))

0 commit comments

Comments
 (0)