1 | The following changes since commit 0db1851becbefe3e50cfc03776fb1f75817376af: | 1 | The following changes since commit 4871b51b9241b10f4fd8e04bbb21577886795e25: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-2.10-pull-request' into staging (2017-06-07 11:56:00 +0100) | 3 | vmgenid-test: use boot-sector infrastructure (2017-07-14 17:03:03 +0100) |
4 | 4 | ||
5 | are available in the git repository at: | 5 | are available in the git repository at: |
6 | 6 | ||
7 | git://github.com/stefanha/qemu.git tags/block-pull-request | 7 | git://github.com/stefanha/qemu.git tags/block-pull-request |
8 | 8 | ||
9 | for you to fetch changes up to 11cde1c81093a33c46c7a4039bf750bb61551087: | 9 | for you to fetch changes up to 593ed6f0a3c827a13a274e47f6fa980344234f9c: |
10 | 10 | ||
11 | configure: split c and cxx extra flags (2017-06-07 15:29:46 +0100) | 11 | block: fix shadowed variable in bdrv_co_pdiscard (2017-07-17 15:58:37 +0100) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | 14 | ||
15 | ---------------------------------------------------------------- | 15 | ---------------------------------------------------------------- |
16 | 16 | ||
17 | Bruno Dominguez (1): | 17 | Alistair Francis (1): |
18 | configure: split c and cxx extra flags | 18 | util/aio-win32: Only select on what we are actually waiting for |
19 | 19 | ||
20 | Philippe Mathieu-Daudé (2): | 20 | Denis V. Lunev (1): |
21 | oslib: strip trailing '\n' from error_setg() string argument | 21 | block: fix shadowed variable in bdrv_co_pdiscard |
22 | coccinelle: fix typo in comment | ||
23 | 22 | ||
24 | Roman Pen (1): | 23 | block/io.c | 1 - |
25 | coroutine-lock: do not touch coroutine after another one has been | 24 | util/aio-win32.c | 13 ++++++++++--- |
26 | entered | 25 | 2 files changed, 10 insertions(+), 4 deletions(-) |
27 | |||
28 | Stefan Hajnoczi (1): | ||
29 | .gdbinit: load QEMU sub-commands when gdb starts | ||
30 | |||
31 | configure | 75 ++++++++++++++++++-------------- | ||
32 | disas/libvixl/Makefile.objs | 4 +- | ||
33 | util/oslib-posix.c | 2 +- | ||
34 | util/qemu-coroutine-lock.c | 19 +++++++- | ||
35 | util/qemu-coroutine.c | 5 +++ | ||
36 | .gdbinit | 8 ++++ | ||
37 | rules.mak | 3 -- | ||
38 | scripts/coccinelle/return_directly.cocci | 2 +- | ||
39 | 8 files changed, 77 insertions(+), 41 deletions(-) | ||
40 | create mode 100644 .gdbinit | ||
41 | 26 | ||
42 | -- | 27 | -- |
43 | 2.9.4 | 28 | 2.9.4 |
44 | 29 | ||
45 | 30 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Alistair Francis <alistair.francis@xilinx.com> |
---|---|---|---|
2 | 2 | ||
3 | spotted by Coccinelle script scripts/coccinelle/err-bad-newline.cocci | 3 | Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> |
4 | 4 | Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | |
5 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
6 | Reviewed-by: Eric Blake <eblake@redhat.com> | 6 | Message-id: 9307b70e9876c4e9e3c4478524a32a23a3d5dd05.1499368180.git.alistair.francis@xilinx.com |
7 | Reviewed-by: Laurent Vivier <lvivier@redhat.com> | ||
8 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 7 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
9 | --- | 8 | --- |
10 | util/oslib-posix.c | 2 +- | 9 | util/aio-win32.c | 13 ++++++++++--- |
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | 10 | 1 file changed, 10 insertions(+), 3 deletions(-) |
12 | 11 | ||
13 | diff --git a/util/oslib-posix.c b/util/oslib-posix.c | 12 | diff --git a/util/aio-win32.c b/util/aio-win32.c |
14 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/util/oslib-posix.c | 14 | --- a/util/aio-win32.c |
16 | +++ b/util/oslib-posix.c | 15 | +++ b/util/aio-win32.c |
17 | @@ -XXX,XX +XXX,XX @@ void os_mem_prealloc(int fd, char *area, size_t memory, int smp_cpus, | 16 | @@ -XXX,XX +XXX,XX @@ void aio_set_fd_handler(AioContext *ctx, |
18 | /* touch pages simultaneously */ | 17 | } |
19 | if (touch_all_pages(area, hpagesize, numpages, smp_cpus)) { | 18 | } else { |
20 | error_setg(errp, "os_mem_prealloc: Insufficient free host memory " | 19 | HANDLE event; |
21 | - "pages available to allocate guest RAM\n"); | 20 | + long bitmask = 0; |
22 | + "pages available to allocate guest RAM"); | 21 | |
22 | if (node == NULL) { | ||
23 | /* Alloc and insert if it's not already there */ | ||
24 | @@ -XXX,XX +XXX,XX @@ void aio_set_fd_handler(AioContext *ctx, | ||
25 | node->io_write = io_write; | ||
26 | node->is_external = is_external; | ||
27 | |||
28 | + if (io_read) { | ||
29 | + bitmask |= FD_READ | FD_ACCEPT | FD_CLOSE; | ||
30 | + } | ||
31 | + | ||
32 | + if (io_write) { | ||
33 | + bitmask |= FD_WRITE | FD_CONNECT; | ||
34 | + } | ||
35 | + | ||
36 | event = event_notifier_get_handle(&ctx->notifier); | ||
37 | - WSAEventSelect(node->pfd.fd, event, | ||
38 | - FD_READ | FD_ACCEPT | FD_CLOSE | | ||
39 | - FD_CONNECT | FD_WRITE | FD_OOB); | ||
40 | + WSAEventSelect(node->pfd.fd, event, bitmask); | ||
23 | } | 41 | } |
24 | 42 | ||
25 | ret = sigaction(SIGBUS, &oldact, NULL); | 43 | qemu_lockcnt_unlock(&ctx->list_lock); |
26 | -- | 44 | -- |
27 | 2.9.4 | 45 | 2.9.4 |
28 | 46 | ||
29 | 47 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
2 | 1 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
4 | Reviewed-by: Eric Blake <eblake@redhat.com> | ||
5 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
6 | --- | ||
7 | scripts/coccinelle/return_directly.cocci | 2 +- | ||
8 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
9 | |||
10 | diff --git a/scripts/coccinelle/return_directly.cocci b/scripts/coccinelle/return_directly.cocci | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/scripts/coccinelle/return_directly.cocci | ||
13 | +++ b/scripts/coccinelle/return_directly.cocci | ||
14 | @@ -XXX,XX +XXX,XX @@ | ||
15 | -// replace 'R = X; return R;' with 'return R;' | ||
16 | +// replace 'R = X; return R;' with 'return X;' | ||
17 | @@ | ||
18 | identifier VAR; | ||
19 | expression E; | ||
20 | -- | ||
21 | 2.9.4 | ||
22 | |||
23 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | The scripts/qemu-gdb.py file is not easily discoverable. Add a .gdbinit | ||
2 | file so GDB either loads qemu-gdb.py automatically or prints a message | ||
3 | informing the user how to enable them (some systems disable ./.gdbinit | ||
4 | loading for security reasons). | ||
5 | 1 | ||
6 | Symlink .gdbinit and the scripts directory in order to make out-of-tree | ||
7 | builds work. The scripts directory is used to find the qemu-gdb.py file | ||
8 | specified by a relative path in .gdbinit. | ||
9 | |||
10 | Suggested-by: Eric Blake <eblake@redhat.com> | ||
11 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
12 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
13 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
14 | Tested-by: Eric Blake <eblake@redhat.com> | ||
15 | Message-id: 20170517124042.1430-1-stefanha@redhat.com | ||
16 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
17 | --- | ||
18 | configure | 1 + | ||
19 | .gdbinit | 8 ++++++++ | ||
20 | 2 files changed, 9 insertions(+) | ||
21 | create mode 100644 .gdbinit | ||
22 | |||
23 | diff --git a/configure b/configure | ||
24 | index XXXXXXX..XXXXXXX 100755 | ||
25 | --- a/configure | ||
26 | +++ b/configure | ||
27 | @@ -XXX,XX +XXX,XX @@ FILES="$FILES pc-bios/spapr-rtas/Makefile" | ||
28 | FILES="$FILES pc-bios/s390-ccw/Makefile" | ||
29 | FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" | ||
30 | FILES="$FILES pc-bios/qemu-icon.bmp" | ||
31 | +FILES="$FILES .gdbinit scripts" # scripts needed by relative path in .gdbinit | ||
32 | for bios_file in \ | ||
33 | $source_path/pc-bios/*.bin \ | ||
34 | $source_path/pc-bios/*.lid \ | ||
35 | diff --git a/.gdbinit b/.gdbinit | ||
36 | new file mode 100644 | ||
37 | index XXXXXXX..XXXXXXX | ||
38 | --- /dev/null | ||
39 | +++ b/.gdbinit | ||
40 | @@ -XXX,XX +XXX,XX @@ | ||
41 | +# GDB may have ./.gdbinit loading disabled by default. In that case you can | ||
42 | +# follow the instructions it prints. They boil down to adding the following to | ||
43 | +# your home directory's ~/.gdbinit file: | ||
44 | +# | ||
45 | +# add-auto-load-safe-path /path/to/qemu/.gdbinit | ||
46 | + | ||
47 | +# Load QEMU-specific sub-commands and settings | ||
48 | +source scripts/qemu-gdb.py | ||
49 | -- | ||
50 | 2.9.4 | ||
51 | |||
52 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Roman Pen <roman.penyaev@profitbricks.com> | ||
2 | 1 | ||
3 | Submission of requests on linux aio is a bit tricky and can lead to | ||
4 | requests completions on submission path: | ||
5 | |||
6 | 44713c9e8547 ("linux-aio: Handle io_submit() failure gracefully") | ||
7 | 0ed93d84edab ("linux-aio: process completions from ioq_submit()") | ||
8 | |||
9 | That means that any coroutine which has been yielded in order to wait | ||
10 | for completion can be resumed from submission path and be eventually | ||
11 | terminated (freed). | ||
12 | |||
13 | The following use-after-free crash was observed when IO throttling | ||
14 | was enabled: | ||
15 | |||
16 | Program received signal SIGSEGV, Segmentation fault. | ||
17 | [Switching to Thread 0x7f5813dff700 (LWP 56417)] | ||
18 | virtqueue_unmap_sg (elem=0x7f5804009a30, len=1, vq=<optimized out>) at virtio.c:252 | ||
19 | (gdb) bt | ||
20 | #0 virtqueue_unmap_sg (elem=0x7f5804009a30, len=1, vq=<optimized out>) at virtio.c:252 | ||
21 | ^^^^^^^^^^^^^^ | ||
22 | remember the address | ||
23 | |||
24 | #1 virtqueue_fill (vq=0x5598b20d21b0, elem=0x7f5804009a30, len=1, idx=0) at virtio.c:282 | ||
25 | #2 virtqueue_push (vq=0x5598b20d21b0, elem=elem@entry=0x7f5804009a30, len=<optimized out>) at virtio.c:308 | ||
26 | #3 virtio_blk_req_complete (req=req@entry=0x7f5804009a30, status=status@entry=0 '\000') at virtio-blk.c:61 | ||
27 | #4 virtio_blk_rw_complete (opaque=<optimized out>, ret=0) at virtio-blk.c:126 | ||
28 | #5 blk_aio_complete (acb=0x7f58040068d0) at block-backend.c:923 | ||
29 | #6 coroutine_trampoline (i0=<optimized out>, i1=<optimized out>) at coroutine-ucontext.c:78 | ||
30 | |||
31 | (gdb) p * elem | ||
32 | $8 = {index = 77, out_num = 2, in_num = 1, | ||
33 | in_addr = 0x7f5804009ad8, out_addr = 0x7f5804009ae0, | ||
34 | in_sg = 0x0, out_sg = 0x7f5804009a50} | ||
35 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
36 | 'in_sg' and 'out_sg' are invalid. | ||
37 | e.g. it is impossible that 'in_sg' is zero, | ||
38 | instead its value must be equal to: | ||
39 | |||
40 | (gdb) p/x 0x7f5804009ad8 + sizeof(elem->in_addr[0]) + 2 * sizeof(elem->out_addr[0]) | ||
41 | $26 = 0x7f5804009af0 | ||
42 | |||
43 | Seems 'elem' was corrupted. Meanwhile another thread raised an abort: | ||
44 | |||
45 | Thread 12 (Thread 0x7f57f2ffd700 (LWP 56426)): | ||
46 | #0 raise () from /lib/x86_64-linux-gnu/libc.so.6 | ||
47 | #1 abort () from /lib/x86_64-linux-gnu/libc.so.6 | ||
48 | #2 qemu_coroutine_enter (co=0x7f5804009af0) at qemu-coroutine.c:113 | ||
49 | #3 qemu_co_queue_run_restart (co=0x7f5804009a30) at qemu-coroutine-lock.c:60 | ||
50 | #4 qemu_coroutine_enter (co=0x7f5804009a30) at qemu-coroutine.c:119 | ||
51 | ^^^^^^^^^^^^^^^^^^ | ||
52 | WTF?? this is equal to elem from crashed thread | ||
53 | |||
54 | #5 qemu_co_queue_run_restart (co=0x7f57e7f16ae0) at qemu-coroutine-lock.c:60 | ||
55 | #6 qemu_coroutine_enter (co=0x7f57e7f16ae0) at qemu-coroutine.c:119 | ||
56 | #7 qemu_co_queue_run_restart (co=0x7f5807e112a0) at qemu-coroutine-lock.c:60 | ||
57 | #8 qemu_coroutine_enter (co=0x7f5807e112a0) at qemu-coroutine.c:119 | ||
58 | #9 qemu_co_queue_run_restart (co=0x7f5807f17820) at qemu-coroutine-lock.c:60 | ||
59 | #10 qemu_coroutine_enter (co=0x7f5807f17820) at qemu-coroutine.c:119 | ||
60 | #11 qemu_co_queue_run_restart (co=0x7f57e7f18e10) at qemu-coroutine-lock.c:60 | ||
61 | #12 qemu_coroutine_enter (co=0x7f57e7f18e10) at qemu-coroutine.c:119 | ||
62 | #13 qemu_co_enter_next (queue=queue@entry=0x5598b1e742d0) at qemu-coroutine-lock.c:106 | ||
63 | #14 timer_cb (blk=0x5598b1e74280, is_write=<optimized out>) at throttle-groups.c:419 | ||
64 | |||
65 | Crash can be explained by access of 'co' object from the loop inside | ||
66 | qemu_co_queue_run_restart(): | ||
67 | |||
68 | while ((next = QSIMPLEQ_FIRST(&co->co_queue_wakeup))) { | ||
69 | QSIMPLEQ_REMOVE_HEAD(&co->co_queue_wakeup, co_queue_next); | ||
70 | ^^^^^^^^^^^^^^^^^^^^ | ||
71 | on each iteration 'co' is accessed, | ||
72 | but 'co' can be already freed | ||
73 | |||
74 | qemu_coroutine_enter(next); | ||
75 | } | ||
76 | |||
77 | When 'next' coroutine is resumed (entered) it can in its turn resume | ||
78 | 'co', and eventually free it. That's why we see 'co' (which was freed) | ||
79 | has the same address as 'elem' from the first backtrace. | ||
80 | |||
81 | The fix is obvious: use temporary queue and do not touch coroutine after | ||
82 | first qemu_coroutine_enter() is invoked. | ||
83 | |||
84 | The issue is quite rare and happens every ~12 hours on very high IO | ||
85 | and CPU load (building linux kernel with -j512 inside guest) when IO | ||
86 | throttling is enabled. With the fix applied guest is running ~35 hours | ||
87 | and is still alive so far. | ||
88 | |||
89 | Signed-off-by: Roman Pen <roman.penyaev@profitbricks.com> | ||
90 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
91 | Message-id: 20170601160847.23720-1-roman.penyaev@profitbricks.com | ||
92 | Cc: Paolo Bonzini <pbonzini@redhat.com> | ||
93 | Cc: Fam Zheng <famz@redhat.com> | ||
94 | Cc: Stefan Hajnoczi <stefanha@redhat.com> | ||
95 | Cc: Kevin Wolf <kwolf@redhat.com> | ||
96 | Cc: qemu-devel@nongnu.org | ||
97 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
98 | --- | ||
99 | util/qemu-coroutine-lock.c | 19 +++++++++++++++++-- | ||
100 | util/qemu-coroutine.c | 5 +++++ | ||
101 | 2 files changed, 22 insertions(+), 2 deletions(-) | ||
102 | |||
103 | diff --git a/util/qemu-coroutine-lock.c b/util/qemu-coroutine-lock.c | ||
104 | index XXXXXXX..XXXXXXX 100644 | ||
105 | --- a/util/qemu-coroutine-lock.c | ||
106 | +++ b/util/qemu-coroutine-lock.c | ||
107 | @@ -XXX,XX +XXX,XX @@ void coroutine_fn qemu_co_queue_wait(CoQueue *queue, CoMutex *mutex) | ||
108 | void qemu_co_queue_run_restart(Coroutine *co) | ||
109 | { | ||
110 | Coroutine *next; | ||
111 | + QSIMPLEQ_HEAD(, Coroutine) tmp_queue_wakeup = | ||
112 | + QSIMPLEQ_HEAD_INITIALIZER(tmp_queue_wakeup); | ||
113 | |||
114 | trace_qemu_co_queue_run_restart(co); | ||
115 | - while ((next = QSIMPLEQ_FIRST(&co->co_queue_wakeup))) { | ||
116 | - QSIMPLEQ_REMOVE_HEAD(&co->co_queue_wakeup, co_queue_next); | ||
117 | + | ||
118 | + /* Because "co" has yielded, any coroutine that we wakeup can resume it. | ||
119 | + * If this happens and "co" terminates, co->co_queue_wakeup becomes | ||
120 | + * invalid memory. Therefore, use a temporary queue and do not touch | ||
121 | + * the "co" coroutine as soon as you enter another one. | ||
122 | + * | ||
123 | + * In its turn resumed "co" can pupulate "co_queue_wakeup" queue with | ||
124 | + * new coroutines to be woken up. The caller, who has resumed "co", | ||
125 | + * will be responsible for traversing the same queue, which may cause | ||
126 | + * a different wakeup order but not any missing wakeups. | ||
127 | + */ | ||
128 | + QSIMPLEQ_CONCAT(&tmp_queue_wakeup, &co->co_queue_wakeup); | ||
129 | + | ||
130 | + while ((next = QSIMPLEQ_FIRST(&tmp_queue_wakeup))) { | ||
131 | + QSIMPLEQ_REMOVE_HEAD(&tmp_queue_wakeup, co_queue_next); | ||
132 | qemu_coroutine_enter(next); | ||
133 | } | ||
134 | } | ||
135 | diff --git a/util/qemu-coroutine.c b/util/qemu-coroutine.c | ||
136 | index XXXXXXX..XXXXXXX 100644 | ||
137 | --- a/util/qemu-coroutine.c | ||
138 | +++ b/util/qemu-coroutine.c | ||
139 | @@ -XXX,XX +XXX,XX @@ void qemu_aio_coroutine_enter(AioContext *ctx, Coroutine *co) | ||
140 | |||
141 | qemu_co_queue_run_restart(co); | ||
142 | |||
143 | + /* Beware, if ret == COROUTINE_YIELD and qemu_co_queue_run_restart() | ||
144 | + * has started any other coroutine, "co" might have been reentered | ||
145 | + * and even freed by now! So be careful and do not touch it. | ||
146 | + */ | ||
147 | + | ||
148 | switch (ret) { | ||
149 | case COROUTINE_YIELD: | ||
150 | return; | ||
151 | -- | ||
152 | 2.9.4 | ||
153 | |||
154 | diff view generated by jsdifflib |
1 | From: Bruno Dominguez <bru.dominguez@gmail.com> | 1 | From: "Denis V. Lunev" <den@openvz.org> |
---|---|---|---|
2 | 2 | ||
3 | There was no possibility to add specific cxx flags using the configure | 3 | We've had a shadowed 'ret' variable, which risks returning the wrong |
4 | file. So A new entrance has been created to support it. | 4 | value, introduced in commit b9c64947. |
5 | 5 | ||
6 | Duplication of information in configure and rules.mak. Taking | 6 | Signed-off-by: Denis V. Lunev <den@openvz.org> |
7 | QEMU_CFLAGS and add them to QEMU_CXXFLAGS, now the value of | 7 | Reviewed-by: Fam Zheng <famz@redhat.com> |
8 | QEMU_CXXFLAGS is stored in config-host.mak, so there is no need for | 8 | Reviewed-by: Eric Blake <eblake@redhat.com> |
9 | it. | 9 | Message-id: 20170710150559.30163-1-den@openvz.org |
10 | 10 | CC: Stefan Hajnoczi <stefanha@redhat.com> | |
11 | The makefile for libvixl was adding flags for QEMU_CXXFLAGS in | 11 | CC: Kevin Wolf <kwolf@redhat.com> |
12 | QEMU_CFLAGS because of the addition in rules.mak. That was removed, so | 12 | CC: Eric Blake <eblake@redhat.com> |
13 | adding them where it should be. | ||
14 | |||
15 | Signed-off-by: Bruno Dominguez <bru.dominguez@gmail.com> | ||
16 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
17 | Message-id: 1496754467-20893-1-git-send-email-bru.dominguez@gmail.com | ||
18 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 13 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
19 | --- | 14 | --- |
20 | configure | 74 +++++++++++++++++++++++++-------------------- | 15 | block/io.c | 1 - |
21 | disas/libvixl/Makefile.objs | 4 +-- | 16 | 1 file changed, 1 deletion(-) |
22 | rules.mak | 3 -- | ||
23 | 3 files changed, 44 insertions(+), 37 deletions(-) | ||
24 | 17 | ||
25 | diff --git a/configure b/configure | 18 | diff --git a/block/io.c b/block/io.c |
26 | index XXXXXXX..XXXXXXX 100755 | ||
27 | --- a/configure | ||
28 | +++ b/configure | ||
29 | @@ -XXX,XX +XXX,XX @@ update_cxxflags() { | ||
30 | # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those | ||
31 | # options which some versions of GCC's C++ compiler complain about | ||
32 | # because they only make sense for C programs. | ||
33 | - QEMU_CXXFLAGS= | ||
34 | + QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS" | ||
35 | + | ||
36 | for arg in $QEMU_CFLAGS; do | ||
37 | case $arg in | ||
38 | -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\ | ||
39 | @@ -XXX,XX +XXX,XX @@ for opt do | ||
40 | --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg" | ||
41 | EXTRA_CFLAGS="$optarg" | ||
42 | ;; | ||
43 | + --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg" | ||
44 | + EXTRA_CXXFLAGS="$optarg" | ||
45 | + ;; | ||
46 | --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg" | ||
47 | EXTRA_LDFLAGS="$optarg" | ||
48 | ;; | ||
49 | @@ -XXX,XX +XXX,XX @@ for opt do | ||
50 | ;; | ||
51 | --extra-cflags=*) | ||
52 | ;; | ||
53 | + --extra-cxxflags=*) | ||
54 | + ;; | ||
55 | --extra-ldflags=*) | ||
56 | ;; | ||
57 | --enable-debug-info) | ||
58 | @@ -XXX,XX +XXX,XX @@ Advanced options (experts only): | ||
59 | --cxx=CXX use C++ compiler CXX [$cxx] | ||
60 | --objcc=OBJCC use Objective-C compiler OBJCC [$objcc] | ||
61 | --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS | ||
62 | + --extra-cxxflags=CXXFLAGS append extra C++ compiler flags QEMU_CXXFLAGS | ||
63 | --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS | ||
64 | --make=MAKE use specified make [$make] | ||
65 | --install=INSTALL use specified install [$install] | ||
66 | @@ -XXX,XX +XXX,XX @@ if test "$bogus_os" = "yes"; then | ||
67 | error_exit "Unrecognized host OS $targetos" | ||
68 | fi | ||
69 | |||
70 | -# Check that the C++ compiler exists and works with the C compiler | ||
71 | -if has $cxx; then | ||
72 | - cat > $TMPC <<EOF | ||
73 | -int c_function(void); | ||
74 | -int main(void) { return c_function(); } | ||
75 | -EOF | ||
76 | - | ||
77 | - compile_object | ||
78 | - | ||
79 | - cat > $TMPCXX <<EOF | ||
80 | -extern "C" { | ||
81 | - int c_function(void); | ||
82 | -} | ||
83 | -int c_function(void) { return 42; } | ||
84 | -EOF | ||
85 | - | ||
86 | - update_cxxflags | ||
87 | - | ||
88 | - if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then | ||
89 | - # C++ compiler $cxx works ok with C compiler $cc | ||
90 | - : | ||
91 | - else | ||
92 | - echo "C++ compiler $cxx does not work with C compiler $cc" | ||
93 | - echo "Disabling C++ specific optional code" | ||
94 | - cxx= | ||
95 | - fi | ||
96 | -else | ||
97 | - echo "No C++ compiler available; disabling C++ specific optional code" | ||
98 | - cxx= | ||
99 | -fi | ||
100 | - | ||
101 | gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" | ||
102 | gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" | ||
103 | gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" | ||
104 | @@ -XXX,XX +XXX,XX @@ EOF | ||
105 | fi | ||
106 | fi | ||
107 | |||
108 | +# Check that the C++ compiler exists and works with the C compiler. | ||
109 | +# All the QEMU_CXXFLAGS are based on QEMU_CFLAGS. Keep this at the end to don't miss any other that could be added. | ||
110 | +if has $cxx; then | ||
111 | + cat > $TMPC <<EOF | ||
112 | +int c_function(void); | ||
113 | +int main(void) { return c_function(); } | ||
114 | +EOF | ||
115 | + | ||
116 | + compile_object | ||
117 | + | ||
118 | + cat > $TMPCXX <<EOF | ||
119 | +extern "C" { | ||
120 | + int c_function(void); | ||
121 | +} | ||
122 | +int c_function(void) { return 42; } | ||
123 | +EOF | ||
124 | + | ||
125 | + update_cxxflags | ||
126 | + | ||
127 | + if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then | ||
128 | + # C++ compiler $cxx works ok with C compiler $cc | ||
129 | + : | ||
130 | + else | ||
131 | + echo "C++ compiler $cxx does not work with C compiler $cc" | ||
132 | + echo "Disabling C++ specific optional code" | ||
133 | + cxx= | ||
134 | + fi | ||
135 | +else | ||
136 | + echo "No C++ compiler available; disabling C++ specific optional code" | ||
137 | + cxx= | ||
138 | +fi | ||
139 | + | ||
140 | echo_version() { | ||
141 | if test "$1" = "yes" ; then | ||
142 | echo "($2)" | ||
143 | @@ -XXX,XX +XXX,XX @@ if test "$mingw32" = "no" ; then | ||
144 | fi | ||
145 | echo "qemu_helperdir=$libexecdir" >> $config_host_mak | ||
146 | echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak | ||
147 | +echo "extra_cxxflags=$EXTRA_CXXFLAGS" >> $config_host_mak | ||
148 | echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak | ||
149 | echo "qemu_localedir=$qemu_localedir" >> $config_host_mak | ||
150 | echo "libs_softmmu=$libs_softmmu" >> $config_host_mak | ||
151 | @@ -XXX,XX +XXX,XX @@ echo "WINDRES=$windres" >> $config_host_mak | ||
152 | echo "CFLAGS=$CFLAGS" >> $config_host_mak | ||
153 | echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak | ||
154 | echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak | ||
155 | +echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak | ||
156 | echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak | ||
157 | if test "$sparse" = "yes" ; then | ||
158 | echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak | ||
159 | diff --git a/disas/libvixl/Makefile.objs b/disas/libvixl/Makefile.objs | ||
160 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
161 | --- a/disas/libvixl/Makefile.objs | 20 | --- a/block/io.c |
162 | +++ b/disas/libvixl/Makefile.objs | 21 | +++ b/block/io.c |
163 | @@ -XXX,XX +XXX,XX @@ libvixl_OBJS = vixl/utils.o \ | 22 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_pdiscard(BlockDriverState *bs, int64_t offset, |
164 | 23 | assert(max_pdiscard >= bs->bl.request_alignment); | |
165 | # The -Wno-sign-compare is needed only for gcc 4.6, which complains about | 24 | |
166 | # some signed-unsigned equality comparisons which later gcc versions do not. | 25 | while (bytes > 0) { |
167 | -$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CFLAGS := -I$(SRC_PATH)/disas/libvixl $(QEMU_CFLAGS) -Wno-sign-compare | 26 | - int ret; |
168 | +$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CXXFLAGS := -I$(SRC_PATH)/disas/libvixl $(QEMU_CXXFLAGS) -Wno-sign-compare | 27 | int num = bytes; |
169 | # Ensure that C99 macros are defined regardless of the inclusion order of | 28 | |
170 | # headers in vixl. This is required at least on NetBSD. | 29 | if (head) { |
171 | -$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CFLAGS += -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS | ||
172 | +$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CXXFLAGS += -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS | ||
173 | |||
174 | common-obj-$(CONFIG_ARM_A64_DIS) += $(libvixl_OBJS) | ||
175 | diff --git a/rules.mak b/rules.mak | ||
176 | index XXXXXXX..XXXXXXX 100644 | ||
177 | --- a/rules.mak | ||
178 | +++ b/rules.mak | ||
179 | @@ -XXX,XX +XXX,XX @@ MAKEFLAGS += -rR | ||
180 | %.mak: | ||
181 | clean-target: | ||
182 | |||
183 | -# Flags for C++ compilation | ||
184 | -QEMU_CXXFLAGS = -D__STDC_LIMIT_MACROS $(filter-out -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wold-style-declaration -Wold-style-definition -Wredundant-decls, $(QEMU_CFLAGS)) | ||
185 | - | ||
186 | # Flags for dependency generation | ||
187 | QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(@D)/$(*F).d | ||
188 | |||
189 | -- | 30 | -- |
190 | 2.9.4 | 31 | 2.9.4 |
191 | 32 | ||
192 | 33 | diff view generated by jsdifflib |