-
-
Notifications
You must be signed in to change notification settings - Fork 642
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
add section in ELF file : unexpected section size #661
Comments
Hi @arnopo Yes the +4k when adding a new section is the normal behavior as the loader enforces a relationship between segment VA and offset (c.f the recent blog post: Challenges in Modifying ELF Binaries) In addition and for the specific case of AArch64, the |
Hi @romainthomas Does the rule your point out is applicable for all elf files? I'm working on micro-controllers such as Arm Cortex-M architecture...
Sections are not aligned on page but on cache line or memory word size (32 bits in this case). And for this it seems to rely on the alignment property instead of the page alignment. |
Yes at least for Linux & Android it is applicable for all the ELF LOAD segments but not necessarily the sections. Could you add a reference to the Zephyr Project, I'll check if the loader enforces this rule? |
Regarding same elf file:
The zephyr Project supports more than 300 platforms, the flasher used to load the firmware in embedded flashes depends on the platform, so not an unique loader. If you need a reference perhaps the linux remoteproc elf loader is a good candidate. It is used to load the coprocessor firmware based on a ELF file. if you want more details on arm elf format: https://developer.arm.com/documentation/dui0101/a/ Thanks |
Describe the bug
I'm trying to add a binary as a section in an existing elf file.
my code is
on console the result is
Seems that the
new_sec.size
is not reported in the out.elf (readelf -S
confirm it).does the issue come from the elffile.add? or does is a normal behavior ( 4k page alignment forced)?
To Reproduce
Steps to reproduce the behavior: explained above
Expected behavior
size written : 1900 size expected: 1900
size read : 4096 size expected: 1900
Environment (please complete the following information):
Additional context
The elf file used for my test is generated for arm Cortex-M4 target
Thanks in advance for the help
The text was updated successfully, but these errors were encountered: