Skip to content

linker_script: Remove all SUBALIGN usage for iterable sections still incomplete #92349

@nandojve

Description

@nandojve

Describe the bug

After migrate to v4.2.0-RC1 I found the below error when building an application.

-- Found assembler: /home/gfbudke/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
CMake Warning at /home/gfbudke/workspace/freedom/deps/zephyr/cmake/modules/extensions.cmake:5187 (message):
  zephyr_linker_section(NAME ...) given unknown arguments: SUBALIGN 1
Call Stack (most recent call first):
  /home/gfbudke/workspace/freedom/deps/zephyr/cmake/modules/extensions.cmake:5323 (zephyr_linker_section)
  /home/gfbudke/workspace/freedom/deps/zephyr/cmake/linker_script/common/common-ram.cmake:121 (zephyr_iterable_section)
  /home/gfbudke/workspace/freedom/deps/zephyr/cmake/linker_script/arm/linker.cmake:174 (include)
  /home/gfbudke/workspace/freedom/deps/zephyr/CMakeLists.txt:132 (include)


-- Found gen_kobject_list: /home/gfbudke/workspace/freedom/deps/zephyr/scripts/build/gen_kobject_list.py

The warning message was impossible complete to allow identify the problem. After that I added the below patch

diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake
index 8432b3a0a26..a9203b48d23 100644
--- a/cmake/modules/extensions.cmake
+++ b/cmake/modules/extensions.cmake
@@ -5184,7 +5184,7 @@ function(zephyr_linker_section)
   cmake_parse_arguments(SECTION "${options}" "${single_args}" "${multi_args}" ${ARGN})
 
   if(SECTION_UNPARSED_ARGUMENTS)
-    message(WARNING "zephyr_linker_section(${ARGV0} ...) given unknown "
+    message(WARNING "zephyr_linker_section(${ARGV0} ${ARGV1} ${ARGV2} ...) given unknown "
                     "arguments: ${SECTION_UNPARSED_ARGUMENTS}"
     )
   endif()

then the message was clear about the offender.

-- Found assembler: /home/gfbudke/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
CMake Warning at /home/gfbudke/workspace/freedom/deps/zephyr/cmake/modules/extensions.cmake:5187 (message):
  zephyr_linker_section(NAME zbus_channel_observation_mask_area GROUP ...)
  given unknown arguments: SUBALIGN 1
Call Stack (most recent call first):
  /home/gfbudke/workspace/freedom/deps/zephyr/cmake/modules/extensions.cmake:5323 (zephyr_linker_section)
  /home/gfbudke/workspace/freedom/deps/zephyr/cmake/linker_script/common/common-ram.cmake:121 (zephyr_iterable_section)
  /home/gfbudke/workspace/freedom/deps/zephyr/cmake/linker_script/arm/linker.cmake:174 (include)
  /home/gfbudke/workspace/freedom/deps/zephyr/CMakeLists.txt:132 (include)


-- Found gen_kobject_list: /home/gfbudke/workspace/freedom/deps/zephyr/scripts/build/gen_kobject_list.py

Looking on the recente change I found the #91219 which, unfortunately, did not removed all the entries, like below with SUBALIGN 1

if(CONFIG_USB_DEVICE_STACK)
zephyr_linker_section(NAME usb_descriptor GROUP ${K_OBJECTS_GROUP} NOINPUT ${XIP_ALIGN_WITH_INPUT} SUBALIGN 1)
zephyr_linker_section_configure(SECTION usb_descriptor
KEEP SORT NAME INPUT ".usb.descriptor*"
)
zephyr_iterable_section(NAME usb_cfg_data GROUP ${K_OBJECTS_GROUP} ${XIP_ALIGN_WITH_INPUT})
endif()
if(CONFIG_USB_DEVICE_BOS)
zephyr_linker_section(NAME usb_bos_desc GROUP ${K_OBJECTS_GROUP} NOINPUT ${XIP_ALIGN_WITH_INPUT} SUBALIGN 1)
zephyr_linker_section_configure(SECTION usb_data
KEEP SORT NAME INPUT ".usb.bos_desc"
)
endif()
if(CONFIG_RTIO)
zephyr_iterable_section(NAME rtio GROUP ${K_OBJECTS_GROUP} ${XIP_ALIGN_WITH_INPUT})
zephyr_iterable_section(NAME rtio_iodev GROUP ${K_OBJECTS_GROUP} ${XIP_ALIGN_WITH_INPUT})
zephyr_iterable_section(NAME rtio_sqe_pool GROUP ${K_OBJECTS_GROUP} ${XIP_ALIGN_WITH_INPUT})
zephyr_iterable_section(NAME rtio_cqe_pool GROUP ${K_OBJECTS_GROUP} ${XIP_ALIGN_WITH_INPUT})
endif()
if(CONFIG_SENSING)
zephyr_iterable_section(NAME sensing_sensor GROUP ${K_OBJECTS_GROUP} ${XIP_ALIGN_WITH_INPUT})
endif()
if(CONFIG_ZBUS)
zephyr_iterable_section(NAME zbus_channel_observation_mask GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT} SUBALIGN 1)
endif()

Regression

  • This is a regression.

Steps to reproduce

No response

Relevant log output

Impact

Not sure

Environment

Zephyr v4.2.0-RC1
Linux
SDK 0.17

Additional Context

No response

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions