Message ID | 20250103-extended-modversions-v13-5-35d87c65ee04@google.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Extended MODVERSIONS Support | expand |
On Sat, Jan 4, 2025 at 2:37 AM Matthew Maurer <mmaurer@google.com> wrote: > > From: Sami Tolvanen <samitolvanen@google.com> > > Previously, two things stopped Rust from using MODVERSIONS: > 1. Rust symbols are occasionally too long to be represented in the > original versions table > 2. Rust types cannot be properly hashed by the existing genksyms > approach because: > * Looking up type definitions in Rust is more complex than C > * Type layout is potentially dependent on the compiler in Rust, > not just the source type declaration. > > CONFIG_EXTENDED_MODVERSIONS addresses the first point, and > CONFIG_GENDWARFKSYMS the second. If Rust wants to use MODVERSIONS, allow > it to do so by selecting both features. > > Signed-off-by: Sami Tolvanen <samitolvanen@google.com> > Co-developed-by: Matthew Maurer <mmaurer@google.com> > Signed-off-by: Matthew Maurer <mmaurer@google.com> > --- > init/Kconfig | 3 ++- > rust/Makefile | 34 ++++++++++++++++++++++++++++++++-- > 2 files changed, 34 insertions(+), 3 deletions(-) > > diff --git a/init/Kconfig b/init/Kconfig > index c1f9eb3d5f2e892e977ba1425599502dc830f552..b60acfd9431e0ac2bf401ecb6523b5104ad31150 100644 > --- a/init/Kconfig > +++ b/init/Kconfig > @@ -1959,7 +1959,8 @@ config RUST > bool "Rust support" > depends on HAVE_RUST > depends on RUST_IS_AVAILABLE > - depends on !MODVERSIONS > + select EXTENDED_MODVERSIONS if MODVERSIONS > + depends on !MODVERSIONS || GENDWARFKSYMS > depends on !GCC_PLUGIN_RANDSTRUCT > depends on !RANDSTRUCT > depends on !DEBUG_INFO_BTF || PAHOLE_HAS_LANG_EXCLUDE > diff --git a/rust/Makefile b/rust/Makefile > index a40a3936126d603836e0ec9b42a1285916b60e45..80f970ad81f7989afe5ff2b5f633f50feb7f6006 100644 > --- a/rust/Makefile > +++ b/rust/Makefile > @@ -329,10 +329,11 @@ $(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_extra = ; > $(obj)/bindings/bindings_helpers_generated.rs: $(src)/helpers/helpers.c FORCE > $(call if_changed_dep,bindgen) > > +rust_exports = $(NM) -p --defined-only $(1) | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ { printf $(2),$(3) }' > + > quiet_cmd_exports = EXPORTS $@ > cmd_exports = \ > - $(NM) -p --defined-only $< \ > - | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ {printf "EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3}' > $@ > + $(call rust_exports,$<,"EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3) > $@ I noticed a nit: Both of the two callsites of rust_exports pass '$$3' to the last parameter instead of hardcoding it. Is it a flexibility for future extensions? I cannot think of any other use except for printing the third column, i.e. symbol name.
Hi Masahiro, On Fri, Jan 10, 2025 at 6:26 PM Masahiro Yamada <masahiroy@kernel.org> wrote: > > On Sat, Jan 4, 2025 at 2:37 AM Matthew Maurer <mmaurer@google.com> wrote: > > > > From: Sami Tolvanen <samitolvanen@google.com> > > > > Previously, two things stopped Rust from using MODVERSIONS: > > 1. Rust symbols are occasionally too long to be represented in the > > original versions table > > 2. Rust types cannot be properly hashed by the existing genksyms > > approach because: > > * Looking up type definitions in Rust is more complex than C > > * Type layout is potentially dependent on the compiler in Rust, > > not just the source type declaration. > > > > CONFIG_EXTENDED_MODVERSIONS addresses the first point, and > > CONFIG_GENDWARFKSYMS the second. If Rust wants to use MODVERSIONS, allow > > it to do so by selecting both features. > > > > Signed-off-by: Sami Tolvanen <samitolvanen@google.com> > > Co-developed-by: Matthew Maurer <mmaurer@google.com> > > Signed-off-by: Matthew Maurer <mmaurer@google.com> > > --- > > init/Kconfig | 3 ++- > > rust/Makefile | 34 ++++++++++++++++++++++++++++++++-- > > 2 files changed, 34 insertions(+), 3 deletions(-) > > > > diff --git a/init/Kconfig b/init/Kconfig > > index c1f9eb3d5f2e892e977ba1425599502dc830f552..b60acfd9431e0ac2bf401ecb6523b5104ad31150 100644 > > --- a/init/Kconfig > > +++ b/init/Kconfig > > @@ -1959,7 +1959,8 @@ config RUST > > bool "Rust support" > > depends on HAVE_RUST > > depends on RUST_IS_AVAILABLE > > - depends on !MODVERSIONS > > + select EXTENDED_MODVERSIONS if MODVERSIONS > > + depends on !MODVERSIONS || GENDWARFKSYMS > > depends on !GCC_PLUGIN_RANDSTRUCT > > depends on !RANDSTRUCT > > depends on !DEBUG_INFO_BTF || PAHOLE_HAS_LANG_EXCLUDE > > diff --git a/rust/Makefile b/rust/Makefile > > index a40a3936126d603836e0ec9b42a1285916b60e45..80f970ad81f7989afe5ff2b5f633f50feb7f6006 100644 > > --- a/rust/Makefile > > +++ b/rust/Makefile > > @@ -329,10 +329,11 @@ $(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_extra = ; > > $(obj)/bindings/bindings_helpers_generated.rs: $(src)/helpers/helpers.c FORCE > > $(call if_changed_dep,bindgen) > > > > +rust_exports = $(NM) -p --defined-only $(1) | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ { printf $(2),$(3) }' > > + > > quiet_cmd_exports = EXPORTS $@ > > cmd_exports = \ > > - $(NM) -p --defined-only $< \ > > - | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ {printf "EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3}' > $@ > > + $(call rust_exports,$<,"EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3) > $@ > > I noticed a nit: > > Both of the two callsites of rust_exports pass > '$$3' to the last parameter instead of hardcoding it. > > Is it a flexibility for future extensions? > > I cannot think of any other use except for printing > the third column, i.e. symbol name. Good catch, the last parameter isn't necessary anymore. It was used in early versions of the series to also pass symbol addresses to gendwarfksyms, but that's not needed since we read the symbol table directly now. Sami
On Tue, Jan 14, 2025 at 5:04 AM Sami Tolvanen <samitolvanen@google.com> wrote: > > Hi Masahiro, > > On Fri, Jan 10, 2025 at 6:26 PM Masahiro Yamada <masahiroy@kernel.org> wrote: > > > > On Sat, Jan 4, 2025 at 2:37 AM Matthew Maurer <mmaurer@google.com> wrote: > > > > > > From: Sami Tolvanen <samitolvanen@google.com> > > > > > > Previously, two things stopped Rust from using MODVERSIONS: > > > 1. Rust symbols are occasionally too long to be represented in the > > > original versions table > > > 2. Rust types cannot be properly hashed by the existing genksyms > > > approach because: > > > * Looking up type definitions in Rust is more complex than C > > > * Type layout is potentially dependent on the compiler in Rust, > > > not just the source type declaration. > > > > > > CONFIG_EXTENDED_MODVERSIONS addresses the first point, and > > > CONFIG_GENDWARFKSYMS the second. If Rust wants to use MODVERSIONS, allow > > > it to do so by selecting both features. > > > > > > Signed-off-by: Sami Tolvanen <samitolvanen@google.com> > > > Co-developed-by: Matthew Maurer <mmaurer@google.com> > > > Signed-off-by: Matthew Maurer <mmaurer@google.com> > > > --- > > > init/Kconfig | 3 ++- > > > rust/Makefile | 34 ++++++++++++++++++++++++++++++++-- > > > 2 files changed, 34 insertions(+), 3 deletions(-) > > > > > > diff --git a/init/Kconfig b/init/Kconfig > > > index c1f9eb3d5f2e892e977ba1425599502dc830f552..b60acfd9431e0ac2bf401ecb6523b5104ad31150 100644 > > > --- a/init/Kconfig > > > +++ b/init/Kconfig > > > @@ -1959,7 +1959,8 @@ config RUST > > > bool "Rust support" > > > depends on HAVE_RUST > > > depends on RUST_IS_AVAILABLE > > > - depends on !MODVERSIONS > > > + select EXTENDED_MODVERSIONS if MODVERSIONS > > > + depends on !MODVERSIONS || GENDWARFKSYMS > > > depends on !GCC_PLUGIN_RANDSTRUCT > > > depends on !RANDSTRUCT > > > depends on !DEBUG_INFO_BTF || PAHOLE_HAS_LANG_EXCLUDE > > > diff --git a/rust/Makefile b/rust/Makefile > > > index a40a3936126d603836e0ec9b42a1285916b60e45..80f970ad81f7989afe5ff2b5f633f50feb7f6006 100644 > > > --- a/rust/Makefile > > > +++ b/rust/Makefile > > > @@ -329,10 +329,11 @@ $(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_extra = ; > > > $(obj)/bindings/bindings_helpers_generated.rs: $(src)/helpers/helpers.c FORCE > > > $(call if_changed_dep,bindgen) > > > > > > +rust_exports = $(NM) -p --defined-only $(1) | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ { printf $(2),$(3) }' > > > + > > > quiet_cmd_exports = EXPORTS $@ > > > cmd_exports = \ > > > - $(NM) -p --defined-only $< \ > > > - | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ {printf "EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3}' > $@ > > > + $(call rust_exports,$<,"EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3) > $@ > > > > I noticed a nit: > > > > Both of the two callsites of rust_exports pass > > '$$3' to the last parameter instead of hardcoding it. > > > > Is it a flexibility for future extensions? > > > > I cannot think of any other use except for printing > > the third column, i.e. symbol name. > > Good catch, the last parameter isn't necessary anymore. It was used in > early versions of the series to also pass symbol addresses to > gendwarfksyms, but that's not needed since we read the symbol table > directly now. If you submit a diff, I will squash it to 5/5. (You do not need to input commit description body)
On Tue, Jan 14, 2025 at 10:22:15AM +0900, Masahiro Yamada wrote: > On Tue, Jan 14, 2025 at 5:04 AM Sami Tolvanen <samitolvanen@google.com> wrote: > > > > Hi Masahiro, > > > > On Fri, Jan 10, 2025 at 6:26 PM Masahiro Yamada <masahiroy@kernel.org> wrote: > > > > > > On Sat, Jan 4, 2025 at 2:37 AM Matthew Maurer <mmaurer@google.com> wrote: > > > > > > > > From: Sami Tolvanen <samitolvanen@google.com> > > > > > > > > Previously, two things stopped Rust from using MODVERSIONS: > > > > 1. Rust symbols are occasionally too long to be represented in the > > > > original versions table > > > > 2. Rust types cannot be properly hashed by the existing genksyms > > > > approach because: > > > > * Looking up type definitions in Rust is more complex than C > > > > * Type layout is potentially dependent on the compiler in Rust, > > > > not just the source type declaration. > > > > > > > > CONFIG_EXTENDED_MODVERSIONS addresses the first point, and > > > > CONFIG_GENDWARFKSYMS the second. If Rust wants to use MODVERSIONS, allow > > > > it to do so by selecting both features. > > > > > > > > Signed-off-by: Sami Tolvanen <samitolvanen@google.com> > > > > Co-developed-by: Matthew Maurer <mmaurer@google.com> > > > > Signed-off-by: Matthew Maurer <mmaurer@google.com> > > > > --- > > > > init/Kconfig | 3 ++- > > > > rust/Makefile | 34 ++++++++++++++++++++++++++++++++-- > > > > 2 files changed, 34 insertions(+), 3 deletions(-) > > > > > > > > diff --git a/init/Kconfig b/init/Kconfig > > > > index c1f9eb3d5f2e892e977ba1425599502dc830f552..b60acfd9431e0ac2bf401ecb6523b5104ad31150 100644 > > > > --- a/init/Kconfig > > > > +++ b/init/Kconfig > > > > @@ -1959,7 +1959,8 @@ config RUST > > > > bool "Rust support" > > > > depends on HAVE_RUST > > > > depends on RUST_IS_AVAILABLE > > > > - depends on !MODVERSIONS > > > > + select EXTENDED_MODVERSIONS if MODVERSIONS > > > > + depends on !MODVERSIONS || GENDWARFKSYMS > > > > depends on !GCC_PLUGIN_RANDSTRUCT > > > > depends on !RANDSTRUCT > > > > depends on !DEBUG_INFO_BTF || PAHOLE_HAS_LANG_EXCLUDE > > > > diff --git a/rust/Makefile b/rust/Makefile > > > > index a40a3936126d603836e0ec9b42a1285916b60e45..80f970ad81f7989afe5ff2b5f633f50feb7f6006 100644 > > > > --- a/rust/Makefile > > > > +++ b/rust/Makefile > > > > @@ -329,10 +329,11 @@ $(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_extra = ; > > > > $(obj)/bindings/bindings_helpers_generated.rs: $(src)/helpers/helpers.c FORCE > > > > $(call if_changed_dep,bindgen) > > > > > > > > +rust_exports = $(NM) -p --defined-only $(1) | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ { printf $(2),$(3) }' > > > > + > > > > quiet_cmd_exports = EXPORTS $@ > > > > cmd_exports = \ > > > > - $(NM) -p --defined-only $< \ > > > > - | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ {printf "EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3}' > $@ > > > > + $(call rust_exports,$<,"EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3) > $@ > > > > > > I noticed a nit: > > > > > > Both of the two callsites of rust_exports pass > > > '$$3' to the last parameter instead of hardcoding it. > > > > > > Is it a flexibility for future extensions? > > > > > > I cannot think of any other use except for printing > > > the third column, i.e. symbol name. > > > > Good catch, the last parameter isn't necessary anymore. It was used in > > early versions of the series to also pass symbol addresses to > > gendwarfksyms, but that's not needed since we read the symbol table > > directly now. > > If you submit a diff, I will squash it to 5/5. > (You do not need to input commit description body) Thanks, here's a diff that drops the last parameter. Sami diff --git a/rust/Makefile b/rust/Makefile index 80f970ad81f7..ab300bfb46f6 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -329,11 +329,11 @@ $(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_extra = ; $(obj)/bindings/bindings_helpers_generated.rs: $(src)/helpers/helpers.c FORCE $(call if_changed_dep,bindgen) -rust_exports = $(NM) -p --defined-only $(1) | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ { printf $(2),$(3) }' +rust_exports = $(NM) -p --defined-only $(1) | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ { printf $(2),$$3 }' quiet_cmd_exports = EXPORTS $@ cmd_exports = \ - $(call rust_exports,$<,"EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3) > $@ + $(call rust_exports,$<,"EXPORT_SYMBOL_RUST_GPL(%s);\n") > $@ $(obj)/exports_core_generated.h: $(obj)/core.o FORCE $(call if_changed,exports) @@ -404,7 +404,7 @@ endif ifdef CONFIG_MODVERSIONS cmd_gendwarfksyms = $(if $(skip_gendwarfksyms),, \ - $(call rust_exports,$@,"%s\n",$$3) | \ + $(call rust_exports,$@,"%s\n") | \ scripts/gendwarfksyms/gendwarfksyms \ $(if $(KBUILD_GENDWARFKSYMS_STABLE), --stable) \ $(if $(KBUILD_SYMTYPES), --symtypes $(@:.o=.symtypes),) \
On Wed, Jan 15, 2025 at 3:58 AM Sami Tolvanen <samitolvanen@google.com> wrote: > > On Tue, Jan 14, 2025 at 10:22:15AM +0900, Masahiro Yamada wrote: > > On Tue, Jan 14, 2025 at 5:04 AM Sami Tolvanen <samitolvanen@google.com> wrote: > > > > > > Hi Masahiro, > > > > > > On Fri, Jan 10, 2025 at 6:26 PM Masahiro Yamada <masahiroy@kernel.org> wrote: > > > > > > > > On Sat, Jan 4, 2025 at 2:37 AM Matthew Maurer <mmaurer@google.com> wrote: > > > > > > > > > > From: Sami Tolvanen <samitolvanen@google.com> > > > > > > > > > > Previously, two things stopped Rust from using MODVERSIONS: > > > > > 1. Rust symbols are occasionally too long to be represented in the > > > > > original versions table > > > > > 2. Rust types cannot be properly hashed by the existing genksyms > > > > > approach because: > > > > > * Looking up type definitions in Rust is more complex than C > > > > > * Type layout is potentially dependent on the compiler in Rust, > > > > > not just the source type declaration. > > > > > > > > > > CONFIG_EXTENDED_MODVERSIONS addresses the first point, and > > > > > CONFIG_GENDWARFKSYMS the second. If Rust wants to use MODVERSIONS, allow > > > > > it to do so by selecting both features. > > > > > > > > > > Signed-off-by: Sami Tolvanen <samitolvanen@google.com> > > > > > Co-developed-by: Matthew Maurer <mmaurer@google.com> > > > > > Signed-off-by: Matthew Maurer <mmaurer@google.com> > > > > > --- > > > > > init/Kconfig | 3 ++- > > > > > rust/Makefile | 34 ++++++++++++++++++++++++++++++++-- > > > > > 2 files changed, 34 insertions(+), 3 deletions(-) > > > > > > > > > > diff --git a/init/Kconfig b/init/Kconfig > > > > > index c1f9eb3d5f2e892e977ba1425599502dc830f552..b60acfd9431e0ac2bf401ecb6523b5104ad31150 100644 > > > > > --- a/init/Kconfig > > > > > +++ b/init/Kconfig > > > > > @@ -1959,7 +1959,8 @@ config RUST > > > > > bool "Rust support" > > > > > depends on HAVE_RUST > > > > > depends on RUST_IS_AVAILABLE > > > > > - depends on !MODVERSIONS > > > > > + select EXTENDED_MODVERSIONS if MODVERSIONS > > > > > + depends on !MODVERSIONS || GENDWARFKSYMS > > > > > depends on !GCC_PLUGIN_RANDSTRUCT > > > > > depends on !RANDSTRUCT > > > > > depends on !DEBUG_INFO_BTF || PAHOLE_HAS_LANG_EXCLUDE > > > > > diff --git a/rust/Makefile b/rust/Makefile > > > > > index a40a3936126d603836e0ec9b42a1285916b60e45..80f970ad81f7989afe5ff2b5f633f50feb7f6006 100644 > > > > > --- a/rust/Makefile > > > > > +++ b/rust/Makefile > > > > > @@ -329,10 +329,11 @@ $(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_extra = ; > > > > > $(obj)/bindings/bindings_helpers_generated.rs: $(src)/helpers/helpers.c FORCE > > > > > $(call if_changed_dep,bindgen) > > > > > > > > > > +rust_exports = $(NM) -p --defined-only $(1) | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ { printf $(2),$(3) }' > > > > > + > > > > > quiet_cmd_exports = EXPORTS $@ > > > > > cmd_exports = \ > > > > > - $(NM) -p --defined-only $< \ > > > > > - | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ {printf "EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3}' > $@ > > > > > + $(call rust_exports,$<,"EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3) > $@ > > > > > > > > I noticed a nit: > > > > > > > > Both of the two callsites of rust_exports pass > > > > '$$3' to the last parameter instead of hardcoding it. > > > > > > > > Is it a flexibility for future extensions? > > > > > > > > I cannot think of any other use except for printing > > > > the third column, i.e. symbol name. > > > > > > Good catch, the last parameter isn't necessary anymore. It was used in > > > early versions of the series to also pass symbol addresses to > > > gendwarfksyms, but that's not needed since we read the symbol table > > > directly now. > > > > If you submit a diff, I will squash it to 5/5. > > (You do not need to input commit description body) > > Thanks, here's a diff that drops the last parameter. Squashed. Thanks!
diff --git a/init/Kconfig b/init/Kconfig index c1f9eb3d5f2e892e977ba1425599502dc830f552..b60acfd9431e0ac2bf401ecb6523b5104ad31150 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1959,7 +1959,8 @@ config RUST bool "Rust support" depends on HAVE_RUST depends on RUST_IS_AVAILABLE - depends on !MODVERSIONS + select EXTENDED_MODVERSIONS if MODVERSIONS + depends on !MODVERSIONS || GENDWARFKSYMS depends on !GCC_PLUGIN_RANDSTRUCT depends on !RANDSTRUCT depends on !DEBUG_INFO_BTF || PAHOLE_HAS_LANG_EXCLUDE diff --git a/rust/Makefile b/rust/Makefile index a40a3936126d603836e0ec9b42a1285916b60e45..80f970ad81f7989afe5ff2b5f633f50feb7f6006 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -329,10 +329,11 @@ $(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_extra = ; $(obj)/bindings/bindings_helpers_generated.rs: $(src)/helpers/helpers.c FORCE $(call if_changed_dep,bindgen) +rust_exports = $(NM) -p --defined-only $(1) | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ { printf $(2),$(3) }' + quiet_cmd_exports = EXPORTS $@ cmd_exports = \ - $(NM) -p --defined-only $< \ - | awk '$$2~/(T|R|D|B)/ && $$3!~/__cfi/ {printf "EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3}' > $@ + $(call rust_exports,$<,"EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3) > $@ $(obj)/exports_core_generated.h: $(obj)/core.o FORCE $(call if_changed,exports) @@ -401,11 +402,36 @@ ifneq ($(or $(CONFIG_ARM64),$(and $(CONFIG_RISCV),$(CONFIG_64BIT))),) __ashlti3 __lshrti3 endif +ifdef CONFIG_MODVERSIONS +cmd_gendwarfksyms = $(if $(skip_gendwarfksyms),, \ + $(call rust_exports,$@,"%s\n",$$3) | \ + scripts/gendwarfksyms/gendwarfksyms \ + $(if $(KBUILD_GENDWARFKSYMS_STABLE), --stable) \ + $(if $(KBUILD_SYMTYPES), --symtypes $(@:.o=.symtypes),) \ + $@ >> $(dot-target).cmd) +endif + define rule_rustc_library $(call cmd_and_fixdep,rustc_library) $(call cmd,gen_objtooldep) + $(call cmd,gendwarfksyms) endef +define rule_rust_cc_library + $(call if_changed_rule,cc_o_c) + $(call cmd,force_checksrc) + $(call cmd,gendwarfksyms) +endef + +# helpers.o uses the same export mechanism as Rust libraries, so ensure symbol +# versions are calculated for the helpers too. +$(obj)/helpers/helpers.o: $(src)/helpers/helpers.c $(recordmcount_source) FORCE + +$(call if_changed_rule,rust_cc_library) + +# Disable symbol versioning for exports.o to avoid conflicts with the actual +# symbol versions generated from Rust objects. +$(obj)/exports.o: private skip_gendwarfksyms = 1 + $(obj)/core.o: private skip_clippy = 1 $(obj)/core.o: private skip_flags = -Wunreachable_pub $(obj)/core.o: private rustc_objcopy = $(foreach sym,$(redirect-intrinsics),--redefine-sym $(sym)=__rust$(sym)) @@ -417,13 +443,16 @@ ifneq ($(or $(CONFIG_X86_64),$(CONFIG_X86_32)),) $(obj)/core.o: scripts/target.json endif +$(obj)/compiler_builtins.o: private skip_gendwarfksyms = 1 $(obj)/compiler_builtins.o: private rustc_objcopy = -w -W '__*' $(obj)/compiler_builtins.o: $(src)/compiler_builtins.rs $(obj)/core.o FORCE +$(call if_changed_rule,rustc_library) +$(obj)/build_error.o: private skip_gendwarfksyms = 1 $(obj)/build_error.o: $(src)/build_error.rs $(obj)/compiler_builtins.o FORCE +$(call if_changed_rule,rustc_library) +$(obj)/ffi.o: private skip_gendwarfksyms = 1 $(obj)/ffi.o: $(src)/ffi.rs $(obj)/compiler_builtins.o FORCE +$(call if_changed_rule,rustc_library) @@ -435,6 +464,7 @@ $(obj)/bindings.o: $(src)/bindings/lib.rs \ +$(call if_changed_rule,rustc_library) $(obj)/uapi.o: private rustc_target_flags = --extern ffi +$(obj)/uapi.o: private skip_gendwarfksyms = 1 $(obj)/uapi.o: $(src)/uapi/lib.rs \ $(obj)/ffi.o \ $(obj)/uapi/uapi_generated.rs FORCE