Skip to contentSkip to conversation

build fixes for --disable-tcg

PATCH In review Philippe Mathieu-Daudé 3 participants 10 messages Oct 30, 2017

lore
Share & tools
lore
#0 lore raw

cover build fixes for --disable-tcg

Hi,

This series add missing stubs (as suggested by Eduardo in [1]) to build the i386/s390x targets with --disable-tcg (the only targets building without TCG so far).

For git workflow ease, I split by offending commit (so one can branch from this particular commit and cherry-pick the corresponding fix[es]).

Regards,

Phil.

[1]: http://lists.nongnu.org/archive/html/qemu-devel/2017-10/msg06094.html

Philippe Mathieu-Daudé (5):
accel/tcg: add missing target-independent stubs
target/i386: tcg stubs
target/s390x: tcg stubs
accel/tcg: add a stub for tcg_region_init()
accel/tcg: add a stub for tcg_register_thread()

 accel/stubs/tcg-stub.c     | 27 +++++++++++++++++++++++++++
 target/i386/tcg-stub.c     | 13 +++++++++++++
 target/s390x/tcg-stub.c    | 13 +++++++++++++
 target/i386/Makefile.objs  |  1 +
 target/s390x/Makefile.objs |  1 +
 5 files changed, 55 insertions(+)
 create mode 100644 target/i386/tcg-stub.c
 create mode 100644 target/s390x/tcg-stub.c
Signature · 1 line
2.15.0.rc2
#1 lore raw

PATCH 1/5 accel/tcg: add missing target-independent stubs

missing since 44eff67341:

    LINK    x86_64-softmmu/qemu-system-x86_64

exec.o: In function `tlb_reset_dirty_range_all':
exec.c:1070: undefined reference to tlb_reset_dirty' exec.o: In function tcg_commit':
exec.c:2704: 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:1374: undefined reference to cpu_exec_step_atomic' cpus.o: In function qemu_tcg_cpu_thread_fn':
cpus.c:1490: undefined reference to cpu_exec_step_atomic' cpus.o: In function qemu_tcg_init_vcpu':
cpus.c:1675: undefined reference to `parallel_cpus'

---
 accel/stubs/tcg-stub.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
accel/stubs/tcg-stub.c +19 -0
index 5dd480b1a2..74ce45ea07 100644
@@ -17,6 +17,25 @@
 #include "exec/cpu-common.h"
 #include "exec/exec-all.h"
 
+bool parallel_cpus;
+
 void tb_flush(CPUState *cpu)
 {
 }
+
+void tlb_reset_dirty(CPUState *cpu, ram_addr_t start1, ram_addr_t length)
+{
+}
+
+int cpu_exec(CPUState *cpu)
+{
+    return -1;
+}
+
+void cpu_exec_step_atomic(CPUState *cpu)
+{
+}
+
+void cpu_reloading_memory_map(void)
+{
+}
Signature · 1 line
2.15.0.rc2
#2 lore raw

PATCH 2/5 target/i386: tcg stubs

In reply to Philippe Mathieu-Daudé

missing since 55c3ceef61:

    LINK    x86_64-softmmu/qemu-system-x86_64

target/i386/cpu.o: In function `x86_cpu_common_class_init':
target/i386/cpu.c:4215: undefined reference to `tcg_x86_init'

---
 target/i386/tcg-stub.c    | 13 +++++++++++++
 target/i386/Makefile.objs |  1 +
 2 files changed, 14 insertions(+)
 create mode 100644 target/i386/tcg-stub.c
target/i386/tcg-stub.c new file +13 -0
new file mode 100644
index 0000000000..e13d993a80
@@ -0,0 +1,13 @@
+/*
+ * QEMU TCG x86 specific function stubs
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+#include "qemu/osdep.h"
+#include "cpu.h"
+
+void tcg_x86_init(void)
+{
+}
target/i386/Makefile.objs +1 -0
index 6a26e9d9f0..2b3db1e5c2 100644
@@ -3,6 +3,7 @@ obj-$(CONFIG_TCG) += translate.o
 obj-$(CONFIG_TCG) += bpt_helper.o cc_helper.o excp_helper.o fpu_helper.o
 obj-$(CONFIG_TCG) += int_helper.o mem_helper.o misc_helper.o mpx_helper.o
 obj-$(CONFIG_TCG) += seg_helper.o smm_helper.o svm_helper.o
+obj-$(call lnot,$(CONFIG_TCG)) += tcg-stub.o
 obj-$(CONFIG_SOFTMMU) += machine.o arch_memory_mapping.o arch_dump.o monitor.o
 obj-$(CONFIG_KVM) += kvm.o hyperv.o
 obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
Signature · 1 line
2.15.0.rc2
#3 lore raw

Re: [Qemu-devel] [PATCH 2/5] target/i386: tcg stubs

Quoted 23 lines · Philippe Mathieu-Daudé

missing since 55c3ceef61:

    LINK    x86_64-softmmu/qemu-system-x86_64

target/i386/cpu.o: In function `x86_cpu_common_class_init':
target/i386/cpu.c:4215: undefined reference to `tcg_x86_init'

---
 target/i386/tcg-stub.c    | 13 +++++++++++++
 target/i386/Makefile.objs |  1 +
 2 files changed, 14 insertions(+)
 create mode 100644 target/i386/tcg-stub.c
target/i386/tcg-stub.c new file +3 -0
new file mode 100644
index 0000000000..e13d993a80
@@ -0,0 +1,13 @@
+/*
+ * QEMU TCG x86 specific function stubs
+ *

target/i386/tcg-stub.c line 13

Quoted 10 lines
target/i386/tcg-stub.c new file +10 -0
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+#include "qemu/osdep.h"
+#include "cpu.h"
+
+void tcg_x86_init(void)
+{
+}

I'm not sure my suggestion was really a good one. Requiring a separate stub file for each architecture looks like too much boilerplate code, which defeats the purpose of eliminating the #ifdefs. What if we just define inline stubs at target-*/cpu.h?

Quoted 15 lines
target/i386/Makefile.objs +1 -0
index 6a26e9d9f0..2b3db1e5c2 100644
@@ -3,6 +3,7 @@ obj-$(CONFIG_TCG) += translate.o
 obj-$(CONFIG_TCG) += bpt_helper.o cc_helper.o excp_helper.o fpu_helper.o
 obj-$(CONFIG_TCG) += int_helper.o mem_helper.o misc_helper.o mpx_helper.o
 obj-$(CONFIG_TCG) += seg_helper.o smm_helper.o svm_helper.o
+obj-$(call lnot,$(CONFIG_TCG)) += tcg-stub.o
 obj-$(CONFIG_SOFTMMU) += machine.o arch_memory_mapping.o arch_dump.o monitor.o
 obj-$(CONFIG_KVM) += kvm.o hyperv.o
 obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
Signature · 1 line
2.15.0.rc2
Signature · 1 line
Eduardo
#4 lore raw

PATCH 3/5 target/s390x: tcg stubs

In reply to Philippe Mathieu-Daudé

missing since 55c3ceef61:

    LINK    s390x-softmmu/qemu-system-s390x

target/s390x/cpu.o: In function `s390_cpu_class_init':
target/s390x/cpu.c:500: undefined reference to `s390x_translate_init'

---
 target/s390x/tcg-stub.c    | 13 +++++++++++++
 target/s390x/Makefile.objs |  1 +
 2 files changed, 14 insertions(+)
 create mode 100644 target/s390x/tcg-stub.c
target/s390x/tcg-stub.c new file +13 -0
new file mode 100644
index 0000000000..1e3ed46e89
@@ -0,0 +1,13 @@
+/*
+ * QEMU TCG support -- s390x specific function stubs.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "internal.h"
+
+void s390x_translate_init(void)
+{
+}
target/s390x/Makefile.objs +1 -0
index 31932de9cf..31dd498d01 100644
@@ -1,6 +1,7 @@
 obj-y += cpu.o cpu_models.o cpu_features.o gdbstub.o interrupt.o helper.o
 obj-$(CONFIG_TCG) += translate.o cc_helper.o excp_helper.o fpu_helper.o
 obj-$(CONFIG_TCG) += int_helper.o mem_helper.o misc_helper.o crypto_helper.o
+obj-$(call lnot,$(CONFIG_TCG)) += tcg-stub.o
 obj-$(CONFIG_SOFTMMU) += machine.o ioinst.o arch_dump.o mmu_helper.o diag.o
 obj-$(CONFIG_SOFTMMU) += sigp.o
 obj-$(CONFIG_KVM) += kvm.o
Signature · 1 line
2.15.0.rc2
#5 lore raw

Re: [Qemu-devel] [PATCH 3/5] target/s390x: tcg stubs

Quoted 8 lines · Philippe Mathieu-Daudé

missing since 55c3ceef61:

    LINK    s390x-softmmu/qemu-system-s390x

target/s390x/cpu.o: In function `s390_cpu_class_init':
target/s390x/cpu.c:500: undefined reference to `s390x_translate_init'

This is fixed already by 74d7fc7f6385158b8a5c524c61baaef1b66f3dac ("tcg: Avoid setting tcg_initialize if !CONFIG_TCG"), so please drop this patch.

Thomas

#6 lore raw

PATCH 4/5 accel/tcg: add a stub for tcg_region_init()

In reply to Philippe Mathieu-Daudé

missing since e8feb96fcc:

    LINK    x86_64-softmmu/qemu-system-x86_64

cpus.o: In function `qemu_tcg_init_vcpu':
cpus.c:1677: undefined reference to `tcg_region_init'

---
 accel/stubs/tcg-stub.c | 4 ++++
 1 file changed, 4 insertions(+)
accel/stubs/tcg-stub.c +4 -0
index 74ce45ea07..842a9cd352 100644
@@ -39,3 +39,7 @@ void cpu_exec_step_atomic(CPUState *cpu)
 void cpu_reloading_memory_map(void)
 {
 }
+
+void tcg_region_init(void)
+{
+}
Signature · 1 line
2.15.0.rc2
#7 lore raw

PATCH 5/5 accel/tcg: add a stub for tcg_register_thread()

In reply to Philippe Mathieu-Daudé

missing since 3468b59e18:

    LINK    x86_64-softmmu/qemu-system-x86_64

cpus.o: In function `qemu_tcg_rr_cpu_thread_fn':
cpus.c:1310: undefined reference to tcg_register_thread' cpus.o: In function qemu_tcg_cpu_thread_fn':
cpus.c:1458: undefined reference to `tcg_register_thread'

---
 accel/stubs/tcg-stub.c | 4 ++++
 1 file changed, 4 insertions(+)
accel/stubs/tcg-stub.c +4 -0
index 842a9cd352..8ec3885594 100644
@@ -43,3 +43,7 @@ void cpu_reloading_memory_map(void)
 void tcg_region_init(void)
 {
 }
+
+void tcg_register_thread(void)
+{
+}
Signature · 1 line
2.15.0.rc2
#8 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 5 lines · Philippe Mathieu-Daudé

Hi,

This series add missing stubs (as suggested by Eduardo in [1]) to build the i386/s390x targets with --disable-tcg (the only targets building without TCG so far).

Compiling with --disable-tcg works fine for me with the latest master branch as of today, on both x86 and s390x. Are you sure that these patches are still required?

Thomas

#9 lore raw

Hi Thomas,

Quoted 3 lines · Thomas Huth

Compiling with --disable-tcg works fine for me with the latest master branch as of today, on both x86 and s390x. Are you sure that these patches are still required?

I guess I didn't pulled /master early enough so I missed Peter's merge. Indeed a bug fix got applied so these patches are not required.

However they now allow less #ifdef'fery and might have value in git log history, so I'll wait a bit for Eduardo and Paolo comments before dropping it.

Regards,

Phil.