-
Notifications
You must be signed in to change notification settings - Fork 264
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
CONC-764: Build error in ma_context.c on android #273
base: 3.3
Are you sure you want to change the base?
Conversation
X18 is a platform-reserved register on Android, not a callee-save register. So it will not be touched by the spawned/resumed co-routine and must not be included in the GCC asm clobber list on this platform. Signed-off-by: Kristian Nielsen <[email protected]>
The same problem is present on MacOS on ARM64:
|
Interesting. And it seems X18 is also a platform reserved register on arm64 Windows. |
This is quite annoying, actually :-/ The libmariadb code in ma_context.cc does not use the X18 register in any way, it will work fine on any of the platforms. On platforms where X18 is reserved, the ma_context.cc code will also preserve it. On other platforms, the X18 register need not be preserved by the ma_context.cc code. The only case to handle is to tell GCC itself to not generate code that uses X18 in the function, which is only relevant on platforms where it is not reserved. In summary, the code is correct in all cases, it's just the compiler warning that is bogus. And -Werror is wrongly causing a compile failure here. |
Some research show that X18 is mentioned as a platform-reserved register on most non-linux platforms, including MacOS, Windows, and FreeBSD. So only put it in the clobber list in Linux. Note that the ma_context.c code does not itself use the X18 register in any way. On platforms where X18 is reserved, the co-routine code will preserve it. On platforms where co-routine code can modify X18, it does not need to be preserved. Putting X18 in the clobber list is only to avoid GCC itself generating code that requires that X18 is preserved. Signed-off-by: Kristian Nielsen <[email protected]>
X18 is a platform-reserved register on Android, not a callee-save register. So it will not be touched by the spawned/resumed co-routine and must not be included in the GCC asm clobber list on this platform.
After some research, it looks like X18 is a scratch register on Linux, but platform reserved on most other platforms, including Android, MacOS, FreeBSD, Windows. So the patch puts X18 in the clobber list on Linux only (and not on Android, which also defines the
__linux__
preprocessor macro).References:
Build failure: microsoft/vcpkg#44015
Android arm64-v8a ABI: https://developer.android.com/ndk/guides/abis#arm64-v8a