Skip to content

arch: arm: cortex_a_r: XIP=y causes linker error #72696

@sigmundklaa

Description

@sigmundklaa

When a Cortex A/R based SoC is compiled with CONFIG_XIP=y, linking fails with the following syntax error:

/home/sigmundk/src/zephy-extra/zephyr-extra/toolchain/be-gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/9.3.1p1/../../../../arm-none-eabi/bin/ld.bfd:zephyr/linker_zephyr_pre0.cmd:175                                                                  
: syntax error
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

I am compiling for an ARM Cortex R4F, using out-of-tree SoC support for the TMS570LS1224 which is linked at the bottom of the issue. The cause seems to be the below line (from linker_zephyr_pre0.cmd:175):

bss (NOLOAD) : ALIGN_WITH_INPUT ALIGN(_region_min_align)

which is the result of:

SECTION_DATA_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD), BSS_ALIGN)

From what I can tell, combining ALIGN_WITH_INPUT and ALIGN is not supported, however I'm not sure of this. For me, replacing
SECTION_DATA_PROLOGUE with SECTION_PROLOGUE fixed the issue, but I don't know if that is the best solution.

To Reproduce
Steps to reproduce the behavior:

  1. Select a Cortex A/R based SoC
  2. Compile with `CONFIG_XIP=y
  3. See error

Expected behavior
Successful compilation

Impact
Prevents compilation

Environment (please complete the following information):

  • OS: Ubuntu 20.04
  • Toolchain Both the latest version of the Zephyr SDK, as well as the toolchain in the repository linked below was tried.
  • Commit SHA or Version used: 23a03b7

Additional context
My setup, including a patched big endian ARM GCC toolchain, is available at https://github.com/OrbitNTNU/zephyr-hw

Metadata

Metadata

Labels

area: ARMARM (32-bit) ArchitecturebugThe issue is a bug, or the PR is fixing a bugpriority: mediumMedium impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions