diff --git a/Makefile b/Makefile index 8e90a753b..2dc2956c9 100644 --- a/Makefile +++ b/Makefile @@ -354,6 +354,7 @@ ifneq ($(findstring armlink,$(notdir $(LD))),) # LD = gcc (used when GCC LTO is enabled) else ifneq ($(findstring gcc,$(notdir $(LD))),) # Pass ld options with Wl or Xlinker switches + TF_LDFLAGS += $(call ld_option,-Xlinker --no-warn-rwx-segments) TF_LDFLAGS += -Wl,--fatal-warnings -O1 TF_LDFLAGS += -Wl,--gc-sections diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk index a0d71c51b..2d2f14116 100644 --- a/make_helpers/build_macros.mk +++ b/make_helpers/build_macros.mk @@ -101,9 +101,7 @@ endef # Convenience function to check for a given linker option. An call to # $(call ld_option, --no-XYZ) will return --no-XYZ if supported by the linker -define ld_option - $(shell if $(LD) $(1) -v >/dev/null 2>&1; then echo $(1); fi ) -endef +ld_option = $(shell $(LD) $(1) -Wl,--version >/dev/null 2>&1 || $(LD) $(1) -v >/dev/null 2>&1 && echo $(1)) # Convenience function to check for a given compiler option. A call to # $(call cc_option, --no-XYZ) will return --no-XYZ if supported by the compiler