-
Notifications
You must be signed in to change notification settings - Fork 8.4k
zephyr: linker: Fix .noinit section names #100260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mrjimenez
wants to merge
2
commits into
zephyrproject-rtos:main
Choose a base branch
from
mrjimenez:noinit_relocation_4_main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
zephyr: linker: Fix .noinit section names #100260
mrjimenez
wants to merge
2
commits into
zephyrproject-rtos:main
from
mrjimenez:noinit_relocation_4_main
+49
−41
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
|
Possibly related #100221 |
Contributor
Author
It is the same issue, but he has a different solution. With my patch, I get this: .dsram2_noinit_reloc
0x00000000300007b0 0x4eac
0x00000000300007b0 . = ALIGN (0x4)
*net_pkt.c.obj(SORT_BY_ALIGNMENT(.noinit.WEST_TOPDIR/zephyr/subsys/net/ip/net_pkt.c.0))
.noinit.WEST_TOPDIR/zephyr/subsys/net/ip/net_pkt.c.0
0x00000000300007b0 0x508 zephyr/subsys/net/ip/libsubsys__net__ip.a(net_pkt.c.obj)
*net_pkt.c.obj(SORT_BY_ALIGNMENT(.noinit.WEST_TOPDIR/zephyr/subsys/net/ip/net_pkt.c.1))
.noinit.WEST_TOPDIR/zephyr/subsys/net/ip/net_pkt.c.1
0x0000000030000cb8 0x1700 zephyr/subsys/net/ip/libsubsys__net__ip.a(net_pkt.c.obj)
*net_pkt.c.obj(SORT_BY_ALIGNMENT(.noinit.WEST_TOPDIR/zephyr/subsys/net/ip/net_pkt.c.2))
.noinit.WEST_TOPDIR/zephyr/subsys/net/ip/net_pkt.c.2
0x00000000300023b8 0x2d8 zephyr/subsys/net/ip/libsubsys__net__ip.a(net_pkt.c.obj)
*net_pkt.c.obj(SORT_BY_ALIGNMENT(.noinit.WEST_TOPDIR/zephyr/subsys/net/ip/net_pkt.c.3))
.noinit.WEST_TOPDIR/zephyr/subsys/net/ip/net_pkt.c.3
0x0000000030002690 0xd00 zephyr/subsys/net/ip/libsubsys__net__ip.a(net_pkt.c.obj)
*net_pkt.c.obj(SORT_BY_ALIGNMENT(.noinit.WEST_TOPDIR/zephyr/subsys/net/ip/net_pkt.c.k_mem_slab_buf_rx_pkts))
.noinit.WEST_TOPDIR/zephyr/subsys/net/ip/net_pkt.c.k_mem_slab_buf_rx_pkts
0x0000000030003390 0x1a90 zephyr/subsys/net/ip/libsubsys__net__ip.a(net_pkt.c.obj)
0x0000000030003390 _k_mem_slab_buf_rx_pkts
*net_pkt.c.obj(SORT_BY_ALIGNMENT(.noinit.WEST_TOPDIR/zephyr/subsys/net/ip/net_pkt.c.k_mem_slab_buf_tx_pkts))
.noinit.WEST_TOPDIR/zephyr/subsys/net/ip/net_pkt.c.k_mem_slab_buf_tx_pkts
0x0000000030004e20 0x83c zephyr/subsys/net/ip/libsubsys__net__ip.a(net_pkt.c.obj)
0x0000000030004e20 _k_mem_slab_buf_tx_pkts
0x000000003000565c . = ALIGN (0x4)
0x000000003000565c __dsram2_noinit_reloc_end = .
0x00000000300007b0 __dsram2_noinit_reloc_start = ADDR (.dsram2_noinit_reloc)
0x0000000000004eac __dsram2_noinit_reloc_size = (__dsram2_noinit_reloc_end - __dsram2_noinit_reloc_start) |
This patch just formats the section_tags.h file before the real patch, otherwise the changes would be hard to read. Signed-off-by: Marcelo Roberto Jimenez <marcelo.jimenez@gmail.com>
zephyr_code_relocate() was not working for .noinit sections. In particular, it was not relocating network buffers to other RAM areas. The __noinit macro was using quoted strings in the created section names like: .noinit."WEST_TOPDIR/path/file.c".symbol with embedded quotes. GNU ld's KEEP() directive parses quoted strings as separate tokens, causing pattern matching to fail and preventing .noinit sections from being relocated to the target memory region. The solution was to change the __noinit macro to avoid using double quotes to generate clean section names like: .noinit.WEST_TOPDIR/path/file.c.symbol Signed-off-by: Marcelo Roberto Jimenez <marcelo.jimenez@gmail.com>
41ddb9d to
6ed5693
Compare
This was referenced Dec 11, 2025
|
Contributor
|
This is probably a better fix than mine. I hope that either one gets merged soon, as we're running out of RAM too and must move things around. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



zephyr_code_relocate() was not working for .noinit sections. In particular, it was not relocating network buffers to other RAM areas.
The __noinit macro was using quoted strings in the created section names like:
.noinit."WEST_TOPDIR/path/file.c".symbolwith embedded quotes.GNU ld's KEEP() directive parses quoted strings as separate tokens, causing pattern matching to fail and preventing .noinit sections from being relocated to the target memory region.
The solution was to change the __noinit macro to avoid using double quotes to generate clean section names like
.noinit.WEST_TOPDIR/path/file.c.symbol.