bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Ignatov <rdna@fb.com>
To: Arvind Sankar <nivedita@alum.mit.edu>
Cc: Ard Biesheuvel <ardb@kernel.org>, <linux-efi@vger.kernel.org>,
	<bpf@vger.kernel.org>
Subject: Re: [PATCH 05/24] efi/libstub: Optimize for size instead of speed
Date: Thu, 4 Jun 2020 17:31:34 -0700	[thread overview]
Message-ID: <20200605003134.GA95743@rdna-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <20200518190716.751506-6-nivedita@alum.mit.edu>

[-- Attachment #1: Type: text/plain, Size: 5222 bytes --]

Arvind Sankar <nivedita@alum.mit.edu> [Wed, 1969-12-31 23:00 -0800]:
> 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 <nivedita@alum.mit.edu>
> ---
>  drivers/firmware/efi/libstub/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
> index fb34c9d14a3c..034d71663b1e 100644
> --- a/drivers/firmware/efi/libstub/Makefile
> +++ b/drivers/firmware/efi/libstub/Makefile
> @@ -7,7 +7,7 @@
>  #
>  cflags-$(CONFIG_X86_32)		:= -march=i386
>  cflags-$(CONFIG_X86_64)		:= -mcmodel=small
> -cflags-$(CONFIG_X86)		+= -m$(BITS) -D__KERNEL__ -O2 \
> +cflags-$(CONFIG_X86)		+= -m$(BITS) -D__KERNEL__ \
>  				   -fPIC -fno-strict-aliasing -mno-red-zone \
>  				   -mno-mmx -mno-sse -fshort-wchar \
>  				   -Wno-pointer-sign \
> @@ -25,7 +25,7 @@ cflags-$(CONFIG_ARM)		:= $(subst $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) \
>  
>  cflags-$(CONFIG_EFI_GENERIC_STUB) += -I$(srctree)/scripts/dtc/libfdt
>  
> -KBUILD_CFLAGS			:= $(cflags-y) -DDISABLE_BRANCH_PROFILING \
> +KBUILD_CFLAGS			:= $(cflags-y) -Os -DDISABLE_BRANCH_PROFILING \
>  				   -include $(srctree)/drivers/firmware/efi/libstub/hidden.h \
>  				   -D__NO_FORTIFY \
>  				   $(call cc-option,-ffreestanding) \

Hi Arvind,

This patch breaks build for me:

$>make -j32 -s bzImage
drivers/firmware/efi/libstub/alignedmem.c: In function \x2018efi_allocate_pages_aligned\x2019:
drivers/firmware/efi/libstub/alignedmem.c:38:9: sorry, unimplemented: ms_abi attribute requires -maccumulate-outgoing-args or subtarget optimization implying it
  status = efi_bs_call(allocate_pages, EFI_ALLOCATE_MAX_ADDRESS,
         ^
In file included from drivers/firmware/efi/libstub/alignedmem.c:6:0:
drivers/firmware/efi/libstub/efistub.h:49:64: sorry, unimplemented: ms_abi attribute requires -maccumulate-outgoing-args or subtarget optimization implying it
 #define efi_bs_call(func, ...) efi_system_table->boottime->func(__VA_ARGS__)
                                                                ^
drivers/firmware/efi/libstub/alignedmem.c:50:4: note: in expansion of macro \x2018efi_bs_call\x2019
    efi_bs_call(free_pages, alloc_addr, slack - l + 1);
    ^
drivers/firmware/efi/libstub/alignedmem.c:50: confused by earlier errors, bailing out
In file included from drivers/firmware/efi/libstub/efi-stub-helper.c:19:0:
drivers/firmware/efi/libstub/efi-stub-helper.c: In function \x2018efi_char16_puts\x2019:
drivers/firmware/efi/libstub/efistub.h:52:51: sorry, unimplemented: ms_abi attribute requires -maccumulate-outgoing-args or subtarget optimization implying it
 #define efi_call_proto(inst, func, ...) inst->func(inst, ##__VA_ARGS__)
                                                   ^
drivers/firmware/efi/libstub/efi-stub-helper.c:37:2: note: in expansion of macro \x2018efi_call_proto\x2019
  efi_call_proto(efi_table_attr(efi_system_table, con_out),
  ^
drivers/firmware/efi/libstub/efi-stub-helper.c:37: confused by earlier errors, bailing out
drivers/firmware/efi/libstub/file.c: In function \x2018handle_cmdline_files\x2019:
drivers/firmware/efi/libstub/file.c:73:9: sorry, unimplemented: ms_abi attribute requires -maccumulate-outgoing-args or subtarget optimization implying it
  status = efi_bs_call(handle_protocol, image->device_handle, &fs_proto,
         ^
drivers/firmware/efi/libstub/file.c:73: confused by earlier errors, bailing out
Preprocessed source stored into /tmp/ccc4T4FI.out file, please attach this to your bugreport.
make[5]: *** [drivers/firmware/efi/libstub/alignedmem.o] Error 1
make[5]: *** Waiting for unfinished jobs....
drivers/firmware/efi/libstub/gop.c: In function \x2018efi_setup_gop\x2019:
drivers/firmware/efi/libstub/gop.c:565:9: sorry, unimplemented: ms_abi attribute requires -maccumulate-outgoing-args or subtarget optimization implying it
  status = efi_bs_call(allocate_pool, EFI_LOADER_DATA, size,
         ^
drivers/firmware/efi/libstub/gop.c:565: confused by earlier errors, bailing out
Preprocessed source stored into /tmp/ccgQG7p4.out file, please attach this to your bugreport.
make[5]: *** [drivers/firmware/efi/libstub/efi-stub-helper.o] Error 1
Preprocessed source stored into /tmp/ccnqGnqG.out file, please attach this to your bugreport.
make[5]: *** [drivers/firmware/efi/libstub/file.o] Error 1
Preprocessed source stored into /tmp/ccle7n2N.out file, please attach this to your bugreport.
make[5]: *** [drivers/firmware/efi/libstub/gop.o] Error 1
make[4]: *** [drivers/firmware/efi/libstub] Error 2
make[3]: *** [drivers/firmware/efi] Error 2
make[2]: *** [drivers/firmware] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [drivers] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [sub-make] Error 2

Either reverting the patch or disabling CONFIG_EFI_STUB fixes it.

Initially I found it on bpf/bpf-next HEAD but same happens on
torvalds/linux.

I attach the config I used.

-- 
Andrey Ignatov

[-- Attachment #2: .config.gz --]
[-- Type: application/x-gunzip, Size: 33357 bytes --]

       reply	other threads:[~2020-06-05  0:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200518190716.751506-1-nivedita@alum.mit.edu>
     [not found] ` <20200518190716.751506-6-nivedita@alum.mit.edu>
2020-06-05  0:31   ` Andrey Ignatov [this message]
2020-06-05  6:33     ` [PATCH 05/24] efi/libstub: Optimize for size instead of speed Ard Biesheuvel
2020-06-05 13:14       ` Arvind Sankar
2020-06-05 13:32         ` Arvind Sankar
2020-06-05 14:53           ` Ard Biesheuvel
2020-06-05 15:10             ` Arvind Sankar
2020-06-05 15:11               ` Ard Biesheuvel
2020-06-05 15:06           ` [PATCH] efi/x86: Fix build with gcc 4 Arvind Sankar
2020-06-05 16:09             ` Andrey Ignatov
2020-06-15  9:43               ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200605003134.GA95743@rdna-mbp.dhcp.thefacebook.com \
    --to=rdna@fb.com \
    --cc=ardb@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=nivedita@alum.mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).