Re: [PATCH v5 31/31] KVM: s390: arm64: Enable KVM_ARM64 config and Kbuild

[email protected]
Newsgroups org.kernel.vger.kvm,dev.linux.lists.kvmarm,org.kernel.vger.linux-s390
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] The namespace-mangling logic for built-in compilation (CONFIG_KVM_ARM64=y) uses invalid toolchain flags and incorrectly localizes exported symbols, breaking the build.
- [Low] Duplicate exported symbols cause a fatal modpost failure when both KVM modules are compiled as loadable modules (CONFIG_KVM_ARM64=m and CONFIG_KVM_S390=m).
--

--- Patch [31]: [PATCH v5 31/31] KVM: s390: arm64: Enable KVM_ARM64 config and Kbuild ---
commit c83e4eeb21e3c1207840240024b39a24634ecae4
Author: Steffen Eiden <[email protected]>

KVM: s390: arm64: Enable KVM_ARM64 config and Kbuild

Add all Kbuild/Makefile configurations to build a second KVM module on
s390 implementing the arm64-KVM API. To prevent symbol conflicts with
kvm-s390 all internal symbols in kvm-arm64 are mangled if compiled as
built-in.

> diff --git a/arch/s390/kvm/arm64/Makefile b/arch/s390/kvm/arm64/Makefile
> new file mode 100644
> index 0000000000000..a102c35664cae
> --- /dev/null
> +++ b/arch/s390/kvm/arm64/Makefile
[ ... ]
> +ifeq ($(CONFIG_KVM_ARM64),m)
> +
> +kvm-arm64-y = $(kvm-arm64-obj)

[Severity: Low]
Does this module build lead to identical global exported symbols?

If both CONFIG_KVM_ARM64=m and CONFIG_KVM_S390=m are selected, both modules
include the core virt/kvm files without symbol localization, which causes a
fatal modpost failure due to duplicate EXPORT_SYMBOL definitions.

> +
> +else ifeq ($(CONFIG_KVM_ARM64),y)
[ ... ]
> +quiet_cmd_nm_filter = NMFLTR  $@
> +	cmd_nm_filter = $(NM) -jU $< | sort -u > $@

[Severity: Low]
Are the -jU flags supported by GNU nm? Using unsupported flags causes a
fatal build error here.

> +
> +$(obj)/kvm_symbol_list: $(obj)/kvm-unnamespaced.o FORCE
> +	$(call if_changed,nm_filter)
> +
> +define rule_oc_o_o
> +	$(call cmd_and_savecmd,objcopy)
> +	$(call cmd,gen_objtooldep)
> +	$(call cmd,gen_symversions_o)
> +endef
> +
> +OBJCOPYFLAGS_kvm-namespaced.o := -O default --localize-symbols=$(obj)/kvm_symbol_list

[Severity: Low]
Is -O default a valid objcopy flag?

Additionally, does this incorrectly localize exported symbols? This breaks
the build by causing modpost to abort.

> +$(obj)/kvm-namespaced.o: $(obj)/kvm-unnamespaced.o $(obj)/kvm_symbol_list FORCE
> +	$(call if_changed_rule,oc_o_o)

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=31
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.