Add support for R_ARM_REL32 relocations.#3631
Merged
skotopes merged 2 commits intoflipperdevices:devfrom May 13, 2024
Merged
Conversation
hedger
approved these changes
May 9, 2024
It is fairly straightforward to correctly resolve an R_ARM_REL32 relocation as described in in the "Relocation types" section of ARM ELF Specification (https://developer.arm.com/documentation/espc0003/1-0/?lang=en). The documentation provides the following formula: ``` S - P + A ``` where `S` is the value of the symbol (symAddr), `P` is the address of the place being relocated (relAddr), and `A` is the addend (value extracted from the storage unit being relocated, in this case). I encountered the R_ARM_REL32 relocation type as part of my work for building apps written in Swift for the Flipper Zero. I have manually tested that this relocation works correctly by building and running multiple apps that depend on this relocation.
31d1fdc to
dd9488f
Compare
Contributor
Author
|
@hedger please let me know if you need a pre-compiled |
Contributor
|
@Sameesunkaria yes, we do need it |
Contributor
Author
|
Here's the It's compiled from the sources found on my repository: https://github.com/Sameesunkaria/swift-flipperzero-hello. The app fails to load with the error code "MissingImports" when you try launching it without the changes in this PR. You should see "Undefined relocation 3" in the logs. Hope this helps :) |
skotopes
approved these changes
May 13, 2024
Contributor
|
Seeing swift on flipper is really cool. Great work! |
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
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.
What's new
Add support for
R_ARM_REL32relocations.It is fairly straightforward to correctly resolve an
R_ARM_REL32relocation as described in in the "Relocation types" section of ARM ELF Specification. It modifies the 32-bit word at the address being relocated, just likeR_ARM_ABS32, but the value is resolved using the following formula:where
Sis the value of the symbol (symAddr),Pis the address of the place being relocated (relAddr), andAis the addend (value extracted from the storage unit being relocated, in this case).I encountered the
R_ARM_REL32relocation type as part of my work for building apps written in Swift for the Flipper Zero.Verification
I have manually tested that this relocation works correctly by building and running multiple apps that depend on this relocation being performed correctly.
Checklist (For Reviewer)