0001-fix-build-allow-lower-address-access-with-gcc-12.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From 078cbf942c86d77775a26d83fc87ca244de02d4c Mon Sep 17 00:00:00 2001
  2. From: Govindraj Raja <govindraj.raja@arm.com>
  3. Date: Fri, 5 May 2023 09:09:36 -0500
  4. Subject: [PATCH] fix(build): allow lower address access with gcc-12
  5. With gcc-12 any lower address access can trigger a warning/error
  6. this would be useful in other parts of system but in TF-A
  7. there are various reasons to access to the lower address ranges,
  8. example using mmio_read_*/writes_*
  9. So setup to allow access to lower addresses while using gcc-12
  10. Change-Id: Id1b4012b13bc6876d83b90a347fee12478a1921d
  11. Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
  12. Upstream: https://github.com/ARM-software/arm-trusted-firmware/commit/dea23e245fb890c6c06eff7d1aed8fffa981fc05
  13. Signed-off-by: Julien Olivain <ju.o@free.fr>
  14. ---
  15. Makefile | 4 ++++
  16. make_helpers/build_macros.mk | 12 ++++++++++++
  17. 2 files changed, 16 insertions(+)
  18. diff --git a/Makefile b/Makefile
  19. index dccf0121d..edd7f5886 100644
  20. --- a/Makefile
  21. +++ b/Makefile
  22. @@ -385,6 +385,10 @@ ifeq ($(findstring clang,$(notdir $(CC))),)
  23. WARNINGS += -Wunused-but-set-variable -Wmaybe-uninitialized \
  24. -Wpacked-bitfield-compat -Wshift-overflow=2 \
  25. -Wlogical-op
  26. +
  27. +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523
  28. +TF_CFLAGS += $(call cc_option, --param=min-pagesize=0)
  29. +
  30. else
  31. # using clang
  32. WARNINGS += -Wshift-overflow -Wshift-sign-overflow \
  33. diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk
  34. index 12aaee684..3a54bf67c 100644
  35. --- a/make_helpers/build_macros.mk
  36. +++ b/make_helpers/build_macros.mk
  37. @@ -86,6 +86,18 @@ define assert_numerics
  38. $(foreach num,$1,$(eval $(call assert_numeric,$(num))))
  39. endef
  40. +# Convenience function to check for a given linker option. An call to
  41. +# $(call ld_option, --no-XYZ) will return --no-XYZ if supported by the linker
  42. +define ld_option
  43. + $(shell if $(LD) $(1) -v >/dev/null 2>&1; then echo $(1); fi )
  44. +endef
  45. +
  46. +# Convenience function to check for a given compiler option. A call to
  47. +# $(call cc_option, --no-XYZ) will return --no-XYZ if supported by the compiler
  48. +define cc_option
  49. + $(shell if $(CC) $(1) -c -x c /dev/null -o /dev/null >/dev/null 2>&1; then echo $(1); fi )
  50. +endef
  51. +
  52. # CREATE_SEQ is a recursive function to create sequence of numbers from 1 to
  53. # $(2) and assign the sequence to $(1)
  54. define CREATE_SEQ
  55. --
  56. 2.41.0