Skip to contentSkip to conversation

efi_loader: fix build error for freestanding.o

PATCH New Heinrich Schuchardt 3 participants 3 messages Mar 14, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 efi_loader: fix build error for freestanding.o

Since commit f51a226436a87 ("efi_loader: provide freestanding library") in parallel builds errors

lib/efi_selftest/../efi_loader/efi_freestanding.o:
file not recognized: File truncated

occur. Obviously make cannot correctly sequence parallel builds with a dependency like ../efi_loader/efi_freestanding.o.

Fixes f51a226436a87 ("efi_loader: provide freestanding library")

---
v2
use #include instead of symbolic link as suggested by Andy

---
 lib/efi_selftest/efi_freestanding.c | 11 +++++++++++
 scripts/Makefile.lib                |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 lib/efi_selftest/efi_freestanding.c
lib/efi_selftest/efi_freestanding.c new file +11 -0
new file mode 100644
index 00000000000..4b6c27e99fb
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Library for freestanding binary
+ *
+ * Copyright 2019, Heinrich Schuchardt <[email protected]>
+ *
+ * GCC requires that freestanding programs provide memcpy(), memmove(),
+ * memset(), and memcmp().
+ */
+
+#include "../efi_loader/efi_freestanding.c"
scripts/Makefile.lib +1 -1
index ec5c41ec561..70de9bb13a6 100644
@@ -390,7 +390,7 @@ $(obj)/efi_reloc.o: $(srctree)/arch/$(ARCH)/lib/$(EFI_RELOC:.o=.c) $(recordmcoun
 	$(call cmd,force_checksrc)
 	$(call if_changed_rule,cc_o_c)
 
-$(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/../efi_loader/efi_freestanding.o
+$(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o
 	$(call cmd,efi_ld)
 
 # ACPI
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 1/1 efi_loader: fix build error for freestanding.o

Quoted 11 lines · Heinrich Schuchardt

Since commit f51a226436a87 ("efi_loader: provide freestanding library") in parallel builds errors

lib/efi_selftest/../efi_loader/efi_freestanding.o:
file not recognized: File truncated

occur. Obviously make cannot correctly sequence parallel builds with a dependency like ../efi_loader/efi_freestanding.o.

Fixes f51a226436a87 ("efi_loader: provide freestanding library")

Looking around, using #include is the way we've solved this kind of problem elsewhere too, so:

And please put together a PR soon, I've hit this problem a few times locally today :) Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190314/62d9d906/attachment.sig>
#2 lore raw

PATCH v2 1/1 efi_loader: fix build error for freestanding.o

In reply to Heinrich Schuchardt
Quoted 9 lines · Heinrich Schuchardt

Since commit f51a226436a87 ("efi_loader: provide freestanding library") in parallel builds errors

lib/efi_selftest/../efi_loader/efi_freestanding.o:
file not recognized: File truncated

occur. Obviously make cannot correctly sequence parallel builds with a dependency like ../efi_loader/efi_freestanding.o.

Quoted 44 lines
Fixes f51a226436a87 ("efi_loader: provide freestanding library")

---
v2
use #include instead of symbolic link as suggested by Andy

---
 lib/efi_selftest/efi_freestanding.c | 11 +++++++++++
 scripts/Makefile.lib                |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 lib/efi_selftest/efi_freestanding.c
lib/efi_selftest/efi_freestanding.c new file +11 -0
new file mode 100644
index 00000000000..4b6c27e99fb
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Library for freestanding binary
+ *
+ * Copyright 2019, Heinrich Schuchardt <[email protected]>
+ *
+ * GCC requires that freestanding programs provide memcpy(), memmove(),
+ * memset(), and memcmp().
+ */
+
+#include "../efi_loader/efi_freestanding.c"
scripts/Makefile.lib +1 -1
index ec5c41ec561..70de9bb13a6 100644
@@ -390,7 +390,7 @@ $(obj)/efi_reloc.o: $(srctree)/arch/$(ARCH)/lib/$(EFI_RELOC:.o=.c) $(recordmcoun
 	$(call cmd,force_checksrc)
 	$(call if_changed_rule,cc_o_c)
 
-$(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/../efi_loader/efi_freestanding.o
+$(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o
 	$(call cmd,efi_ld)
 
 # ACPI
Signature · 1 line
2.20.1
Signature · 2 lines
With Best Regards,
Andy Shevchenko