fix(build): allow lower address access with gcc-12
With gcc-12 any lower address access can trigger a warning/error
this would be useful in other parts of system but in TFTF
there are various reasons to access to the lower address ranges for
tests, example using mmio_read_*/writes_*
So setup to allow access to lower addresses while using gcc-12
Change-Id: I3153fd4545e79d14151249fcb5a395c9e61a771a
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk
index 80f8649..5cd8bc6 100644
--- a/make_helpers/build_macros.mk
+++ b/make_helpers/build_macros.mk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2015-2023, ARM Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -34,3 +34,10 @@
define ld_option
$(shell if $(LD) $(1) -v >/dev/null 2>&1; then echo $(1); fi )
endef
+
+# Convenience function to check for a given compiler option. An call to
+# $(call cc_option, --no-XYZ) will return --no-XYZ if supported by the compiler
+define cc_option
+ $(shell if $(CC) $(1) -c -x c /dev/null -o /dev/null >/dev/null 2>&1; then echo $(1); fi )
+endef
+