* Re: [PATCH 05/24] efi/libstub: Optimize for size instead of speed
[not found] ` <20200518190716.751506-6-nivedita@alum.mit.edu>
@ 2020-06-05 0:31 ` Andrey Ignatov
2020-06-05 6:33 ` Ard Biesheuvel
0 siblings, 1 reply; 10+ messages in thread
From: Andrey Ignatov @ 2020-06-05 0:31 UTC (permalink / raw)
To: Arvind Sankar; +Cc: Ard Biesheuvel, linux-efi, bpf
[-- 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 --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 05/24] efi/libstub: Optimize for size instead of speed
2020-06-05 0:31 ` [PATCH 05/24] efi/libstub: Optimize for size instead of speed Andrey Ignatov
@ 2020-06-05 6:33 ` Ard Biesheuvel
2020-06-05 13:14 ` Arvind Sankar
0 siblings, 1 reply; 10+ messages in thread
From: Ard Biesheuvel @ 2020-06-05 6:33 UTC (permalink / raw)
To: Andrey Ignatov; +Cc: Arvind Sankar, linux-efi, bpf
Hello Andrey,
On Fri, 5 Jun 2020 at 02:31, Andrey Ignatov <rdna@fb.com> wrote:
>
> 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,
> ^
Which version of GCC are you using?
> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 05/24] efi/libstub: Optimize for size instead of speed
2020-06-05 6:33 ` Ard Biesheuvel
@ 2020-06-05 13:14 ` Arvind Sankar
2020-06-05 13:32 ` Arvind Sankar
0 siblings, 1 reply; 10+ messages in thread
From: Arvind Sankar @ 2020-06-05 13:14 UTC (permalink / raw)
To: Ard Biesheuvel; +Cc: Andrey Ignatov, Arvind Sankar, linux-efi, bpf
On Fri, Jun 05, 2020 at 08:33:22AM +0200, Ard Biesheuvel wrote:
> Hello Andrey,
>
> On Fri, 5 Jun 2020 at 02:31, Andrey Ignatov <rdna@fb.com> wrote:
> >
> > 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,
> > ^
>
> Which version of GCC are you using?
gcc-4.8.5 from the config. I got a copy and can reproduce it. Just
adding -maccumulate-outgoing-args appears to fix it, checking some more.
>
>
> > 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 05/24] efi/libstub: Optimize for size instead of speed
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:06 ` [PATCH] efi/x86: Fix build with gcc 4 Arvind Sankar
0 siblings, 2 replies; 10+ messages in thread
From: Arvind Sankar @ 2020-06-05 13:32 UTC (permalink / raw)
To: Arvind Sankar; +Cc: Ard Biesheuvel, Andrey Ignatov, linux-efi, bpf
On Fri, Jun 05, 2020 at 09:14:19AM -0400, Arvind Sankar wrote:
> On Fri, Jun 05, 2020 at 08:33:22AM +0200, Ard Biesheuvel wrote:
> > Hello Andrey,
> >
> > On Fri, 5 Jun 2020 at 02:31, Andrey Ignatov <rdna@fb.com> wrote:
> > >
> > > 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,
> > > ^
> >
> > Which version of GCC are you using?
>
> gcc-4.8.5 from the config. I got a copy and can reproduce it. Just
> adding -maccumulate-outgoing-args appears to fix it, checking some more.
>
On a simple test:
extern void __attribute__ (( ms_abi )) ms_abi();
void sysv_abi(void) { ms_abi(); }
it only breaks with -Os -fno-asynchronous-unwind-tables, weirdly enough.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 05/24] efi/libstub: Optimize for size instead of speed
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:06 ` [PATCH] efi/x86: Fix build with gcc 4 Arvind Sankar
1 sibling, 1 reply; 10+ messages in thread
From: Ard Biesheuvel @ 2020-06-05 14:53 UTC (permalink / raw)
To: Arvind Sankar; +Cc: Andrey Ignatov, linux-efi, bpf
On Fri, 5 Jun 2020 at 15:32, Arvind Sankar <nivedita@alum.mit.edu> wrote:
>
> On Fri, Jun 05, 2020 at 09:14:19AM -0400, Arvind Sankar wrote:
> > On Fri, Jun 05, 2020 at 08:33:22AM +0200, Ard Biesheuvel wrote:
> > > Hello Andrey,
> > >
> > > On Fri, 5 Jun 2020 at 02:31, Andrey Ignatov <rdna@fb.com> wrote:
> > > >
> > > > 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,
> > > > ^
> > >
> > > Which version of GCC are you using?
> >
> > gcc-4.8.5 from the config. I got a copy and can reproduce it. Just
> > adding -maccumulate-outgoing-args appears to fix it, checking some more.
> >
>
> On a simple test:
> extern void __attribute__ (( ms_abi )) ms_abi();
> void sysv_abi(void) { ms_abi(); }
> it only breaks with -Os -fno-asynchronous-unwind-tables, weirdly enough.
I guess the logic that decides whether -maccumulate-outgoing-args is
enabled is somewhat opaque.
Could we perhaps back out the -Os change for 4.8 and earlier?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] efi/x86: Fix build with gcc 4
2020-06-05 13:32 ` Arvind Sankar
2020-06-05 14:53 ` Ard Biesheuvel
@ 2020-06-05 15:06 ` Arvind Sankar
2020-06-05 16:09 ` Andrey Ignatov
1 sibling, 1 reply; 10+ messages in thread
From: Arvind Sankar @ 2020-06-05 15:06 UTC (permalink / raw)
To: Ard Biesheuvel, Andrey Ignatov; +Cc: linux-efi, bpf
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@fb.com>
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
---
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 cce4a7436052..d67418de768c 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 \
--
2.26.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 05/24] efi/libstub: Optimize for size instead of speed
2020-06-05 14:53 ` Ard Biesheuvel
@ 2020-06-05 15:10 ` Arvind Sankar
2020-06-05 15:11 ` Ard Biesheuvel
0 siblings, 1 reply; 10+ messages in thread
From: Arvind Sankar @ 2020-06-05 15:10 UTC (permalink / raw)
To: Ard Biesheuvel; +Cc: Arvind Sankar, Andrey Ignatov, linux-efi, bpf
On Fri, Jun 05, 2020 at 04:53:59PM +0200, Ard Biesheuvel wrote:
> I guess the logic that decides whether -maccumulate-outgoing-args is
> enabled is somewhat opaque.
>
> Could we perhaps back out the -Os change for 4.8 and earlier?
I just sent a patch to add the accumulate-outgoing-args option
explicitly. That fixes 4.8.5 and doesn't seem to affect at least
gcc-9.3.0, which presumably already enables it automatically.
Thanks.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 05/24] efi/libstub: Optimize for size instead of speed
2020-06-05 15:10 ` Arvind Sankar
@ 2020-06-05 15:11 ` Ard Biesheuvel
0 siblings, 0 replies; 10+ messages in thread
From: Ard Biesheuvel @ 2020-06-05 15:11 UTC (permalink / raw)
To: Arvind Sankar; +Cc: Andrey Ignatov, linux-efi, bpf
On Fri, 5 Jun 2020 at 17:10, Arvind Sankar <nivedita@alum.mit.edu> wrote:
>
> On Fri, Jun 05, 2020 at 04:53:59PM +0200, Ard Biesheuvel wrote:
> > I guess the logic that decides whether -maccumulate-outgoing-args is
> > enabled is somewhat opaque.
> >
> > Could we perhaps back out the -Os change for 4.8 and earlier?
>
> I just sent a patch to add the accumulate-outgoing-args option
> explicitly. That fixes 4.8.5 and doesn't seem to affect at least
> gcc-9.3.0, which presumably already enables it automatically.
>
Fair enough.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] efi/x86: Fix build with gcc 4
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
0 siblings, 1 reply; 10+ messages in thread
From: Andrey Ignatov @ 2020-06-05 16:09 UTC (permalink / raw)
To: Arvind Sankar; +Cc: Ard Biesheuvel, linux-efi, bpf
Arvind Sankar <nivedita@alum.mit.edu> [Fri, 2020-06-05 08:06 -0700]:
> 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@fb.com>
> Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Thanks. I confirmed it fixes the problem on my setup with gcc 4.8.5 and
also works as before with clang 9.0.20190721.
> ---
> 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 cce4a7436052..d67418de768c 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 \
> --
> 2.26.2
>
--
Andrey Ignatov
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] efi/x86: Fix build with gcc 4
2020-06-05 16:09 ` Andrey Ignatov
@ 2020-06-15 9:43 ` Ard Biesheuvel
0 siblings, 0 replies; 10+ messages in thread
From: Ard Biesheuvel @ 2020-06-15 9:43 UTC (permalink / raw)
To: Andrey Ignatov; +Cc: Arvind Sankar, linux-efi, bpf
On Fri, 5 Jun 2020 at 18:09, Andrey Ignatov <rdna@fb.com> wrote:
>
> Arvind Sankar <nivedita@alum.mit.edu> [Fri, 2020-06-05 08:06 -0700]:
> > 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@fb.com>
> > Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
>
> Thanks. I confirmed it fixes the problem on my setup with gcc 4.8.5 and
> also works as before with clang 9.0.20190721.
>
Queued in efi/urgent, thanks.
> > ---
> > 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 cce4a7436052..d67418de768c 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 \
> > --
> > 2.26.2
> >
>
> --
> Andrey Ignatov
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2020-06-15 9:43 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20200518190716.751506-1-nivedita@alum.mit.edu>
[not found] ` <20200518190716.751506-6-nivedita@alum.mit.edu>
2020-06-05 0:31 ` [PATCH 05/24] efi/libstub: Optimize for size instead of speed Andrey Ignatov
2020-06-05 6:33 ` 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
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).