tcg: Avoid setting tcg_initialize if !CONFIG_TCG
PATCH 1/1 tcg: Avoid setting tcg_initialize if !CONFIG_TCG
Fix the build for --disable-tcg.
--- target/arm/cpu.c | 2 ++ target/i386/cpu.c | 2 ++ target/mips/cpu.c | 2 ++ target/ppc/translate_init.c | 2 ++ target/s390x/cpu.c | 2 ++ 5 files changed, 10 insertions(+)
target/arm/cpu.c +2 -0
@@ -1760,7 +1760,9 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)#endif cc->disas_set_info = arm_disas_set_info; +#ifdef CONFIG_TCG cc->tcg_initialize = arm_translate_init; +#endif }static void cpu_register (const ARMCPUInfo *info)
target/i386/cpu.c +2 -0
@@ -4212,7 +4212,9 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)#endif cc->cpu_exec_enter = x86_cpu_exec_enter; cc->cpu_exec_exit = x86_cpu_exec_exit; +#ifdef CONFIG_TCG cc->tcg_initialize = tcg_x86_init; +#endif dc->user_creatable = true; }
target/mips/cpu.c +2 -0
@@ -198,7 +198,9 @@ static void mips_cpu_class_init(ObjectClass *c, void *data) cc->vmsd = &vmstate_mips_cpu;#endif cc->disas_set_info = mips_cpu_disas_set_info; +#ifdef CONFIG_TCG cc->tcg_initialize = mips_tcg_init; +#endif cc->gdb_num_core_regs =73 ; cc->gdb_stop_before_watchpoint = true;
target/ppc/translate_init.c +2 -0
@@ -10578,7 +10578,9 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)#ifndef CONFIG_USER_ONLY cc->virtio_is_big_endian = ppc_cpu_is_big_endian;#endif +#ifdef CONFIG_TCG cc->tcg_initialize = ppc_translate_init; +#endif dc->fw_name ="PowerPC,UNKNOWN" ; }
target/s390x/cpu.c +2 -0
@@ -497,7 +497,9 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)#endif #endif cc->disas_set_info = s390_cpu_disas_set_info; +#ifdef CONFIG_TCG cc->tcg_initialize = s390x_translate_init; +#endif cc->gdb_num_core_regs =S390_NUM_CORE_REGS ; cc->gdb_core_xml_file ="s390x-core64.xml" ;
Signature · 1 line
2.13.6
Quoted 17 lines · Richard Henderson
Fix the build for --disable-tcg.
Fixes 55c3ceef61fcf06fc98ddc752b7cce788ce7680bSigned-off-by Richard Henderson <[email protected]>--- target/arm/cpu.c | 2 ++ target/i386/cpu.c | 2 ++ target/mips/cpu.c | 2 ++ target/ppc/translate_init.c | 2 ++ target/s390x/cpu.c | 2 ++ 5 files changed, 10 insertions(+)target/arm/cpu.c +0
-0
target/arm/cpu.c static void arm_cpu_class_init(ObjectClass *oc, void *data) · line 1765
Quoted 6 lines
target/arm/cpu.c +2
-0@@ -1760,7 +1760,9 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)#endif cc->disas_set_info = arm_disas_set_info; +#ifdef CONFIG_TCG cc->tcg_initialize = arm_translate_init; +#endif
I'd prefer to have *_translate_init() stubs instead of the #ifdefs, but I guess it's better to fix the build as soon as possible, and worry about eliminating #ifdefs later.
Quoted 62 lines
target/arm/cpu.c +0
-0}static void cpu_register (const ARMCPUInfo *info)target/i386/cpu.c +2
-0@@ -4212,7 +4212,9 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)#endif cc->cpu_exec_enter = x86_cpu_exec_enter; cc->cpu_exec_exit = x86_cpu_exec_exit; +#ifdef CONFIG_TCG cc->tcg_initialize = tcg_x86_init; +#endif dc->user_creatable = true; }target/mips/cpu.c +2
-0@@ -198,7 +198,9 @@ static void mips_cpu_class_init(ObjectClass *c, void *data) cc->vmsd = &vmstate_mips_cpu;#endif cc->disas_set_info = mips_cpu_disas_set_info; +#ifdef CONFIG_TCG cc->tcg_initialize = mips_tcg_init; +#endif cc->gdb_num_core_regs =73 ; cc->gdb_stop_before_watchpoint = true;target/ppc/translate_init.c +2
-0@@ -10578,7 +10578,9 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)#ifndef CONFIG_USER_ONLY cc->virtio_is_big_endian = ppc_cpu_is_big_endian;#endif +#ifdef CONFIG_TCG cc->tcg_initialize = ppc_translate_init; +#endif dc->fw_name ="PowerPC,UNKNOWN" ; }target/s390x/cpu.c +2
-0@@ -497,7 +497,9 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)#endif #endif cc->disas_set_info = s390_cpu_disas_set_info; +#ifdef CONFIG_TCG cc->tcg_initialize = s390x_translate_init; +#endif cc->gdb_num_core_regs =S390_NUM_CORE_REGS ; cc->gdb_core_xml_file ="s390x-core64.xml" ;Signature · 1 line
2.13.6
Signature · 1 line
Eduardo
Quoted 11 lines · Richard Henderson
Fix the build for --disable-tcg.
Fixes 55c3ceef61fcf06fc98ddc752b7cce788ce7680bSigned-off-by Richard Henderson <[email protected]>--- target/arm/cpu.c | 2 ++ target/i386/cpu.c | 2 ++ target/mips/cpu.c | 2 ++ target/ppc/translate_init.c | 2 ++ target/s390x/cpu.c | 2 ++ 5 files changed, 10 insertions(+)
AFAIK the only target that is so far supposed to work with --disable-tcg is i386. The configure script however lets you try to build without TCG if the host has an alternative accelerator (e.g. KVM), but that build is likely to fail. [ just confirmed this with aarch64 ]
That said, I like that this patch takes care of other targets too.
Thanks,
Emilio
Quoted 4 lines · Emilio G. Cota
AFAIK the only target that is so far supposed to work with --disable-tcg is i386. The configure script however lets you try to build without TCG if the host has an alternative accelerator (e.g. KVM), but that build is likely to fail. [ just confirmed this with aarch64 ]
What about s390x?
LINK s390x-softmmu/qemu-system-s390x
exec.o: In function `tlb_reset_dirty_range_all':
exec.c:1118: undefined reference to tlb_reset_dirty' exec.o: In function tcg_commit':
exec.c:2765: undefined reference to cpu_reloading_memory_map' cpus.o: In function tcg_cpu_exec':
cpus.c:1270: undefined reference to `cpu_exec'
cpus.o: In function `qemu_tcg_rr_cpu_thread_fn':
cpus.c:1310: undefined reference to tcg_register_thread' cpus.c:1375: undefined reference to cpu_exec_step_atomic' cpus.o: In function `qemu_tcg_cpu_thread_fn':
cpus.c:1458: undefined reference to tcg_register_thread' cpus.c:1492: undefined reference to cpu_exec_step_atomic' cpus.o: In function `qemu_tcg_init_vcpu':
cpus.c:1679: undefined reference to tcg_region_init' cpus.c:1689: undefined reference to parallel_cpus' target/s390x/cpu.o: In function `s390_cpu_class_init':target/s390x/cpu.c:500: undefined reference to `s390x_translate_init'
collect2: error: ld returned 1 exit status
Oops sent a bit too fast.
Quoted 19 lines · Philippe Mathieu-Daudé
Quoted 4 lines · Emilio G. Cota
AFAIK the only target that is so far supposed to work with --disable-tcg is i386. The configure script however lets you try to build without TCG if the host has an alternative accelerator (e.g. KVM), but that build is likely to fail. [ just confirmed this with aarch64 ]
What about s390x?
LINK s390x-softmmu/qemu-system-s390x
exec.o: In function `tlb_reset_dirty_range_all':
exec.c:1118: undefined reference totlb_reset_dirty' exec.o: In functiontcg_commit':
exec.c:2765: undefined reference tocpu_reloading_memory_map' cpus.o: In functiontcg_cpu_exec':
cpus.c:1270: undefined reference tocpu_exec' cpus.o: In functionqemu_tcg_rr_cpu_thread_fn':
cpus.c:1310: undefined reference totcg_register_thread' cpus.c:1375: undefined reference tocpu_exec_step_atomic' cpus.o: In function `qemu_tcg_cpu_thread_fn':
Quoted 8 lines
cpus.c:1458: undefined reference to
tcg_register_thread' cpus.c:1492: undefined reference tocpu_exec_step_atomic' cpus.o: In function `qemu_tcg_init_vcpu':
cpus.c:1679: undefined reference totcg_region_init' cpus.c:1689: undefined reference toparallel_cpus'target/s390x/cpu.o: In function `s390_cpu_class_init':target/s390x/cpu.c:500: undefined reference to `s390x_translate_init'
collect2: error: ld returned 1 exit status
bisected to:
b11ec7f2e44b285a3967d629b55d1a6970b06787 is the first bad commit commit b11ec7f2e44b285a3967d629b55d1a6970b06787
Author: Yang Zhong <[email protected]> Date: Mon Jul 3 18:12:21 2017 +0800
tcg: add CONFIG_TCG guards in headers
Add CONFIG_TCG around TLB-related functions and structure declarations. Some of these functions are defined in ./accel/tcg/cputlb.c, which will not be linked in if TCG is disabled, and have no stubs; therefore, their callers will also be compiled out for --disable-tcg.
Quoted 5 lines · Philippe Mathieu-Daudé
Quoted 4 lines
AFAIK the only target that is so far supposed to work with --disable-tcg is i386. The configure script however lets you try to build without TCG if the host has an alternative accelerator (e.g. KVM), but that build is likely to fail. [ just confirmed this with aarch64 ]
What about s390x?
s390x and ppc64 supposedly support --disable-tcg?
Paolo
Quoted 8 lines · Paolo Bonzini
Quoted 5 lines · Philippe Mathieu-Daudé
Quoted 4 lines
AFAIK the only target that is so far supposed to work with --disable-tcg is i386. The configure script however lets you try to build without TCG if the host has an alternative accelerator (e.g. KVM), but that build is likely to fail. [ just confirmed this with aarch64 ]
What about s390x?
s390x and ppc64 supposedly support --disable-tcg?
s390x supports --disable-tcg, but ppc64 does not support it yet.
Thomas
Quoted 4 lines · Richard Henderson
Fix the build for --disable-tcg.
Fixes 55c3ceef61fcf06fc98ddc752b7cce788ce7680bSigned-off-by Richard Henderson <[email protected]>
Quoted 8 lines
--- target/arm/cpu.c | 2 ++ target/i386/cpu.c | 2 ++ target/mips/cpu.c | 2 ++ target/ppc/translate_init.c | 2 ++ target/s390x/cpu.c | 2 ++ 5 files changed, 10 insertions(+)
Applied to master as a buildfix, thanks.
-- PMM
Hi Peter,
Quoted 9 lines · Peter Maydell
Quoted 5 lines · Richard Henderson
Fix the build for --disable-tcg.
Fixes 55c3ceef61fcf06fc98ddc752b7cce788ce7680bSigned-off-by Richard Henderson <[email protected]>---
Applied to master as a buildfix, thanks.
I couldn't see this buildfix merged in /master so I provided another version using stubs and details about offending commits there:
http://lists.nongnu.org/archive/html/qemu-devel/2017-10/msg06530.html
In case you didn't pushed to /master you might consider this series instead.
I didn't include ARM/MIPS/PPC since they don't support building without TCG (yet).
Regards,
Phil.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Fix the build for --disable-tcg.
Fixes 55c3ceef61fcf06fc98ddc752b7cce788ce7680bSigned-off-by Richard Henderson <[email protected]>---
Quoted 8 lines
Quoted 1 line
Applied to master as a buildfix, thanks.
I couldn't see this buildfix merged in /master so I provided another version using stubs and details about offending commits there:
http://lists.nongnu.org/archive/html/qemu-devel/2017-10/msg06530.html
In case you didn't pushed to /master you might consider this series instead.
Oops sorry I missed it in commit 74d7fc7f6385 and the conflicting merge 6e6430a821a1.