Reduce the minimum required hot patching size from 14 to 6 on x86_64 #141
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.
This patch reduces the minimum required hot patching size from 14 to 6 on x86_64
if the distance from a hot-patch target function to the trampoline memory is within 2GB.
(The exact condition is:
(trampoline_memory_address - (target_function_address + 6)) between INT32_MIN and INT32_MAX
)This patch also allocates trampoline memory under 2GB by using mmap() with MAP_32BIT when mysqld resides under 2GB.
This will rescue the following error in #72 (comment)
Relative addressing was found at 10 bytes after the beginning of the function.
It failed because 10 is smaller than the minimum hot patching size 14.
But it will not fail if the size becomes 6.
0x7f0fa44e5000 - (0x7f0fc6f59aa0 + 6) = -581388966
, which is betweenINT32_MIN
andINT32_MAX
.