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

Bin Meng bmeng.cn at gmail.com
Wed May 3 04:27:30 CEST 2023


Hi Simon,

On Sun, Apr 30, 2023 at 9:30 AM Simon Glass <sjg at chromium.org> wrote:
>
> The MSYS2 compiler does not support some of these options. Drop them to
> avoid build errors.

I think the commit message is better reworded to something like:

Test some linker options as some toolchains like MSYS2 do not support them.

>
> 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) \
> --

Otherwise,
Reviewed-by: Bin Meng <bmeng at tinylab.org>


More information about the U-Boot mailing list