mirror_qemu/gdbstub/meson.build

40 lines
1.3 KiB
Meson
Raw Normal View History

#
# The main gdbstub still relies on per-build definitions of various
# types. The bits pushed to system/user.c try to use guest agnostic
# types such as hwaddr.
#
# We need to build the core gdb code via a library to be able to tweak
# cflags so:
gdb_user_ss = ss.source_set()
gdb_system_ss = ss.source_set()
# We build two versions of gdbstub, one for each mode
gdb_user_ss.add(files('gdbstub.c', 'user.c'))
gdb_system_ss.add(files('gdbstub.c', 'system.c'))
gdb_user_ss = gdb_user_ss.apply({})
gdb_system_ss = gdb_system_ss.apply({})
libgdb_user = static_library('gdb_user',
gdb_user_ss.sources() + genh,
name_suffix: 'fa',
gdbstub: Only build libgdb_user.fa / libgdb_softmmu.fa if necessary It is pointless to build libgdb_user.fa in a system-only build (or libgdb_softmmu.fa in a user-only build). Besides, in some restricted build configurations, some APIs might be restricted / not available. Example in a KVM-only builds where TCG is disabled: $ ninja qemu-system-x86_64 [99/2187] Compiling C object gdbstub/libgdb_user.fa.p/user.c.o FAILED: gdbstub/libgdb_user.fa.p/user.c.o ../../gdbstub/user.c: In function ‘gdb_breakpoint_insert’: ../../gdbstub/user.c:438:19: error: implicit declaration of function ‘cpu_breakpoint_insert’; did you mean ‘gdb_breakpoint_insert’? [-Werror=implicit-function-declaration] 438 | err = cpu_breakpoint_insert(cpu, addr, BP_GDB, NULL); | ^~~~~~~~~~~~~~~~~~~~~ | gdb_breakpoint_insert ../../gdbstub/user.c:438:19: error: nested extern declaration of ‘cpu_breakpoint_insert’ [-Werror=nested-externs] ../../gdbstub/user.c: In function ‘gdb_breakpoint_remove’: ../../gdbstub/user.c:459:19: error: implicit declaration of function ‘cpu_breakpoint_remove’; did you mean ‘gdb_breakpoint_remove’? [-Werror=implicit-function-declaration] 459 | err = cpu_breakpoint_remove(cpu, addr, BP_GDB); | ^~~~~~~~~~~~~~~~~~~~~ | gdb_breakpoint_remove ../../gdbstub/user.c:459:19: error: nested extern declaration of ‘cpu_breakpoint_remove’ [-Werror=nested-externs] cc1: all warnings being treated as errors ninja: build stopped: subcommand failed. Fixes: 61b2e136db ("gdbstub: only compile gdbstub twice for whole build") Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230329161852.84992-1-philmd@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20230403134920.2132362-3-alex.bennee@linaro.org>
2023-04-03 16:49:11 +03:00
c_args: '-DCONFIG_USER_ONLY',
build_by_default: false)
libgdb_system = static_library('gdb_system',
gdb_system_ss.sources() + genh,
gdbstub: Only build libgdb_user.fa / libgdb_softmmu.fa if necessary It is pointless to build libgdb_user.fa in a system-only build (or libgdb_softmmu.fa in a user-only build). Besides, in some restricted build configurations, some APIs might be restricted / not available. Example in a KVM-only builds where TCG is disabled: $ ninja qemu-system-x86_64 [99/2187] Compiling C object gdbstub/libgdb_user.fa.p/user.c.o FAILED: gdbstub/libgdb_user.fa.p/user.c.o ../../gdbstub/user.c: In function ‘gdb_breakpoint_insert’: ../../gdbstub/user.c:438:19: error: implicit declaration of function ‘cpu_breakpoint_insert’; did you mean ‘gdb_breakpoint_insert’? [-Werror=implicit-function-declaration] 438 | err = cpu_breakpoint_insert(cpu, addr, BP_GDB, NULL); | ^~~~~~~~~~~~~~~~~~~~~ | gdb_breakpoint_insert ../../gdbstub/user.c:438:19: error: nested extern declaration of ‘cpu_breakpoint_insert’ [-Werror=nested-externs] ../../gdbstub/user.c: In function ‘gdb_breakpoint_remove’: ../../gdbstub/user.c:459:19: error: implicit declaration of function ‘cpu_breakpoint_remove’; did you mean ‘gdb_breakpoint_remove’? [-Werror=implicit-function-declaration] 459 | err = cpu_breakpoint_remove(cpu, addr, BP_GDB); | ^~~~~~~~~~~~~~~~~~~~~ | gdb_breakpoint_remove ../../gdbstub/user.c:459:19: error: nested extern declaration of ‘cpu_breakpoint_remove’ [-Werror=nested-externs] cc1: all warnings being treated as errors ninja: build stopped: subcommand failed. Fixes: 61b2e136db ("gdbstub: only compile gdbstub twice for whole build") Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230329161852.84992-1-philmd@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20230403134920.2132362-3-alex.bennee@linaro.org>
2023-04-03 16:49:11 +03:00
name_suffix: 'fa',
build_by_default: false)
gdb_user = declare_dependency(link_whole: libgdb_user)
user_ss.add(gdb_user)
gdb_system = declare_dependency(link_whole: libgdb_system)
system_ss.add(gdb_system)
common_ss.add(files('syscalls.c'))
# The user-target is specialised by the guest
specific_ss.add(when: 'CONFIG_USER_ONLY', if_true: files('user-target.c'))