Skip to content

poly1305/asm/poly1305-armv4.pl: avoid conditional branch to PLT in THUMB-2#5949

Closed
rahulchaudhry wants to merge 1 commit intoopenssl:masterfrom
rahulchaudhry:master
Closed

poly1305/asm/poly1305-armv4.pl: avoid conditional branch to PLT in THUMB-2#5949
rahulchaudhry wants to merge 1 commit intoopenssl:masterfrom
rahulchaudhry:master

Conversation

@rahulchaudhry
Copy link

When compiling for THUMB-2, the conditional branch to PLT results in a
R_ARM_THM_JUMP19 relocation. Some linkers don't support this relocation
in THUMB-2 (ld.gold), while others can end up truncating the relocation
to fit (ld.bfd).

Adding an "it eq" before the branch converts it into an unconditional
branch, which uses R_ARM_THM_JUMP24 relocation that has a range of 16MB.

See android/ndk#337 for background.

The current workaround is to disable poly1305 optimization assembly,
which is not optimal and can be reverted after this patch:
https://github.com/freedesktop/gstreamer-cerbero/commit/beab607d2b1ff23c41b7e01aa9c64be5e247d1e6

CLA: trivial

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to suggest (which is basically euphemism for insist:-) on removing this relocation altogether. I mean suggested change replaces one relocation type with another, but why have relocation at all if we can get rid of it? So drop #ifdef, beq .Lpoly1305_blocks and add .Lpoly1305_blocks: right after poly1305_blocks:.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

…UMB-2.

When compiling for THUMB-2, the conditional branch to PLT results in a
R_ARM_THM_JUMP19 relocation. Some linkers don't support this relocation
in THUMB-2 (ld.gold), while others can end up truncating the relocation
to fit (ld.bfd).

Convert this branch through PLT into a direct branch that the assembler
can resolve locally.

See android/ndk#337 for background.

The current workaround is to disable poly1305 optimization assembly,
which is not optimal and can be reverted after this patch:
https://github.com/freedesktop/gstreamer-cerbero/commit/beab607d2b1ff23c41b7e01aa9c64be5e247d1e6

CLA: trivial
@dot-asm dot-asm added branch: master Applies to master branch 1.1.0 approval: review pending This pull request needs review by a committer branch: 1.1.1 Applies to OpenSSL_1_1_1-stable branch (EOL) labels Apr 14, 2018
@dot-asm
Copy link
Contributor

dot-asm commented Apr 14, 2018

Editorial note. I'd say that "remove unintentional relocation" would be more appropriate subject. Because modification doesn't affect Thumb-2 exclusively and original subject is too "tech". I mean not everybody keeps those abbreviations in "Level 1 cache" of their brains. I would also modify description as "conditional branch to global symbol results in reference to PLT and a R_ARM_THM_JUMP19 relocation". You don't have to do anything, I can do it upon commit to repo.

@rahulchaudhry
Copy link
Author

Thanks

@dot-asm
Copy link
Contributor

dot-asm commented Apr 18, 2018

Ping for 2nd review.

@richsalz richsalz added approval: done This pull request has the required number of approvals and removed approval: review pending This pull request needs review by a committer labels Apr 18, 2018
levitte pushed a commit that referenced this pull request Apr 18, 2018
Branch to global symbol results in reference to PLT, and when compiling
for THUMB-2 - in a R_ARM_THM_JUMP19 relocation. Some linkers don't
support this relocation (ld.gold), while others can end up truncating
the relocation to fit (ld.bfd).

Convert this branch through PLT into a direct branch that the assembler
can resolve locally.

See android/ndk#337 for background.

The current workaround is to disable poly1305 optimization assembly,
which is not optimal and can be reverted after this patch:
https://github.com/freedesktop/gstreamer-cerbero/commit/beab607d2b1ff23c41b7e01aa9c64be5e247d1e6

CLA: trivial

Reviewed-by: Andy Polyakov <[email protected]>
Reviewed-by: Rich Salz <[email protected]>
(Merged from #5949)
levitte pushed a commit that referenced this pull request Apr 18, 2018
Branch to global symbol results in reference to PLT, and when compiling
for THUMB-2 - in a R_ARM_THM_JUMP19 relocation. Some linkers don't
support this relocation (ld.gold), while others can end up truncating
the relocation to fit (ld.bfd).

Convert this branch through PLT into a direct branch that the assembler
can resolve locally.

See android/ndk#337 for background.

The current workaround is to disable poly1305 optimization assembly,
which is not optimal and can be reverted after this patch:
https://github.com/freedesktop/gstreamer-cerbero/commit/beab607d2b1ff23c41b7e01aa9c64be5e247d1e6

CLA: trivial

Reviewed-by: Andy Polyakov <[email protected]>
Reviewed-by: Rich Salz <[email protected]>
(Merged from #5949)

(cherry picked from commit 5bb1cd2)
@dot-asm
Copy link
Contributor

dot-asm commented Apr 18, 2018

Merged. Thanks!

@dot-asm dot-asm closed this Apr 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval: done This pull request has the required number of approvals branch: master Applies to master branch branch: 1.1.1 Applies to OpenSSL_1_1_1-stable branch (EOL)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants