On 21/08/2025 12.53, Aditya Gupta wrote:
On 25/08/20 05:55PM, Aditya Gupta wrote:
Currently when CONFIG_POWERNV is not enabled, the build fails, such as
with --without-default-devices:

     $ ./configure --without-default-devices
     $ make

     [281/283] Linking target qemu-system-ppc64
     FAILED: qemu-system-ppc64
     cc -m64 @qemu-system-ppc64.rsp
     /usr/bin/ld: libqemu-ppc64-softmmu.a.p/target_ppc_misc_helper.c.o: in 
function `helper_load_sprd':
     .../target/ppc/misc_helper.c:335:(.text+0xcdc): undefined reference to 
`pnv_chip_find_core'
     /usr/bin/ld: libqemu-ppc64-softmmu.a.p/target_ppc_misc_helper.c.o: in 
function `helper_store_sprd':
     .../target/ppc/misc_helper.c:375:(.text+0xdf4): undefined reference to 
`pnv_chip_find_core'
     collect2: error: ld returned 1 exit status
     ...

<...snip...>

The following is also sufficient to fix the compilation issue. Wasn't
sure if #ifdef POWERNV looks good there:

     diff --git a/target/ppc/misc_helper.c b/target/ppc/misc_helper.c
     index e7d94625185c..a8e55b2937c7 100644
     --- a/target/ppc/misc_helper.c
     +++ b/target/ppc/misc_helper.c
     @@ -323,6 +323,7 @@ void helper_store_sprc(CPUPPCState *env, target_ulong 
val)
target_ulong helper_load_sprd(CPUPPCState *env)
      {
     +#ifdef CONFIG_POWERNV
          /*
           * SPRD is a HV-only register for Power CPUs, so this will only be
           * accessed by powernv machines.
     @@ -361,11 +362,14 @@ target_ulong helper_load_sprd(CPUPPCState *env)
                                        TARGET_FMT_lx"\n", sprc);
              break;
          }
     +#endif

I don't think this is a good patch, it likely always disables the code, even if the POWERNV machine is available? At least it lacks the #include CONFIG_DEVICES that would be required here.

 Thomas


Reply via email to