diff --git a/meson.build b/meson.build index c1e9612bbf..e73c228559 100644 --- a/meson.build +++ b/meson.build @@ -353,6 +353,10 @@ qemu_common_flags = [ qemu_cflags = [] qemu_ldflags = [] +# Trim unreferenced functions, data +qemu_common_flags += ['-ffunction-sections', '-fdata-sections'] +qemu_ldflags += '-Wl,--gc-sections' + if host_os == 'darwin' # Disable attempts to use ObjectiveC features in os/object.h since they # won't work when we're compiling with gcc as a C compiler.