single-binary: compile some top level files once
cover single-binary: compile some top level files once
We still have some files left on top files that are compiled per target. Start with the ones included in this series.
Pierrick Bouvier (3):
cpu-target: build compilation unit once for user/system include/exec/target_page.h: move page-target.c to header system/main.c: compile only once
meson.build | 10 +++++----- include/exec/target_page.h | 11 ++++++++++- cpu-target.c | 5 ----- page-target.c | 10 ---------- target-info-stub.c | 4 ++++ system/meson.build | 1 + 6 files changed, 20 insertions(+), 21 deletions(-)
Signature · 1 line
2.47.2
PATCH 1/3 cpu-target: build compilation unit once for user/system
--- meson.build | 3 ++- cpu-target.c | 5 ----- target-info-stub.c | 4 ++++ 3 files changed, 6 insertions(+), 6 deletions(-)
meson.build +2 -1
@@ -3887,7 +3887,8 @@ endif common_ss.add(files('cpu-common.c')) common_ss.add(files('sanitizer.c')) -specific_ss.add(files('cpu-target.c')) +user_ss.add(files('cpu-target.c')) +system_ss.add(files('cpu-target.c')) subdir('system')
cpu-target.c +0 -5
@@ -18,7 +18,6 @@*/ #include "qemu/osdep.h" -#include "cpu.h" #include "accel/accel-cpu-ops.h" #include "system/cpus.h" #include "exec/cpu-common.h"
@@ -27,10 +26,6 @@#include "hw/core/cpu.h" #include "trace/trace-root.h" -/* Validate correct placement of CPUArchState. */ -QEMU_BUILD_BUG_ON (offsetof(ArchCPU , parent_obj) !=0 ); -QEMU_BUILD_BUG_ON (offsetof(ArchCPU , env) !=sizeof (CPUState)); -/* enable or disable single step mode. EXCP_DEBUG is returned by the CPU loop after each instruction */ void cpu_single_step (CPUState *cpu,int enabled)
target-info-stub.c +4 -0
@@ -12,6 +12,10 @@#include "hw/boards.h" #include "cpu.h" +/* Validate correct placement of CPUArchState. */ +QEMU_BUILD_BUG_ON (offsetof(ArchCPU , parent_obj) !=0 ); +QEMU_BUILD_BUG_ON (offsetof(ArchCPU , env) !=sizeof (CPUState)); +static const TargetInfo target_info_stub = { .target_name =TARGET_NAME , .target_arch =SYS_EMU_TARGET__MAX ,
Signature · 1 line
2.47.2
Re: [PATCH 1/3] cpu-target: build compilation unit once for user/system
Quoted 6 lines · Pierrick Bouvier
Signed-off-by Pierrick Bouvier<[email protected]>--- meson.build | 3 ++- cpu-target.c | 5 ----- target-info-stub.c | 4 ++++ 3 files changed, 6 insertions(+), 6 deletions(-)
r~
PATCH 2/3 include/exec/target_page.h: move page-target.c to header
In reply to Pierrick Bouvier--- meson.build | 2 +- include/exec/target_page.h | 11 ++++++++++- page-target.c | 10 ---------- 3 files changed, 11 insertions(+), 12 deletions(-)
meson.build +1 -1
@@ -3910,7 +3910,7 @@ if get_option('b_lto') pagevary = declare_dependency(link_with: pagevary) endif common_ss.add(pagevary) -specific_ss.add(files('page-target.c', 'page-vary-target.c')) +specific_ss.add(files('page-vary-target.c')) common_ss.add(files('target-info.c')) specific_ss.add(files('target-info-stub.c'))
include/exec/target_page.h +10 -1
@@ -62,6 +62,15 @@ static inline int qemu_target_page_bits(void) return TARGET_PAGE_BITS; } -size_t qemu_target_pages_to_MiB (size_t pages); +/* Convert target pages to MiB (2**20). */ +static inline size_t qemu_target_pages_to_MiB (size_t pages) +{ +int page_bits =TARGET_PAGE_BITS ; + +/* So far, the largest (non-huge) page size is 64k, i.e. 16 bits. */ +g_assert (page_bits <20 ); + +return pages >> (20 - page_bits); +}#endif
page-target.c +0 -10
@@ -9,13 +9,3 @@#include "qemu/osdep.h" #include "exec/target_page.h" -/* Convert target pages to MiB (2**20). */ -size_t qemu_target_pages_to_MiB (size_t pages) -{ -int page_bits =TARGET_PAGE_BITS ; - -/* So far, the largest (non-huge) page size is 64k, i.e. 16 bits. */ -g_assert (page_bits <20 ); - -return pages >> (20 - page_bits); -}
Signature · 1 line
2.47.2
Re: [PATCH 2/3] include/exec/target_page.h: move page-target.c to header
Quoted 15 lines · Pierrick Bouvier
Signed-off-by Pierrick Bouvier <[email protected]>--- meson.build | 2 +- include/exec/target_page.h | 11 ++++++++++- page-target.c | 10 ---------- 3 files changed, 11 insertions(+), 12 deletions(-)page-target.c +0
-0@@ -9,13 +9,3 @@#include "qemu/osdep.h" #include "exec/target_page.h"
page-target.c line 21
Quoted 10 lines
page-target.c +0
-10-/* Convert target pages to MiB (2**20). */ -size_t qemu_target_pages_to_MiB (size_t pages) -{ -int page_bits =TARGET_PAGE_BITS ; - -/* So far, the largest (non-huge) page size is 64k, i.e. 16 bits. */ -g_assert (page_bits <20 ); - -return pages >> (20 - page_bits); -}
You didn't completely remove the file, though you clearly intended to do so.
Otherwise,
r~
Re: [PATCH 2/3] include/exec/target_page.h: move page-target.c to header
Quoted 16 lines · Richard Henderson
Quoted 15 lines · Pierrick Bouvier
Signed-off-by Pierrick Bouvier <[email protected]>--- meson.build | 2 +- include/exec/target_page.h | 11 ++++++++++- page-target.c | 10 ---------- 3 files changed, 11 insertions(+), 12 deletions(-)page-target.c +0
-0@@ -9,13 +9,3 @@#include "qemu/osdep.h" #include "exec/target_page.h"
Quoted 13 lines
page-target.c line 21
Quoted 10 lines
page-target.c +0
-10-/* Convert target pages to MiB (2**20). */ -size_t qemu_target_pages_to_MiB (size_t pages) -{ -int page_bits =TARGET_PAGE_BITS ; - -/* So far, the largest (non-huge) page size is 64k, i.e. 16 bits. */ -g_assert (page_bits <20 ); - -return pages >> (20 - page_bits); -}You didn't completely remove the file, though you clearly intended to do so.
Right, thanks.
Quoted 5 lines
Otherwise,
Reviewed-by Richard Henderson <[email protected]>r~
PATCH 3/3 system/main.c: compile only once
In reply to Pierrick Bouvier--- meson.build | 5 ++--- system/meson.build | 1 + 2 files changed, 3 insertions(+), 3 deletions(-)
meson.build +2 -3
@@ -4437,14 +4437,14 @@ foreach target : target_dirs execs = [{ 'name': 'qemu-system-' + target_name, 'win_subsystem': 'console', - 'sources': files('system/main.c'), + 'sources': [], 'dependencies': [sdl] }] if host_os == 'windows' and (sdl.found() or gtk.found()) execs += [{ 'name': 'qemu-system-' + target_name + 'w', 'win_subsystem': 'windows', - 'sources': files('system/main.c'), + 'sources': [], 'dependencies': [sdl] }] endif
@@ -4519,7 +4519,6 @@ foreach lib: single_binary_libs single_binary_objects += lib.extract_all_objects(recursive: true) endforeach executable('qemu-system', - sources: files('system/main.c'), objects: single_binary_objects, dependencies: single_binary_deps, link_depends: [block_syms, qemu_syms],
system/meson.build +1 -0
@@ -18,6 +18,7 @@ system_ss.add(files( 'globals.c', 'ioport.c', 'ram-block-attributes.c', + 'main.c', 'memory_mapping.c', 'memory.c', 'physmem.c',
Signature · 1 line
2.47.2
Re: [PATCH 3/3] system/main.c: compile only once
Quoted 28 lines · Pierrick Bouvier
Signed-off-by Pierrick Bouvier <[email protected]>--- meson.build | 5 ++--- system/meson.build | 1 + 2 files changed, 3 insertions(+), 3 deletions(-)meson.build +2
-2@@ -4437,14 +4437,14 @@ foreach target : target_dirs execs = [{ 'name': 'qemu-system-' + target_name, 'win_subsystem': 'console', - 'sources': files('system/main.c'), + 'sources': [], 'dependencies': [sdl] }] if host_os == 'windows' and (sdl.found() or gtk.found()) execs += [{ 'name': 'qemu-system-' + target_name + 'w', 'win_subsystem': 'windows', - 'sources': files('system/main.c'), + 'sources': [], 'dependencies': [sdl] }] endif
meson.build foreach lib: single_binary_libs · line 4524
Quoted 7 lines
meson.build +0
-1@@ -4519,7 +4519,6 @@ foreach lib: single_binary_libs single_binary_objects += lib.extract_all_objects(recursive: true) endforeach executable('qemu-system', - sources: files('system/main.c'), objects: single_binary_objects, dependencies: single_binary_deps, link_depends: [block_syms, qemu_syms],
This series depends on stuff not upstream. But anyway,
r~
Re: [PATCH 3/3] system/main.c: compile only once
Quoted 39 lines · Richard Henderson
Quoted 28 lines · Pierrick Bouvier
Signed-off-by Pierrick Bouvier <[email protected]>--- meson.build | 5 ++--- system/meson.build | 1 + 2 files changed, 3 insertions(+), 3 deletions(-)meson.build +2
-2@@ -4437,14 +4437,14 @@ foreach target : target_dirs execs = [{ 'name': 'qemu-system-' + target_name, 'win_subsystem': 'console', - 'sources': files('system/main.c'), + 'sources': [], 'dependencies': [sdl] }] if host_os == 'windows' and (sdl.found() or gtk.found()) execs += [{ 'name': 'qemu-system-' + target_name + 'w', 'win_subsystem': 'windows', - 'sources': files('system/main.c'), + 'sources': [], 'dependencies': [sdl] }] endifmeson.build foreach lib: single_binary_libs · line 4524
Quoted 7 lines
meson.build +0
-1@@ -4519,7 +4519,6 @@ foreach lib: single_binary_libs single_binary_objects += lib.extract_all_objects(recursive: true) endforeach executable('qemu-system', - sources: files('system/main.c'), objects: single_binary_objects, dependencies: single_binary_deps, link_depends: [block_syms, qemu_syms],This series depends on stuff not upstream. But anyway,
Quoted 3 lines
Reviewed-by Richard Henderson <[email protected]>r~
Oh right, sorry. Depends on the patch adding the single-binary, which we didn't upstream yet. I'll hold this one a bit longer.