Page MenuHomePhabricator

Compiling atf for iMX8 using gcc-12..1 fails
Open, Needs TriagePublic

Description

Compiling atf for iMX8 using gcc-12..1 fails

<<< atf:target seq 109 <<<
CLEAN      atf
    *      Removing /var/media/DATA/home-rudi/LibreELEC.kernel11/build.LibreELEC-iMX8.arm-11.0-devel/build/atf-2.4 ...
UNPACK      atf
BUILD      atf (target)
    TOOLCHAIN      manual
make[1]: Entering directory '/var/media/DATA/home-rudi/LibreELEC.kernel11/build.LibreELEC-iMX8.arm-11.0-devel/build/atf-2.6'
  CC      common/runtime_svc.c
  CC      drivers/arm/gic/v3/arm_gicv3_common.c
  CC      drivers/arm/gic/v3/gic-x00.c
  CC      drivers/arm/gic/v3/gicdv3_helpers.c
  CC      drivers/arm/gic/v3/gicrv3_helpers.c
  CC      drivers/arm/gic/v3/gicv3_helpers.c
  CC      drivers/arm/gic/v3/gicv3_main.c
  CC      drivers/arm/tzc/tzc380.c
  CC      drivers/delay_timer/delay_timer.c
  CC      drivers/delay_timer/generic_delay_timer.c
  CC      lib/cpus/errata_report.c
  CC      lib/el3_runtime/aarch64/context_mgmt.c
  CC      lib/el3_runtime/cpu_data_array.c
  CC      lib/extensions/spe/spe.c
  CC      lib/extensions/sve/sve.c
  CC      lib/locks/bakery/bakery_lock_coherent.c
  CC      lib/psci/psci_common.c
  CC      lib/psci/psci_main.c
  CC      lib/psci/psci_mem_protect.c
  CC      lib/psci/psci_off.c
  CC      lib/psci/psci_on.c
  CC      lib/psci/psci_setup.c
  CC      lib/psci/psci_suspend.c
  CC      lib/psci/psci_system_off.c
  CC      lib/xlat_tables/aarch64/xlat_tables.c
  CC      lib/xlat_tables/xlat_tables_common.c
  CC      plat/common/plat_gicv3.c
  CC      plat/common/plat_psci_common.c
  CC      plat/imx/common/imx8_topology.c
  CC      plat/imx/common/imx_sip_handler.c
  CC      plat/imx/common/imx_sip_svc.c
  CC      plat/imx/common/plat_imx8_gic.c
  CC      plat/imx/imx8m/gpc_common.c
  CC      plat/imx/imx8m/imx8m_caam.c
  CC      plat/imx/imx8m/imx8m_psci_common.c
  CC      plat/imx/imx8m/imx8mq/gpc.c
  CC      plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c
In file included from plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:20:
In function 'mmio_read_8',
    inlined from 'imx8mq_soc_info_init' at plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:68:16,
    inlined from 'bl31_platform_setup' at plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:193:2:
include/lib/mmio.h:19:16: error: array subscript 0 is outside array bounds of 'volatile uint8_t[0]' {aka 'volatile unsigned char[]'} [-Werror=array-bounds]
   19 |         return *(volatile uint8_t*)addr;
      |                ^~~~~~~~~~~~~~~~~~~~~~~~
In function 'mmio_read_8',
    inlined from 'imx8mq_soc_info_init' at plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:72:16,
    inlined from 'bl31_platform_setup' at plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:193:2:
include/lib/mmio.h:19:16: error: array subscript 0 is outside array bounds of 'volatile uint8_t[0]' {aka 'volatile unsigned char[]'} [-Werror=array-bounds]
   19 |         return *(volatile uint8_t*)addr;
      |                ^~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:1251: /var/media/DATA/home-rudi/LibreELEC.kernel11/build.LibreELEC-iMX8.arm-11.0-devel/build/atf-2.6/build/imx8mq/release/bl31/imx8mq_bl31_setup.o] Error 1
make[1]: Leaving directory '/var/media/DATA/home-rudi/LibreELEC.kernel11/build.LibreELEC-iMX8.arm-11.0-devel/build/atf-2.6'

Event Timeline

heitbaum created this task.May 7 2022, 1:22 PM

Reported bug in gcc 12.1.0

Current work around to compile with:

  • CFLAGS=+“ --param=min-pagesize=0”

A similar issue was reported in the ticket https://developer.trustedfirmware.org/T984
Can you confirm if this issue is due to a bug in the toolchain itself?

TF-A works on a 6 month release cadence and we typically update the gcc toolchain to the latest released version along with the TF-A release. gcc versions we use are downloaded from https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/downloads.
Currently we don't update the toolchain to any versions newer than the one released here. We used the version 10.3-2021.07 with TF-A v2.6 release and will be updating to version 11.2-2022.02 with our upcoming v2.7 release which is planned for the end of May, 2022.

Few follow up questions I have

  1. Are you interested in any specific compiler feature{s} available with gcc 12.x or newer that prompted the use of the newer versions than what TF-A is tested against for releases? You can reference the TF-A tested toolchain version from https://trustedfirmware-a.readthedocs.io/en/latest/getting_started/prerequisites.html
  2. Which specific toolchain do you use and where do you download it from?

Your reply will help me discuss with the team and gauge the priority in terms of updating the gcc versions more frequently than once in 6 months. Currently we think we are reasonably aligned with the latest available version w.r.t the downloads page I referenced above.

anklefine added a subscriber: anklefine.EditedJul 3 2023, 4:27 AM

TF-A maintains a release cycle of once every six months, and in most cases, we upgrade the gcc toolchain to the most recent version available in conjunction with the TF-A release.
https://developer.arm.com/tools-and-software/open-source-software/geometry dash subzero/developer-tools/gnu-toolchain/downloads

The error suggests an array bounds problem in mmio.h. Review the code around imx8mq_bl31_setup.c:68 and imx8mq_bl31_setup.c:193 to resolve the issue.
Solar Panel Installation Services in Chicago IL

Discover Your Beauty's True Potential with Nikol Beauty Cosmetics! Elevate your makeup routine with our exquisite range of products, meticulously crafted to accentuate your unique features. Unleash your confidence and radiance. Shop now and redefine beauty