facebookarchive / BOLT

Binary Optimization and Layout Tool - A linux command-line utility used for optimizing performance of binaries
2.51k stars 176 forks source link

[PR]Aarch64:Add R_AARCH64_P32_ADR_PREL_LO21 relocation type #253

Closed HShan886 closed 2 years ago

HShan886 commented 2 years ago

Add R_AARCH64_P32_ADR_PREL_LO21 relocation type support

facebook-github-bot commented 2 years ago

Hi @Haishan312!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

facebook-github-bot commented 2 years ago

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

yota9 commented 2 years ago

Adding size for relocation is not sufficient to add support. You can see the example of adding relocation support here: https://github.com/facebookincubator/BOLT/commit/61a2062542cd7f015cde0e0ff06abe305993943d . But also I'm not 100% sure that the BOLT will now correctly work with the ILP32 on all its stages, this should be checked carefully.. E.g. the data extraction with pointer size, maybe the RewriteInstance might have some problems, I'm not sure..

HShan886 commented 2 years ago

Adding size for relocation is not sufficient to add support. You can see the example of adding relocation support here: 61a2062 . But also I'm not 100% sure that the BOLT will now correctly work with the ILP32 on all its stages, this should be checked carefully.. E.g. the data extraction with pointer size, maybe the RewriteInstance might have some problems, I'm not sure..

Thanks for reply. we compile spec2017 with gcc-10, and bolt report an assert stack. Then add this type, it works ok

yota9 commented 2 years ago

@Haishan312 Do you use update-debug-sections flag?

HShan886 commented 2 years ago

@Haishan312 Do you use update-debug-sections flag?

Yes, I add this flag in my script.

yota9 commented 2 years ago

@Haishan312 This is the real problem, not the relocation it self. I think our team is already working on this :)

HShan886 commented 2 years ago

@yota9 That's great. Expect your patch.