-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[arm] account for signed bit when calculating offset to PLT entry #18454
Conversation
mono/mini/tramp-arm.c
Outdated
@@ -1128,7 +1128,7 @@ mono_arm_get_thumb_plt_entry (guint8 *code) | |||
|
|||
g_assert ((t1 >> 11) == 0x1e); | |||
|
|||
s = (t1 >> 10) & 0x1; | |||
s = (t1 >> 10) & 0x1 ? 1 : 0; | |||
imm10 = (t1 >> 0) & 0x3ff; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed.
/* Sign extend from 24 bits to 32 bits */ | ||
imm32 = ((gint32)imm32 << 8) >> 8; | ||
/* Sign extend from 25 bits to 32 bits */ | ||
imm32 = ((gint32)imm32 << 7) >> 7; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe worth a helper function. Like:
https://github.com/microsoft/Detours/blob/64ec135a509884aa60ac6c19b59564f1da9cb2fa/src/detours.cpp#L1019
or
https://github.com/microsoft/Detours/blob/64ec135a509884aa60ac6c19b59564f1da9cb2fa/src/disasm.cpp#L1867
(MIT licensed)
@monojenkins squash |
@monojenkins backport 2019-12 |
@monojenkins backport 2019-10 |
… entry (#18461) [2019-10] [arm] account for signed bit when calculating offset to PLT entry See `bl` documentation (make sure you look at the thumb2 one): <img width="1003" alt="Screenshot 2020-01-14 at 22 43 33" src="https://user-images.githubusercontent.com/75403/72385601-2bb53b00-3720-11ea-9858-d73bc2d02a7e.png"> Fixes #18247 Backport of #18454. /cc @lewurm
See

bl
documentation (make sure you look at the thumb2 one):Fixes #18247