fix(build): resolve build issue for older toolchains
The patch ce37277 introduced support for new toolchain but
the LD option supplied is not recognized by older toolchains.
This patch fixes the problem by ensuring that the LD option
is supported before being added to LDFLAGS.
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
Change-Id: I97dbd096c5ade7df92e3217a6b218c2258ac001e
diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk
index 0ac1505..80f8649 100644
--- a/make_helpers/build_macros.mk
+++ b/make_helpers/build_macros.mk
@@ -28,3 +28,9 @@
$(call CREATE_SEQ,$(1),$(2))\
)
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