Skip to content

Commit bbf8e8b

Browse files
nivedita76ardbiesheuvel
authored andcommitted
efi/libstub: Optimize for size instead of speed
Reclaim the bloat from the addition of printf by optimizing the stub for size. With gcc 9, the text size of the stub is: ARCH before +printf -Os arm 35197 37889 34638 arm64 34883 38159 34479 i386 18571 21657 17025 x86_64 25677 29328 22144 Signed-off-by: Arvind Sankar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent 2c7d1e3 commit bbf8e8b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/firmware/efi/libstub/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
cflags-$(CONFIG_X86_32) := -march=i386
99
cflags-$(CONFIG_X86_64) := -mcmodel=small
10-
cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -O2 \
10+
cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ \
1111
-fPIC -fno-strict-aliasing -mno-red-zone \
1212
-mno-mmx -mno-sse -fshort-wchar \
1313
-Wno-pointer-sign \
@@ -25,7 +25,7 @@ cflags-$(CONFIG_ARM) := $(subst $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) \
2525

2626
cflags-$(CONFIG_EFI_GENERIC_STUB) += -I$(srctree)/scripts/dtc/libfdt
2727

28-
KBUILD_CFLAGS := $(cflags-y) -DDISABLE_BRANCH_PROFILING \
28+
KBUILD_CFLAGS := $(cflags-y) -Os -DDISABLE_BRANCH_PROFILING \
2929
-include $(srctree)/drivers/firmware/efi/libstub/hidden.h \
3030
-D__NO_FORTIFY \
3131
$(call cc-option,-ffreestanding) \

0 commit comments

Comments
 (0)