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
    +
         return 0;
     }
     
     void helper_store_sprd(CPUPPCState *env, target_ulong val)
     {
    +#ifdef CONFIG_POWERNV
         target_ulong sprc = env->spr[SPR_POWER_SPRC];
         PowerPCCPU *cpu = env_archcpu(env);
         PnvCore *pc = pnv_cpu_state(cpu)->pnv_core;
    @@ -392,6 +396,7 @@ void helper_store_sprd(CPUPPCState *env, target_ulong 
val)
                                       TARGET_FMT_lx"\n", sprc);
             break;
         }
    +#endif
     }
     
     target_ulong helper_load_pmsr(CPUPPCState *env)

Reply via email to