Emulator code is large and involving it in guest operations cannot be
expected to be fast anyway. Help binary size as well as, for release
builds at least, compile time by building all involved code with size
optimization, independent of the build being a debug or a release one.

The size savings observed in a release build (with AMX and KeyLocker
code in place on top of what's upstream) are above 48k of .text, with
gcc 11.

Signed-off-by: Jan Beulich <jbeul...@suse.com>
---
v2: New.

--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -89,6 +89,7 @@ hostprogs-y += efi/mkreloc
 # Allows usercopy.c to include itself
 $(obj)/usercopy.o: CFLAGS-y += -iquote .
 
+$(obj)/x86_emulate.o: CFLAGS-y += -Os
 ifneq ($(CONFIG_HVM),y)
 $(obj)/x86_emulate.o: CFLAGS-y += -Wno-unused-label
 endif
--- a/xen/arch/x86/x86_emulate/Makefile
+++ b/xen/arch/x86/x86_emulate/Makefile
@@ -1,3 +1,5 @@
+CFLAGS-y += -Os
+
 obj-y += 0f01.o
 obj-y += 0fae.o
 obj-y += 0fc7.o


Reply via email to