-
Notifications
You must be signed in to change notification settings - Fork 168
add (.symtab) size info to external assembly functions #211
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
Labels
Comments
stianeklund
added a commit
to stianeklund/cortex-m
that referenced
this issue
Apr 28, 2020
bors bot
added a commit
that referenced
this issue
Apr 29, 2020
212: Add symtab (size info) for all external assembly functions r=japaric a=stianeklund Adds `.size` info for all of the external assembly functions. Fixes #211 Co-authored-by: Stian Eklund <[email protected]>
bors bot
added a commit
that referenced
this issue
May 5, 2020
212: Add symtab (size info) for all external assembly functions r=japaric a=stianeklund Adds `.size` info for all of the external assembly functions. Fixes #211 Co-authored-by: Stian Eklund <[email protected]>
jonas-schievink
pushed a commit
that referenced
this issue
Jul 19, 2020
adamgreig
pushed a commit
that referenced
this issue
Jan 12, 2022
211: Bump rand dependency to 0.7 r=korken89 a=therealprof Signed-off-by: Daniel Egger <[email protected]> Co-authored-by: Daniel Egger <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Our external assembly subroutines (e.g.
__nop
) are not properly reporting their size in the .symtab section. If you build the cortex-m-quickstart template and print the contents of the symbol table (.symtab) you'll see that those assembly subroutines report their size as 0.The first two lines (Rust functions) are correct. The last line (
__nop
) is wrongly reporting its size as 0.This bug won't affect linking or the runtime behavior of the program but may cause ELF post-processing tools to incorrectly interpret these functions as tags (e.g.
$t.0
), which are also zero sized, and discard them which may result in invalid output binaries.To add size info you need to add the following line to the existing subroutines in the
asm*.s
files:.section .text.__bkpt .global __bkpt .thumb_func __bkpt: bkpt bx lr + .size __bkpt, . - __bkpt
Note that the name of the subroutine needs to be used in the
.size
directive (__bkpt
in the example)After modifying those files you'll need to re-assemble the files by running the
./assemble.sh
script.After making those changes you should see the correct size in the output of
readelf
:P.S. many other crates that use external assembly (cortex-m-rt, cortex-m-semihosting, etc.) need this fix
The text was updated successfully, but these errors were encountered: