Messages in this thread Patch in this message | | | From | WANG Rui <> | Subject | [PATCH] rust: build: Define MODULE macro iif the CONFIG_MODULES is enabled | Date | Tue, 27 Jun 2023 20:14:22 +0800 |
| |
The LoongArch does not currently support modules when built with clang. A pre-processor error is expected on building modules, that's caused by:
#if defined(MODULE) && defined(CONFIG_AS_HAS_EXPLICIT_RELOCS) # if __has_attribute(model) # define PER_CPU_ATTRIBUTES __attribute__((model("extreme"))) # else # error compiler support for the model attribute is necessary when a recent assembler is used # endif #endif
This also happens with bindgen too, so it would be better to define MODULE macro if and only if the CONFIG_MODULES is enabled.
Signed-off-by: WANG Rui <wangrui@loongson.cn> --- rust/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/rust/Makefile b/rust/Makefile index fc8cdcfcc9e5..d31d9fa27ef0 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -295,12 +295,16 @@ endif bindgen_c_flags_final = $(bindgen_c_flags_lto) -D__BINDGEN__ +ifdef CONFIG_MODULES +bindgen_c_flags_final += -DMODULE +endif + quiet_cmd_bindgen = BINDGEN $@ cmd_bindgen = \ $(BINDGEN) $< $(bindgen_target_flags) \ --use-core --with-derive-default --ctypes-prefix core::ffi --no-layout-tests \ --no-debug '.*' \ - -o $@ -- $(bindgen_c_flags_final) -DMODULE \ + -o $@ -- $(bindgen_c_flags_final) \ $(bindgen_target_cflags) $(bindgen_target_extra) $(obj)/bindings/bindings_generated.rs: private bindgen_target_flags = \ -- 2.41.0
| |