diff mbox series

efi_loader helloworld.efi: Fix building with -Os

Message ID 20171201210950.45101-1-agraf@suse.de
State Accepted
Commit 3bb74f9800cdc4cf10a87f2725242c2565256654
Headers show
Series efi_loader helloworld.efi: Fix building with -Os | expand

Commit Message

Alexander Graf Dec. 1, 2017, 9:09 p.m. UTC
Depending on your compiler, when compiling the hello world efi binary
with -Os, gcc might think it's a smart idea to replace common patterns
such as memory copies with explicit calls to memcpy().

While that sounds great at first, we don't have any memcpy() available
in our helloworld build target. So let's indicate to gcc that we really
do want to have the code be built as freestanding.

Fixes: bbf75dd9 ("efi_loader: output load options in helloworld")
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 lib/efi_loader/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Alexander Graf Dec. 4, 2017, 8:59 a.m. UTC | #1
> Depending on your compiler, when compiling the hello world efi binary
> with -Os, gcc might think it's a smart idea to replace common patterns
> such as memory copies with explicit calls to memcpy().
> 
> While that sounds great at first, we don't have any memcpy() available
> in our helloworld build target. So let's indicate to gcc that we really
> do want to have the code be built as freestanding.
> 
> Fixes: bbf75dd9 ("efi_loader: output load options in helloworld")
> Signed-off-by: Alexander Graf <agraf@suse.de>

Thanks, applied to efi-next

Alex
diff mbox series

Patch

diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index 83d879b686..2722265ee3 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -7,8 +7,8 @@ 
 # This file only gets included with CONFIG_EFI_LOADER set, so all
 # object inclusion implicitly depends on it
 
-CFLAGS_helloworld.o := $(CFLAGS_EFI)
-CFLAGS_REMOVE_helloworld.o := $(CFLAGS_NON_EFI)
+CFLAGS_helloworld.o := $(CFLAGS_EFI) -Os -ffreestanding
+CFLAGS_REMOVE_helloworld.o := $(CFLAGS_NON_EFI) -Os
 
 ifneq ($(CONFIG_CMD_BOOTEFI_HELLO_COMPILE),)
 always += helloworld.efi