Skip to contentSkip to conversation

efi/libstub: Fix build error with libstub

PATCH In review Zhenzhong Duan 3 participants 4 messages Jun 10, 2020 EFI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi/libstub: Fix build error with libstub

Got below error during build:

In file included from drivers/firmware/efi/libstub/efi-stub-helper.c:16:0:
drivers/firmware/efi/libstub/efi-stub-helper.c: In function ‘efi_char16_puts’:
arch/x86/include/asm/efi.h:355:3: sorry, unimplemented: ms_abi attribute requires -maccumulate-outgoing-args or subtarget optimization implying it

     : __efi64_thunk_map(inst, func, inst, ##__VA_ARGS__))
     ^
  drivers/firmware/efi/libstub/efi-stub-helper.c:37:2: note: in expansion of macro ‘efi_call_proto’
    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

Fix it by adding -maccumulate-outgoing-args for efi libstub build as suggested by gcc.

---
 drivers/firmware/efi/libstub/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/libstub/Makefile +1 -1
index cce4a74..25e5d02 100644
@@ -6,7 +6,7 @@
 # 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 -maccumulate-outgoing-args
 cflags-$(CONFIG_X86)		+= -m$(BITS) -D__KERNEL__ \
 				   -fPIC -fno-strict-aliasing -mno-red-zone \
 				   -mno-mmx -mno-sse -fshort-wchar \
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 25 lines · Zhenzhong Duan

Got below error during build:

In file included from drivers/firmware/efi/libstub/efi-stub-helper.c:16:0:
drivers/firmware/efi/libstub/efi-stub-helper.c: In function ‘efi_char16_puts’:
arch/x86/include/asm/efi.h:355:3: sorry, unimplemented: ms_abi attribute requires -maccumulate-outgoing-args or subtarget optimization implying it

     : __efi64_thunk_map(inst, func, inst, ##__VA_ARGS__))
     ^
  drivers/firmware/efi/libstub/efi-stub-helper.c:37:2: note: in expansion of macro ‘efi_call_proto’
    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

Fix it by adding -maccumulate-outgoing-args for efi libstub build as suggested by gcc.

---
 drivers/firmware/efi/libstub/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/libstub/Makefile +0 -0
index cce4a74..25e5d02 100644

drivers/firmware/efi/libstub/Makefile line 9

Quoted 5 lines
drivers/firmware/efi/libstub/Makefile +1 -1
@@ -6,7 +6,7 @@
 # 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 -maccumulate-outgoing-args

This will need a cc-option call if this patch is necessary because clang does not support this flag.

clang-11: error: unknown argument: '-maccumulate-outgoing-args'

Quoted 6 lines
drivers/firmware/efi/libstub/Makefile +0 -0
 cflags-$(CONFIG_X86)		+= -m$(BITS) -D__KERNEL__ \
 				   -fPIC -fno-strict-aliasing -mno-red-zone \
 				   -mno-mmx -mno-sse -fshort-wchar \
Signature · 1 line
1.8.3.1

Cheers,
Nathan

maintainer
#2 lore raw
Quoted 36 lines · Nathan Chancellor
Quoted 25 lines · Zhenzhong Duan

Got below error during build:

In file included from drivers/firmware/efi/libstub/efi-stub-helper.c:16:0:
drivers/firmware/efi/libstub/efi-stub-helper.c: In function ‘efi_char16_puts’:
arch/x86/include/asm/efi.h:355:3: sorry, unimplemented: ms_abi attribute requires -maccumulate-outgoing-args or subtarget optimization implying it

     : __efi64_thunk_map(inst, func, inst, ##__VA_ARGS__))
     ^
  drivers/firmware/efi/libstub/efi-stub-helper.c:37:2: note: in expansion of macro ‘efi_call_proto’
    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

Fix it by adding -maccumulate-outgoing-args for efi libstub build as suggested by gcc.

---
 drivers/firmware/efi/libstub/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/libstub/Makefile +0 -0
index cce4a74..25e5d02 100644

drivers/firmware/efi/libstub/Makefile line 9

Quoted 5 lines
drivers/firmware/efi/libstub/Makefile +1 -1
@@ -6,7 +6,7 @@
 # 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 -maccumulate-outgoing-args

This will need a cc-option call if this patch is necessary because clang does not support this flag.

Quoted 2 lines

clang-11: error: unknown argument: '-maccumulate-outgoing-args'

A fix was already sent for this

https://lore.kernel.org/bpf/[email protected]/

which does the right thing here.

Quoted 9 lines
Quoted 6 lines
drivers/firmware/efi/libstub/Makefile +0 -1
 cflags-$(CONFIG_X86)         += -m$(BITS) -D__KERNEL__ \
                                 -fPIC -fno-strict-aliasing -mno-red-zone \
                                 -mno-mmx -mno-sse -fshort-wchar \
--

1.8.3.1

Cheers,
Nathan

#3 lore raw
Quoted 6 lines · Ard Biesheuvel
Quoted 3 lines · Nathan Chancellor
Quoted 1 line · Zhenzhong Duan

Got below error during build:

...

Quoted 14 lines
Quoted 14 lines

drivers/firmware/efi/libstub/Makefile line 9

Quoted 10 lines
drivers/firmware/efi/libstub/Makefile +1 -1
index cce4a74..25e5d02 100644
@@ -6,7 +6,7 @@
 # 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 -maccumulate-outgoing-args

This will need a cc-option call if this patch is necessary because clang does not support this flag.

Quoted 8 lines
Quoted 2 lines

clang-11: error: unknown argument: '-maccumulate-outgoing-args'

A fix was already sent for this

https://lore.kernel.org/bpf/[email protected]/

which does the right thing here.

Ah, so I'm late again. Not clear if there is easy way to check queued patches for upstream..

Regards
Zhenzhong