1if not get_option('plugins') 2 subdir_done() 3endif 4 5qemu_plugin_symbols = configure_file( 6 input: files('../include/qemu/qemu-plugin.h'), 7 output: 'qemu-plugin.symbols', 8 capture: true, 9 command: [files('../scripts/qemu-plugin-symbols.py'), '@INPUT@']) 10 11# Modules need more symbols than just those in plugins/qemu-plugins.symbols 12if not enable_modules 13 if host_os == 'darwin' 14 configure_file( 15 input: qemu_plugin_symbols, 16 output: 'qemu-plugins-ld64.symbols', 17 capture: true, 18 command: ['sed', '-ne', 's/^[[:space:]]*\\(qemu_.*\\);/_\\1/p', '@INPUT@']) 19 emulator_link_args += ['-Wl,-exported_symbols_list,plugins/qemu-plugins-ld64.symbols'] 20 elif host_os == 'windows' and meson.get_compiler('c').get_id() == 'clang' 21 # LLVM/lld does not support exporting specific symbols. However, it works 22 # out of the box with dllexport/dllimport attribute we set in the code. 23 else 24 emulator_link_args += ['-Xlinker', '--dynamic-list=' + qemu_plugin_symbols.full_path()] 25 endif 26endif 27 28if host_os == 'windows' 29 # Generate a .lib file for plugins to link against. 30 # First, create a .def file listing all the symbols a plugin should expect to have 31 # available in qemu 32 win32_plugin_def = configure_file( 33 input: qemu_plugin_symbols, 34 output: 'qemu_plugin_api.def', 35 capture: true, 36 command: ['sed', '-e', '0,/^/s//EXPORTS/; s/[{};]//g', '@INPUT@']) 37 38 # then use dlltool to assemble a delaylib. 39 # The delaylib will have an "imaginary" name (qemu.exe), that is used by the 40 # linker file we add with plugins (win32_linker.c) to identify that we want 41 # to find missing symbols in current program. 42 win32_qemu_plugin_api_link_flags = ['-Lplugins', '-lqemu_plugin_api'] 43 if meson.get_compiler('c').get_id() == 'clang' 44 # With LLVM/lld, delaylib is specified at link time (-delayload) 45 dlltool = find_program('llvm-dlltool', required: true) 46 dlltool_cmd = [dlltool, '-d', '@INPUT@', '-l', '@OUTPUT@', '-D', 'qemu.exe'] 47 win32_qemu_plugin_api_link_flags += ['-Wl,-delayload=qemu.exe'] 48 else 49 # With gcc/ld, delay lib is built with a specific delay parameter. 50 dlltool = find_program('dlltool', required: true) 51 dlltool_cmd = [dlltool, '--input-def', '@INPUT@', 52 '--output-delaylib', '@OUTPUT@', '--dllname', 'qemu.exe'] 53 endif 54 win32_qemu_plugin_api_lib = configure_file( 55 input: win32_plugin_def, 56 output: 'libqemu_plugin_api.a', 57 command: dlltool_cmd 58 ) 59endif 60specific_ss.add(files( 61 'loader.c', 62 'core.c', 63 'api.c', 64)) 65