-
Notifications
You must be signed in to change notification settings - Fork 8.3k
scripts: gen_relocate_app.py: Replace quoted section name with wildcard. #100221
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
base: main
Are you sure you want to change the base?
scripts: gen_relocate_app.py: Replace quoted section name with wildcard. #100221
Conversation
ld seems to treat quotes in section names as literal characters, which makes it fail to match section names outputted by this script. For example, the following section name, generated with CONFIG_CODE_DATA_RELOCATION to relocate noinit section, fails to match the section, causing it to Not be relocated: KEEP(*file.c.obj(.noinit."WEST_TOPDIR/path/file.c".symbol)) This fix replaces quoted section names with a wildcard, which matches the section correctly. Signed-off-by: Ibrahim Abdalkader <i.abdalkader@gmail.com>
e0c5902 to
0c914f6
Compare
|
tejlmand
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the fix, but I would like to get a better understanding of when this started to fail, cause it looks like a regression.
| # Replace quoted section name with wildcard. | ||
| section_name = re.sub(r'\.\"[^\"]+\"\.', '.*.', section.section_name) | ||
| out += template.format(obj_file_name=section.obj_file_name, section_name=section_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to have this fixed before entering the script.
I wonder how / when this issue first started to appear.
This is the first time I try this, so I'm not sure if it ever worked before. Maybe it was never tested on files that have sections with quotes? |



ld seems to treat quotes in section names as literal characters, which makes it fail to match section names outputted by this script. This fix replaces quoted section names with a wildcard, which matches the section correctly.
Fixes #49155
Context: I'm trying to relocate the kernel heap to another SRAM, using
CONFIG_CODE_DATA_RELOCATION. InCMakeLists.txtI have the following:The generated linker scripts seems to have the right section in SRAM2. Note that the section name is quoted:
In the final elf, the section is empty because ld fails to match it:
With this patch: