[tip: efi/urgent] efi/x86: Fix build with gcc 4

From: tip-bot2 for Arvind Sankar
Date: Fri Jun 19 2020 - 12:46:30 EST


The following commit has been merged into the efi/urgent branch of tip:

Commit-ID: 5435f73d5c4a1b7504356876e69ba52de83f4975
Gitweb: https://git.kernel.org/tip/5435f73d5c4a1b7504356876e69ba52de83f4975
Author: Arvind Sankar <nivedita@xxxxxxxxxxxx>
AuthorDate: Fri, 05 Jun 2020 11:06:38 -04:00
Committer: Ard Biesheuvel <ardb@xxxxxxxxxx>
CommitterDate: Mon, 15 Jun 2020 11:41:14 +02:00

efi/x86: Fix build with gcc 4

Commit

bbf8e8b0fe04 ("efi/libstub: Optimize for size instead of speed")

changed the optimization level for the EFI stub to -Os from -O2.

Andrey Ignatov reports that this breaks the build with gcc 4.8.5.

Testing on godbolt.org, the combination of -Os,
-fno-asynchronous-unwind-tables, and ms_abi functions doesn't work,
failing with the error:
sorry, unimplemented: ms_abi attribute requires
-maccumulate-outgoing-args or subtarget optimization implying it

This does appear to work with gcc 4.9 onwards.

Add -maccumulate-outgoing-args explicitly to unbreak the build with
pre-4.9 versions of gcc.

Reported-by: Andrey Ignatov <rdna@xxxxxx>
Signed-off-by: Arvind Sankar <nivedita@xxxxxxxxxxxx>
Link: https://lore.kernel.org/r/20200605150638.1011637-1-nivedita@xxxxxxxxxxxx
Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
---
drivers/firmware/efi/libstub/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
index 75daaf2..4cce372 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -6,7 +6,8 @@
# enabled, even if doing so doesn't break the build.
#
cflags-$(CONFIG_X86_32) := -march=i386
-cflags-$(CONFIG_X86_64) := -mcmodel=small
+cflags-$(CONFIG_X86_64) := -mcmodel=small \
+ $(call cc-option,-maccumulate-outgoing-args)
cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ \
-fPIC -fno-strict-aliasing -mno-red-zone \
-mno-mmx -mno-sse -fshort-wchar \