-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Gap between .text and .text_init segments on riscv32imac-unknown-none-elf #118214
Comments
The ALIGN field shows that Since the I don't think this is a rustc bug, but I also don't know why the alignment is different between the two binaries. |
@zachs18 The feature I toggle between the two builds, conditionally enables a 16 byte aligned function ( Why does the alignment of a single function influence the overall alignment of the text segment? The binary with the problem does not start with my 16 byte aligned function. See here the beginning of the text segment:
|
If the section is not at least 16-byte aligned, then there is no way to guarantee a function in that section will be 16-byte aligned. The alignment of a section must be at least the greatest alignment of any alignment request within it, or else some alignment requests cannot be guaranteed to be respected. |
While rustc is not completely innocent in terms of generating sections, I believe it is LLVM which examines and processes the request of |
Thank you @workingjubilee and @zachs18 .
This seems to be true. Whenever I conditionally added a 16-byte aligned function, the entire We'll adjust our tooling accordingly. |
rustc seems to sometimes insert a gap between the
.text
and.text_init
segments onriscv32imac-unknown-none-elf
.I have two binaries, built with rustc. In one binary there is a gap of 0x8 between the segements, and in the other binary there is no gap.
Here are the segments for the binary with the gap:
and here for the binary without the gap:
These gaps, break our tooling in
espflash
and I wanted to ask what could be the reason that there is suddenly a gap between the segments. Is this something we need to account for in our tooling, or is this a rustc bug?Unfortunately, I cannot share the source code of my two binaries. The only difference between the two binaries is that I enabled a seemingly unrelated feature in one build, which is disabled in the other build. I also was not able to strip down the binaries to a minimal, complete, verifiable, example. Sorry 😞
The text was updated successfully, but these errors were encountered: