On 19/3/25 14:44, Peter Maydell wrote:
On Wed, 19 Mar 2025 at 12:53, Tanish Desai <tanishdesa...@gmail.com> wrote:

The issue started after commit 
https://github.com/qemu/qemu/commit/59f4d65584bd3372070e2484876436c8d02505e4

Reproduction:
   1. In the build directory on MacOS (haven't tried on other OS), run:
        ../configure --enable-rust --target-list=aarch64-softmmu
   2. Then run either:
        ninja -C .
        OR
        make
   3. At the end, you will encounter the error:
        duplicate symbol '_pl011_create' in:
            
/Users/tanishdesai37/Downloads/qemu-master/build/libcommon.a.p/hw_char_pl011.c.o
            
librust_aarch64_softmmu.a[5](pl011.pl011.390d424367e209af-cgu.1.rcgu.o)
        ld: 1 duplicate symbols

Root cause:
   Both CONFIG_PL011 and X_PL011_RUST are selected, causing C++ and Rust to 
produce the same object.
   This is due to the commit above where 'select PL011' forces a true condition 
instead of checking if HAVE_RUST is true.
   If HAVE_RUST is true, X_PL011_RUST should be selected instead of 
CONFIG_PL011.

Signed-off-by: Tanish Desai <tanishdesa...@gmail.com>
---
  hw/vmapple/Kconfig | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/vmapple/Kconfig b/hw/vmapple/Kconfig
index 2382b297672..01bcbf40e00 100644
--- a/hw/vmapple/Kconfig
+++ b/hw/vmapple/Kconfig
@@ -22,7 +22,8 @@ config VMAPPLE
      select PLATFORM_BUS
      select PCI_EXPRESS
      select PCI_EXPRESS_GENERIC_BRIDGE
-    select PL011 # UART
+    select PL011 if !HAVE_RUST # UART
+    select X_PL011_RUST if HAVE_RUST # UART
      select PL031 # RTC
      select PL061 # GPIO
      select GPIO_PWR

Paolo: we seem to have quite a lot of this

     select PL011 if !HAVE_RUST # UART
     select X_PL011_RUST if HAVE_RUST # UART

duplicated for every PL011-using machine. Can we factor this out
in Kconfig? e.g.

config PL011
     select X_PL011_RUST if HAVE_RUST
     select PL011_C if !HAVE_RUST

(and update hw/char/meson.build to use CONFIG_PL011_C for pl011.c).
Then all the machines can go back to plain "select PL011" and
don't need to care whether it's the Rust or C version.

Or does that not work?

This should work.


Reply via email to