[PATCH v2 21/30] Makefile: Disable unsupported compiler options with PE

Simon Glass sjg at chromium.org
Sun Apr 30 03:29:54 CEST 2023


The MSYS2 compiler does not support some of these options. Drop them to
avoid build errors.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v2:
- Use cc-option and ld-option instead

 Makefile             | 2 +-
 scripts/Makefile.lib | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 2453a80eca62..240562dff00b 100644
--- a/Makefile
+++ b/Makefile
@@ -819,7 +819,7 @@ KBUILD_CPPFLAGS += $(KCPPFLAGS)
 KBUILD_AFLAGS += $(KAFLAGS)
 KBUILD_CFLAGS += $(KCFLAGS)
 
-KBUILD_LDFLAGS  += -z noexecstack
+KBUILD_LDFLAGS  += $(call ld-option,-znoexecstack)
 KBUILD_LDFLAGS  += $(call ld-option,--no-warn-rwx-segments)
 
 KBUILD_HOSTCFLAGS += $(if $(CONFIG_TOOLS_DEBUG),-g)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 7b27224b5d44..aaae37d50a43 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -425,7 +425,10 @@ cmd_efi_objcopy = $(OBJCOPY) -j .header -j .text -j .sdata -j .data -j \
 $(obj)/%.efi: $(obj)/%_efi.so
 	$(call cmd,efi_objcopy)
 
-KBUILD_EFILDFLAGS = -nostdlib -zexecstack -znocombreloc -znorelro
+KBUILD_EFILDFLAGS := -nostdlib
+KBUILD_EFILDFLAGS += $(call ld-option,-zexecstack)
+KBUILD_EFILDFLAGS += $(call ld-option,-znocombreloc)
+KBUILD_EFILDFLAGS += $(call ld-option,-znorelro)
 KBUILD_EFILDFLAGS += $(call ld-option,--no-warn-rwx-segments)
 quiet_cmd_efi_ld = LD      $@
 cmd_efi_ld = $(LD) $(KBUILD_EFILDFLAGS) -T $(EFI_LDS_PATH) \
-- 
2.40.1.495.gc816e09b53d-goog



More information about the U-Boot mailing list