summaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorPeter Maydell2021-07-11 23:20:51 +0200
committerPeter Maydell2021-07-11 23:20:51 +0200
commitd1987c8114921eb30859854de664f879b5626da7 (patch)
treefc52e32918b955c996e73018e31f26caf119cc92 /meson.build
parentMerge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-for-6.1-pul... (diff)
parentmeson: Use input/output for entitlements target (diff)
downloadqemu-d1987c8114921eb30859854de664f879b5626da7.tar.gz
qemu-d1987c8114921eb30859854de664f879b5626da7.tar.xz
qemu-d1987c8114921eb30859854de664f879b5626da7.zip
Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging
* More SVM fixes (Lara) * Module annotation database (Gerd) * Memory leak fixes (myself) * Build fixes (myself) * --with-devices-* support (Alex) # gpg: Signature made Fri 09 Jul 2021 17:23:52 BST # gpg: using RSA key F13338574B662389866C7682BFFBD25F78C7AE83 # gpg: issuer "pbonzini@redhat.com" # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full] # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini-gitlab/tags/for-upstream: (48 commits) meson: Use input/output for entitlements target configure: allow the selection of alternate config in the build configs: rename default-configs to configs and reorganise hw/arm: move CONFIG_V7M out of default-devices hw/arm: add dependency on OR_IRQ for XLNX_VERSAL meson: Introduce target-specific Kconfig meson: switch function tests from compilation to linking vl: fix leak of qdict_crumple return value target/i386: fix exceptions for MOV to DR target/i386: Added DR6 and DR7 consistency checks target/i386: Added MSRPM and IOPM size check monitor/tcg: move tcg hmp commands to accel/tcg, register them dynamically usb: build usb-host as module monitor/usb: register 'info usbhost' dynamically usb: drop usb_host_dev_is_scsi_storage hook monitor: allow register hmp commands accel: build tcg modular accel: add tcg module annotations accel: build qtest modular accel: add qtest module annotations ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build142
1 files changed, 117 insertions, 25 deletions
diff --git a/meson.build b/meson.build
index eb362ee5eb..dd7f9ed6a8 100644
--- a/meson.build
+++ b/meson.build
@@ -92,6 +92,8 @@ if cpu in ['x86', 'x86_64']
}
endif
+modular_tcg = ['i386-softmmu', 'x86_64-softmmu']
+
edk2_targets = [ 'arm-softmmu', 'aarch64-softmmu', 'i386-softmmu', 'x86_64-softmmu' ]
install_edk2_blobs = false
if get_option('install_blobs')
@@ -1226,8 +1228,11 @@ config_host_data.set('CONFIG_VTE', vte.found())
config_host_data.set('CONFIG_LIBATTR', have_old_libattr)
config_host_data.set('CONFIG_LIBCAP_NG', libcap_ng.found())
config_host_data.set('CONFIG_EBPF', libbpf.found())
+config_host_data.set('CONFIG_LIBDAXCTL', libdaxctl.found())
config_host_data.set('CONFIG_LIBISCSI', libiscsi.found())
config_host_data.set('CONFIG_LIBNFS', libnfs.found())
+config_host_data.set('CONFIG_LINUX_IO_URING', linux_io_uring.found())
+config_host_data.set('CONFIG_LIBPMEM', libpmem.found())
config_host_data.set('CONFIG_RBD', rbd.found())
config_host_data.set('CONFIG_SDL', sdl.found())
config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
@@ -1240,6 +1245,7 @@ config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
config_host_data.set('CONFIG_VNC_PNG', png.found())
config_host_data.set('CONFIG_VNC_SASL', sasl.found())
config_host_data.set('CONFIG_VIRTFS', have_virtfs)
+config_host_data.set('CONFIG_VTE', vte.found())
config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
config_host_data.set('CONFIG_GETTID', has_gettid)
@@ -1337,10 +1343,10 @@ config_host_data.set('HAVE_STRUCT_STAT_ST_ATIM',
cc.has_member('struct stat', 'st_atim',
prefix: '#include <sys/stat.h>'))
-config_host_data.set('CONFIG_EVENTFD', cc.compiles('''
+config_host_data.set('CONFIG_EVENTFD', cc.links('''
#include <sys/eventfd.h>
int main(void) { return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); }'''))
-config_host_data.set('CONFIG_FDATASYNC', cc.compiles(gnu_source_prefix + '''
+config_host_data.set('CONFIG_FDATASYNC', cc.links(gnu_source_prefix + '''
#include <unistd.h>
int main(void) {
#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
@@ -1349,22 +1355,22 @@ config_host_data.set('CONFIG_FDATASYNC', cc.compiles(gnu_source_prefix + '''
#error Not supported
#endif
}'''))
-config_host_data.set('CONFIG_MADVISE', cc.compiles(gnu_source_prefix + '''
+config_host_data.set('CONFIG_MADVISE', cc.links(gnu_source_prefix + '''
#include <sys/types.h>
#include <sys/mman.h>
#include <stddef.h>
int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }'''))
-config_host_data.set('CONFIG_MEMFD', cc.compiles(gnu_source_prefix + '''
+config_host_data.set('CONFIG_MEMFD', cc.links(gnu_source_prefix + '''
#include <sys/mman.h>
int main(void) { return memfd_create("foo", MFD_ALLOW_SEALING); }'''))
-config_host_data.set('CONFIG_OPEN_BY_HANDLE', cc.compiles(gnu_source_prefix + '''
+config_host_data.set('CONFIG_OPEN_BY_HANDLE', cc.links(gnu_source_prefix + '''
#include <fcntl.h>
#if !defined(AT_EMPTY_PATH)
# error missing definition
#else
int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
#endif'''))
-config_host_data.set('CONFIG_PIPE2', cc.compiles(gnu_source_prefix + '''
+config_host_data.set('CONFIG_PIPE2', cc.links(gnu_source_prefix + '''
#include <unistd.h>
#include <fcntl.h>
@@ -1373,16 +1379,16 @@ config_host_data.set('CONFIG_PIPE2', cc.compiles(gnu_source_prefix + '''
int pipefd[2];
return pipe2(pipefd, O_CLOEXEC);
}'''))
-config_host_data.set('CONFIG_POSIX_MADVISE', cc.compiles(gnu_source_prefix + '''
+config_host_data.set('CONFIG_POSIX_MADVISE', cc.links(gnu_source_prefix + '''
#include <sys/mman.h>
#include <stddef.h>
int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }'''))
-config_host_data.set('CONFIG_SIGNALFD', cc.compiles(gnu_source_prefix + '''
+config_host_data.set('CONFIG_SIGNALFD', cc.links(gnu_source_prefix + '''
#include <unistd.h>
#include <sys/syscall.h>
#include <signal.h>
int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }'''))
-config_host_data.set('CONFIG_SPLICE', cc.compiles(gnu_source_prefix + '''
+config_host_data.set('CONFIG_SPLICE', cc.links(gnu_source_prefix + '''
#include <unistd.h>
#include <fcntl.h>
#include <limits.h>
@@ -1530,6 +1536,11 @@ foreach target : target_dirs
elif sym == 'CONFIG_XEN' and have_xen_pci_passthrough
config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' }
endif
+ if target in modular_tcg
+ config_target += { 'CONFIG_TCG_MODULAR': 'y' }
+ else
+ config_target += { 'CONFIG_TCG_BUILTIN': 'y' }
+ endif
accel_kconfig += [ sym + '=y' ]
endif
endforeach
@@ -1541,7 +1552,7 @@ foreach target : target_dirs
endif
actual_target_dirs += target
- config_target += keyval.load('default-configs/targets' / target + '.mak')
+ config_target += keyval.load('configs/targets' / target + '.mak')
config_target += { 'TARGET_' + config_target['TARGET_ARCH'].to_upper(): 'y' }
if 'TARGET_NEED_FDT' in config_target
@@ -1587,16 +1598,18 @@ foreach target : target_dirs
configuration: config_target_data)}
if target.endswith('-softmmu')
+ config_input = meson.get_external_property(target, 'default')
config_devices_mak = target + '-config-devices.mak'
config_devices_mak = configure_file(
- input: ['default-configs/devices' / target + '.mak', 'Kconfig'],
+ input: ['configs/devices' / target / config_input + '.mak', 'Kconfig'],
output: config_devices_mak,
depfile: config_devices_mak + '.d',
capture: true,
command: [minikconf,
get_option('default_devices') ? '--defconfig' : '--allnoconfig',
config_devices_mak, '@DEPFILE@', '@INPUT@',
- host_kconfig, accel_kconfig])
+ host_kconfig, accel_kconfig,
+ 'CONFIG_' + config_target['TARGET_ARCH'].to_upper() + '=y'])
config_devices_data = configuration_data()
config_devices = keyval.load(config_devices_mak)
@@ -1999,7 +2012,12 @@ trace_ss = ss.source_set()
user_ss = ss.source_set()
util_ss = ss.source_set()
+# accel modules
+qtest_module_ss = ss.source_set()
+tcg_module_ss = ss.source_set()
+
modules = {}
+target_modules = {}
hw_arch = {}
target_arch = {}
target_softmmu_arch = {}
@@ -2236,10 +2254,21 @@ specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss)
subdir('tests/qtest/libqos')
subdir('tests/qtest/fuzz')
+# accel modules
+tcg_real_module_ss = ss.source_set()
+tcg_real_module_ss.add_all(when: 'CONFIG_TCG_MODULAR', if_true: tcg_module_ss)
+specific_ss.add_all(when: 'CONFIG_TCG_BUILTIN', if_true: tcg_module_ss)
+target_modules += { 'accel' : { 'qtest': qtest_module_ss,
+ 'tcg': tcg_real_module_ss }}
+
########################
# Library dependencies #
########################
+modinfo_collect = find_program('scripts/modinfo-collect.py')
+modinfo_generate = find_program('scripts/modinfo-generate.py')
+modinfo_files = []
+
block_mods = []
softmmu_mods = []
foreach d, list : modules
@@ -2253,6 +2282,18 @@ foreach d, list : modules
else
softmmu_mods += sl
endif
+ if module_ss.sources() != []
+ # FIXME: Should use sl.extract_all_objects(recursive: true) as
+ # input. Sources can be used multiple times but objects are
+ # unique when it comes to lookup in compile_commands.json.
+ # Depnds on a mesion version with
+ # https://github.com/mesonbuild/meson/pull/8900
+ modinfo_files += custom_target(d + '-' + m + '.modinfo',
+ output: d + '-' + m + '.modinfo',
+ input: module_ss.sources(),
+ capture: true,
+ command: [modinfo_collect, '@INPUT@'])
+ endif
else
if d == 'block'
block_ss.add_all(module_ss)
@@ -2263,6 +2304,53 @@ foreach d, list : modules
endforeach
endforeach
+foreach d, list : target_modules
+ foreach m, module_ss : list
+ if enable_modules and targetos != 'windows'
+ foreach target : target_dirs
+ if target.endswith('-softmmu')
+ config_target = config_target_mak[target]
+ config_target += config_host
+ target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])]
+ c_args = ['-DNEED_CPU_H',
+ '-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
+ '-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
+ target_module_ss = module_ss.apply(config_target, strict: false)
+ if target_module_ss.sources() != []
+ module_name = d + '-' + m + '-' + config_target['TARGET_NAME']
+ sl = static_library(module_name,
+ [genh, target_module_ss.sources()],
+ dependencies: [modulecommon, target_module_ss.dependencies()],
+ include_directories: target_inc,
+ c_args: c_args,
+ pic: true)
+ softmmu_mods += sl
+ # FIXME: Should use sl.extract_all_objects(recursive: true) too.
+ modinfo_files += custom_target(module_name + '.modinfo',
+ output: module_name + '.modinfo',
+ input: target_module_ss.sources(),
+ capture: true,
+ command: [modinfo_collect, '--target', target, '@INPUT@'])
+ endif
+ endif
+ endforeach
+ else
+ specific_ss.add_all(module_ss)
+ endif
+ endforeach
+endforeach
+
+if enable_modules
+ modinfo_src = custom_target('modinfo.c',
+ output: 'modinfo.c',
+ input: modinfo_files,
+ command: [modinfo_generate, '@INPUT@'],
+ capture: true)
+ modinfo_lib = static_library('modinfo', modinfo_src)
+ modinfo_dep = declare_dependency(link_whole: modinfo_lib)
+ softmmu_ss.add(modinfo_dep)
+endif
+
nm = find_program('nm')
undefsym = find_program('scripts/undefsym.py')
block_syms = custom_target('block.syms', output: 'block.syms',
@@ -2524,28 +2612,32 @@ foreach target : target_dirs
link_args: link_args,
gui_app: exe['gui'])
- if 'CONFIG_HVF' in config_target
- entitlements = meson.current_source_dir() / 'accel/hvf/entitlements.plist'
- else
- entitlements = '/dev/null'
- endif
if targetos == 'darwin'
- icon = meson.current_source_dir() / 'pc-bios/qemu.rsrc'
+ icon = 'pc-bios/qemu.rsrc'
+ build_input = [emulator, files(icon)]
+ install_input = [
+ get_option('bindir') / exe_name,
+ meson.current_source_dir() / icon
+ ]
+ if 'CONFIG_HVF' in config_target
+ entitlements = 'accel/hvf/entitlements.plist'
+ build_input += files(entitlements)
+ install_input += meson.current_source_dir() / entitlements
+ endif
+
emulators += {exe['name'] : custom_target(exe['name'],
- depends: emulator,
+ input: build_input,
output: exe['name'],
command: [
- meson.current_source_dir() / 'scripts/entitlement.sh',
- meson.current_build_dir() / exe_name,
- meson.current_build_dir() / exe['name'],
- entitlements, icon
+ files('scripts/entitlement.sh'),
+ '@OUTPUT@',
+ '@INPUT@'
])
}
meson.add_install_script('scripts/entitlement.sh', '--install',
- get_option('bindir') / exe_name,
get_option('bindir') / exe['name'],
- entitlements, icon)
+ install_input)
else
emulators += {exe['name']: emulator}
endif