From: Marco Felsch Date: Thu, 24 Nov 2022 10:02:05 +0000 (+0100) Subject: build(makefile): add helper to detect linker options X-Git-Tag: baikal/aarch64/sdk5.10~1^2~166^2~1 X-Git-Url: https://git.baikalelectronics.ru/?a=commitdiff_plain;h=a5f09cf7052ab6abb171400d377eecb1efac1a9b;p=arm-tf.git build(makefile): add helper to detect linker options This is a small helper to check for possible linker options. If the linker supports the requested option it is returned and if not nothing will be returned, e.g.: TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments) can be called unconditional. Signed-off-by: Marco Felsch Change-Id: I236800852ece49948ff53a0b91fddba53c8f0f95 --- diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk index 4815efa74..89f43f2f3 100644 --- a/make_helpers/build_macros.mk +++ b/make_helpers/build_macros.mk @@ -87,6 +87,12 @@ define assert_numerics $(foreach num,$1,$(eval $(call assert_numeric,$(num)))) 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 + # CREATE_SEQ is a recursive function to create sequence of numbers from 1 to # $(2) and assign the sequence to $(1) define CREATE_SEQ