Merge tag 'kbuild-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy...
[linux-block.git] / scripts / Makefile.modfinal
index a3cf9e3647c9cc5caf578b2e8db22de6522e755a..25bedd83644b0b7789912baff4b667b0eb2b7988 100644 (file)
@@ -39,11 +39,13 @@ quiet_cmd_ld_ko_o = LD [M]  $@
 
 quiet_cmd_btf_ko = BTF [M] $@
       cmd_btf_ko =                                                     \
-       if [ -f vmlinux ]; then                                         \
+       if [ ! -f vmlinux ]; then                                       \
+               printf "Skipping BTF generation for %s due to unavailability of vmlinux\n" $@ 1>&2; \
+       elif [ -n "$(CONFIG_RUST)" ] && $(srctree)/scripts/is_rust_module.sh $@; then           \
+               printf "Skipping BTF generation for %s because it's a Rust module\n" $@ 1>&2; \
+       else                                                            \
                LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J $(PAHOLE_FLAGS) --btf_base vmlinux $@; \
                $(RESOLVE_BTFIDS) -b vmlinux $@;                        \
-       else                                                            \
-               printf "Skipping BTF generation for %s due to unavailability of vmlinux\n" $@ 1>&2; \
        fi;
 
 # Same as newer-prereqs, but allows to exclude specified extra dependencies