Hi Masahiro,

That warning is expected. GCC complains about this, since tf_base_xlat_table is not constant and we are asking it to be put in a read-only section (see the REGISTER_XLAT_CONTEXT_RO_BASE_TABLE macro). This is fine since:
I hope this answers your question.

Thanks
Petre

From: TF-A <tf-a-bounces@lists.trustedfirmware.org> on behalf of Masahiro Yamada via TF-A <tf-a@lists.trustedfirmware.org>
Sent: 06 March 2020 12:30
To: tf-a@lists.trustedfirmware.org <tf-a@lists.trustedfirmware.org>
Subject: [TF-A] Incorrect section attributes with ALLOW_RO_XLAT_TABLES=1
 
Hi.

If I build TF-A with ALLOW_RO_XLAT_TABLES=1,
the base xlat table goes into .rodata section
instead of .bss section.

Then, I see a warning like:

/tmp/ccswitLr.s: Assembler messages:
/tmp/ccswitLr.s:297: Warning: setting incorrect section attributes for .rodata


Is this a know issue?

[Reproduce Command]

make PLAT=fvp CROSS_COMPILE=aarch64-linux-gnu- ALLOW_RO_XLAT_TABLES=1




The full build log is below:

masahiro@pug:~/ref/trusted-firmware-a$ make PLAT=fvp
CROSS_COMPILE=aarch64-linux-gnu- ALLOW_RO_XLAT_TABLES=1
  CC      lib/libfdt/fdt.c
  CC      lib/libfdt/fdt_addresses.c
  CC      lib/libfdt/fdt_empty_tree.c
  CC      lib/libfdt/fdt_ro.c
  CC      lib/libfdt/fdt_rw.c
  CC      lib/libfdt/fdt_strerror.c
  CC      lib/libfdt/fdt_sw.c
  CC      lib/libfdt/fdt_wip.c
  AR      build/fvp/release/lib/libfdt.a
Building fvp
  CC      lib/libc/abort.c
  CC      lib/libc/assert.c
  CC      lib/libc/exit.c
  CC      lib/libc/memchr.c
  CC      lib/libc/memcmp.c
  CC      lib/libc/memcpy.c
  CC      lib/libc/memmove.c
  CC      lib/libc/memrchr.c
  CC      lib/libc/memset.c
  CC      lib/libc/printf.c
  CC      lib/libc/putchar.c
  CC      lib/libc/puts.c
  CC      lib/libc/snprintf.c
  CC      lib/libc/strchr.c
  CC      lib/libc/strcmp.c
  CC      lib/libc/strlcpy.c
  CC      lib/libc/strlen.c
  CC      lib/libc/strncmp.c
  CC      lib/libc/strnlen.c
  CC      lib/libc/strrchr.c
  AS      lib/libc/aarch64/setjmp.S
  AR      build/fvp/release/lib/libc.a
  CC      drivers/arm/smmu/smmu_v3.c
  CC      drivers/arm/sp805/sp805.c
  CC      drivers/delay_timer/delay_timer.c
  CC      drivers/io/io_semihosting.c
  CC      lib/semihosting/semihosting.c
  CC      plat/arm/board/fvp/fvp_bl1_setup.c
  CC      plat/arm/board/fvp/fvp_err.c
  CC      plat/arm/board/fvp/fvp_io_storage.c
  CC      drivers/arm/cci/cci.c
  CC      drivers/delay_timer/generic_delay_timer.c
  CC      drivers/cfi/v2m/v2m_flash.c
  CC      drivers/io/io_fip.c
  CC      drivers/io/io_memmap.c
  CC      drivers/io/io_storage.c
  CC      plat/arm/common/arm_bl1_setup.c
  CC      plat/arm/common/arm_err.c
  CC      plat/arm/common/arm_fconf_io_storage.c
  CC      plat/arm/common/fconf/arm_fconf_io.c
  CC      lib/fconf/fconf.c
  CC      lib/fconf/fconf_dyn_cfg_getter.c
  CC      plat/arm/common/arm_dyn_cfg.c
  CC      plat/arm/common/arm_dyn_cfg_helpers.c
  CC      common/fdt_wrappers.c
  CC      bl1/bl1_main.c
  CC      bl1/aarch64/bl1_arch_setup.c
  CC      bl1/aarch64/bl1_context_mgmt.c
  CC      lib/cpus/errata_report.c
  CC      lib/el3_runtime/aarch64/context_mgmt.c
  CC      plat/common/plat_bl1_common.c
  CC      common/bl_common.c
  CC      common/tf_log.c
  CC      drivers/console/multi_console.c
  CC      plat/common/plat_bl_common.c
  CC      plat/common/plat_log_common.c
  CC      plat/common/aarch64/plat_common.c
  CC      lib/compiler-rt/builtins/popcountdi2.c
  CC      lib/compiler-rt/builtins/popcountsi2.c
  CC      plat/arm/board/fvp/fvp_common.c
  CC      plat/arm/common/arm_common.c
  CC      plat/arm/common/arm_console.c
  CC      lib/xlat_tables_v2/aarch64/xlat_tables_arch.c
  CC      lib/xlat_tables_v2/xlat_tables_context.c
  CC      lib/xlat_tables_v2/xlat_tables_core.c
  CC      lib/xlat_tables_v2/xlat_tables_utils.c
  AS      lib/semihosting/aarch64/semihosting_call.S
  AS      plat/arm/board/fvp/aarch64/fvp_helpers.S
  AS      lib/cpus/aarch64/aem_generic.S
  AS      lib/cpus/aarch64/cortex_a35.S
  AS      lib/cpus/aarch64/cortex_a53.S
  AS      lib/cpus/aarch64/cortex_a57.S
  AS      lib/cpus/aarch64/cortex_a72.S
  AS      lib/cpus/aarch64/cortex_a73.S
  AS      bl1/aarch64/bl1_entrypoint.S
  AS      bl1/aarch64/bl1_exceptions.S
  AS      lib/cpus/aarch64/cpu_helpers.S
  AS      plat/common/aarch64/platform_up_stack.S
  AS      lib/cpus/aarch64/dsu_helpers.S
  AS      lib/el3_runtime/aarch64/context.S
  AS      common/aarch64/debug.S
  AS      lib/aarch64/cache_helpers.S
  AS      lib/aarch64/misc_helpers.S
  AS      plat/common/aarch64/platform_helpers.S
  AS      drivers/arm/pl011/aarch64/pl011_console.S
  AS      plat/arm/board/common/aarch64/board_arm_helpers.S
  AS      plat/arm/common/aarch64/arm_helpers.S
  AS      lib/xlat_tables_v2/aarch64/enable_mmu.S
  PP      bl1/bl1.ld.S
  LD      build/fvp/release/bl1/bl1.elf
  BIN     build/fvp/release/bl1.bin

Built build/fvp/release/bl1.bin successfully

  OD      build/fvp/release/bl1/bl1.dump
  CC      drivers/arm/sp805/sp805.c
  CC      drivers/io/io_semihosting.c
  CC      lib/utils/mem_region.c
  CC      lib/semihosting/semihosting.c
  CC      plat/arm/board/fvp/fvp_bl2_setup.c
  CC      plat/arm/board/fvp/fvp_err.c
  CC      plat/arm/board/fvp/fvp_io_storage.c
  CC      plat/arm/common/arm_nor_psci_mem_protect.c
  CC      drivers/arm/tzc/tzc400.c
  CC      plat/arm/board/fvp/fvp_security.c
  CC      plat/arm/common/arm_tzc400.c
  CC      drivers/cfi/v2m/v2m_flash.c
  CC      drivers/delay_timer/delay_timer.c
  CC      drivers/delay_timer/generic_delay_timer.c
  CC      drivers/io/io_fip.c
  CC      drivers/io/io_memmap.c
  CC      drivers/io/io_storage.c
  CC      plat/arm/common/arm_bl2_setup.c
  CC      plat/arm/common/arm_err.c
  CC      plat/arm/common/arm_fconf_io_storage.c
  CC      plat/arm/common/fconf/arm_fconf_io.c
  CC      lib/fconf/fconf.c
  CC      lib/fconf/fconf_dyn_cfg_getter.c
  CC      plat/arm/common/arm_dyn_cfg.c
  CC      plat/arm/common/arm_dyn_cfg_helpers.c
  CC      common/fdt_wrappers.c
  CC      plat/arm/common/aarch64/arm_bl2_mem_params_desc.c
  CC      plat/arm/common/arm_image_load.c
  CC      common/desc_image_load.c
  CC      bl2/bl2_image_load_v2.c
  CC      bl2/bl2_main.c
  CC      bl2/aarch64/bl2_arch_setup.c
  CC      common/bl_common.c
  CC      common/tf_log.c
  CC      drivers/console/multi_console.c
  CC      plat/common/plat_bl_common.c
  CC      plat/common/plat_log_common.c
  CC      plat/common/aarch64/plat_common.c
  CC      lib/compiler-rt/builtins/popcountdi2.c
  CC      lib/compiler-rt/builtins/popcountsi2.c
  CC      plat/arm/board/fvp/fvp_common.c
  CC      plat/arm/common/arm_common.c
  CC      plat/arm/common/arm_console.c
  CC      lib/xlat_tables_v2/aarch64/xlat_tables_arch.c
  CC      lib/xlat_tables_v2/xlat_tables_context.c
  CC      lib/xlat_tables_v2/xlat_tables_core.c
  CC      lib/xlat_tables_v2/xlat_tables_utils.c
  AS      lib/semihosting/aarch64/semihosting_call.S
  AS      lib/locks/exclusive/aarch64/spinlock.S
  AS      plat/common/aarch64/platform_up_stack.S
  AS      common/aarch64/early_exceptions.S
  AS      bl2/aarch64/bl2_entrypoint.S
  AS      common/aarch64/debug.S
  AS      lib/aarch64/cache_helpers.S
  AS      lib/aarch64/misc_helpers.S
  AS      plat/common/aarch64/platform_helpers.S
  AS      drivers/arm/pl011/aarch64/pl011_console.S
  AS      plat/arm/board/common/aarch64/board_arm_helpers.S
  AS      plat/arm/common/aarch64/arm_helpers.S
  AS      lib/xlat_tables_v2/aarch64/enable_mmu.S
  PP      bl2/bl2.ld.S
  LD      build/fvp/release/bl2/bl2.elf
  BIN     build/fvp/release/bl2.bin

Built build/fvp/release/bl2.bin successfully

  OD      build/fvp/release/bl2/bl2.dump
  CC      drivers/arm/fvp/fvp_pwrc.c
  CC      drivers/arm/smmu/smmu_v3.c
  CC      drivers/delay_timer/delay_timer.c
  CC      drivers/cfi/v2m/v2m_flash.c
  CC      lib/utils/mem_region.c
  CC      plat/arm/board/fvp/fvp_bl31_setup.c
  CC      plat/arm/board/fvp/fvp_pm.c
  CC      plat/arm/board/fvp/fvp_topology.c
  CC      plat/arm/common/arm_nor_psci_mem_protect.c
  CC      drivers/arm/gic/common/gic_common.c
  CC      drivers/arm/gic/v3/gicv3_main.c
  CC      drivers/arm/gic/v3/gicv3_helpers.c
  CC      plat/common/plat_gicv3.c
  CC      plat/arm/common/arm_gicv3.c
  CC      drivers/arm/gic/v3/gic500.c
  CC      drivers/arm/cci/cci.c
  CC      drivers/arm/tzc/tzc400.c
  CC      plat/arm/board/fvp/fvp_security.c
  CC      plat/arm/common/arm_tzc400.c
  CC      drivers/delay_timer/generic_delay_timer.c
  CC      lib/cpus/aarch64/cpuamu.c
  CC      plat/arm/common/arm_bl31_setup.c
  CC      plat/arm/common/arm_pm.c
  CC      plat/arm/common/arm_topology.c
  CC      plat/common/plat_psci_common.c
  CC      plat/arm/common/aarch64/execution_state_switch.c
  CC      plat/arm/common/arm_sip_svc.c
  CC      lib/pmf/pmf_smc.c
  CC      bl31/bl31_main.c
  CC      bl31/interrupt_mgmt.c
  CC      bl31/bl31_context_mgmt.c
  CC      common/runtime_svc.c
  CC      services/arm_arch_svc/arm_arch_svc_setup.c
  CC      services/std_svc/std_svc_setup.c
  CC      lib/el3_runtime/cpu_data_array.c
  CC      lib/el3_runtime/aarch64/context_mgmt.c
  CC      lib/cpus/errata_report.c
  CC      lib/psci/psci_off.c
  CC      lib/psci/psci_on.c
  CC      lib/psci/psci_suspend.c
  CC      lib/psci/psci_common.c
  CC      lib/psci/psci_main.c
  CC      lib/psci/psci_setup.c
  CC      lib/psci/psci_system_off.c
  CC      lib/psci/psci_mem_protect.c
  CC      lib/locks/bakery/bakery_lock_coherent.c
  CC      lib/psci/psci_stat.c
  CC      lib/pmf/pmf_main.c
  CC      lib/extensions/spe/spe.c
  CC      lib/extensions/amu/aarch64/amu.c
  CC      lib/extensions/sve/sve.c
  CC      common/bl_common.c
  CC      common/tf_log.c
  CC      drivers/console/multi_console.c
  CC      plat/common/plat_bl_common.c
  CC      plat/common/plat_log_common.c
  CC      plat/common/aarch64/plat_common.c
  CC      lib/compiler-rt/builtins/popcountdi2.c
  CC      lib/compiler-rt/builtins/popcountsi2.c
  CC      plat/arm/board/fvp/fvp_common.c
  CC      plat/arm/common/arm_common.c
  CC      plat/arm/common/arm_console.c
  CC      lib/xlat_tables_v2/aarch64/xlat_tables_arch.c
  CC      lib/xlat_tables_v2/xlat_tables_context.c
/tmp/ccswitLr.s: Assembler messages:
/tmp/ccswitLr.s:297: Warning: setting incorrect section attributes for .rodata
  CC      lib/xlat_tables_v2/xlat_tables_core.c
  CC      lib/xlat_tables_v2/xlat_tables_utils.c
  AS      plat/arm/board/fvp/aarch64/fvp_helpers.S
  AS      lib/cpus/aarch64/aem_generic.S
  AS      lib/cpus/aarch64/cortex_a35.S
  AS      lib/cpus/aarch64/cortex_a53.S
  AS      lib/cpus/aarch64/cortex_a57.S
  AS      lib/cpus/aarch64/cortex_a72.S
  AS      lib/cpus/aarch64/cortex_a73.S
  AS      lib/cpus/aarch64/cpuamu_helpers.S
  AS      bl31/aarch64/bl31_entrypoint.S
  AS      bl31/aarch64/crash_reporting.S
  AS      bl31/aarch64/ea_delegate.S
  AS      bl31/aarch64/runtime_exceptions.S
  AS      lib/cpus/aarch64/dsu_helpers.S
  AS      plat/common/aarch64/platform_mp_stack.S
  AS      lib/el3_runtime/aarch64/cpu_data.S
  AS      lib/cpus/aarch64/cpu_helpers.S
  AS      lib/locks/exclusive/aarch64/spinlock.S
  AS      lib/psci/aarch64/psci_helpers.S
  AS      lib/el3_runtime/aarch64/context.S
  AS      lib/extensions/amu/aarch64/amu_helpers.S
  AS      lib/cpus/aarch64/wa_cve_2017_5715_bpiall.S
  AS      lib/cpus/aarch64/wa_cve_2017_5715_mmu.S
  AS      common/aarch64/debug.S
  AS      lib/aarch64/cache_helpers.S
  AS      lib/aarch64/misc_helpers.S
  AS      plat/common/aarch64/platform_helpers.S
  AS      drivers/arm/pl011/aarch64/pl011_console.S
  AS      plat/arm/board/common/aarch64/board_arm_helpers.S
  AS      plat/arm/common/aarch64/arm_helpers.S
  AS      lib/xlat_tables_v2/aarch64/enable_mmu.S
  PP      bl31/bl31.ld.S
  LD      build/fvp/release/bl31/bl31.elf
  BIN     build/fvp/release/bl31.bin

Built build/fvp/release/bl31.bin successfully

  OD      build/fvp/release/bl31/bl31.dump
  CC      plat/arm/board/fvp/fvp_bl2u_setup.c
  CC      drivers/arm/tzc/tzc400.c
  CC      plat/arm/board/fvp/fvp_security.c
  CC      plat/arm/common/arm_tzc400.c
  CC      drivers/delay_timer/delay_timer.c
  CC      drivers/delay_timer/generic_delay_timer.c
  CC      plat/arm/common/arm_bl2u_setup.c
  CC      bl2u/bl2u_main.c
  CC      common/bl_common.c
  CC      common/tf_log.c
  CC      drivers/console/multi_console.c
  CC      plat/common/plat_bl_common.c
  CC      plat/common/plat_log_common.c
  CC      plat/common/aarch64/plat_common.c
  CC      lib/compiler-rt/builtins/popcountdi2.c
  CC      lib/compiler-rt/builtins/popcountsi2.c
  CC      plat/arm/board/fvp/fvp_common.c
  CC      plat/arm/common/arm_common.c
  CC      plat/arm/common/arm_console.c
  CC      lib/xlat_tables_v2/aarch64/xlat_tables_arch.c
  CC      lib/xlat_tables_v2/xlat_tables_context.c
  CC      lib/xlat_tables_v2/xlat_tables_core.c
  CC      lib/xlat_tables_v2/xlat_tables_utils.c
  AS      bl2u/aarch64/bl2u_entrypoint.S
  AS      plat/common/aarch64/platform_up_stack.S
  AS      common/aarch64/early_exceptions.S
  AS      common/aarch64/debug.S
  AS      lib/aarch64/cache_helpers.S
  AS      lib/aarch64/misc_helpers.S
  AS      plat/common/aarch64/platform_helpers.S
  AS      drivers/arm/pl011/aarch64/pl011_console.S
  AS      plat/arm/board/common/aarch64/board_arm_helpers.S
  AS      plat/arm/common/aarch64/arm_helpers.S
  AS      lib/xlat_tables_v2/aarch64/enable_mmu.S
  PP      bl2u/bl2u.ld.S
  LD      build/fvp/release/bl2u/bl2u.elf
  BIN     build/fvp/release/bl2u.bin

Built build/fvp/release/bl2u.bin successfully

  OD      build/fvp/release/bl2u/bl2u.dump
  CPP     plat/arm/board/fvp/fdts/fvp_fw_config.dts
  DTC     plat/arm/board/fvp/fdts/fvp_fw_config.dts
  CPP     plat/arm/board/fvp/fdts/fvp_soc_fw_config.dts
  DTC     plat/arm/board/fvp/fdts/fvp_soc_fw_config.dts
  CPP     plat/arm/board/fvp/fdts/fvp_nt_fw_config.dts
  DTC     plat/arm/board/fvp/fdts/fvp_nt_fw_config.dts
  CPP     fdts/fvp-base-gicv3-psci.dts
  DTC     fdts/fvp-base-gicv3-psci.dts
./build/fvp/release/fdts/fvp-base-gicv3-psci.pre.dts:215.20-220.5:
Warning (simple_bus_reg): /smb@0,0/motherboard/flash@0,00000000:
simple-bus unit address format error, expected "0"
./build/fvp/release/fdts/fvp-base-gicv3-psci.pre.dts:221.19-224.5:
Warning (simple_bus_reg): /smb@0,0/motherboard/vram@2,00000000:
simple-bus unit address format error, expected "200000000"
./build/fvp/release/fdts/fvp-base-gicv3-psci.pre.dts:225.23-229.5:
Warning (simple_bus_reg): /smb@0,0/motherboard/ethernet@2,02000000:
simple-bus unit address format error, expected "202000000"
./build/fvp/release/fdts/fvp-base-gicv3-psci.pre.dts:230.26-235.5:
Warning (simple_bus_reg): /smb@0,0/motherboard/clk24mhz: missing or
empty reg/ranges property
./build/fvp/release/fdts/fvp-base-gicv3-psci.pre.dts:236.30-241.5:
Warning (simple_bus_reg): /smb@0,0/motherboard/refclk1mhz: missing or
empty reg/ranges property
./build/fvp/release/fdts/fvp-base-gicv3-psci.pre.dts:242.32-247.5:
Warning (simple_bus_reg): /smb@0,0/motherboard/refclk32khz: missing or
empty reg/ranges property
./build/fvp/release/fdts/fvp-base-gicv3-psci.pre.dts:248.21-370.5:
Warning (simple_bus_reg): /smb@0,0/motherboard/iofpga@3,00000000:
simple-bus unit address format error, expected "300000000"
./build/fvp/release/fdts/fvp-base-gicv3-psci.pre.dts:371.33-377.5:
Warning (simple_bus_reg): /smb@0,0/motherboard/fixedregulator: missing
or empty reg/ranges property
./build/fvp/release/fdts/fvp-base-gicv3-psci.pre.dts:381.21-387.6:
Warning (simple_bus_reg): /smb@0,0/motherboard/mcc/osc: missing or
empty reg/ranges property
./build/fvp/release/fdts/fvp-base-gicv3-psci.pre.dts:388.12-391.6:
Warning (simple_bus_reg): /smb@0,0/motherboard/mcc/muxfpga: missing or
empty reg/ranges property
./build/fvp/release/fdts/fvp-base-gicv3-psci.pre.dts:392.12-395.6:
Warning (simple_bus_reg): /smb@0,0/motherboard/mcc/dvimode: missing or
empty reg/ranges property



--
Best Regards
Masahiro Yamada
--
TF-A mailing list
TF-A@lists.trustedfirmware.org
https://lists.trustedfirmware.org/mailman/listinfo/tf-a
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.