diff options
author | Marek Habersack <grendel@twistedcode.net> | 2019-07-10 19:38:46 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2019-07-12 12:41:54 +0300 |
commit | 461ceae59bc8dc827805423f4f2cfa2687a9db17 (patch) | |
tree | c17d7c9321c864460cd4b3fea00e582d91862be8 /tools | |
parent | 04034032f4c7959d58daf1eaf878ea85a80bc74d (diff) |
Fix offsets tool for Android NDK r20
Android NDK r20 contains a header file (`ioctl.h`) with this code:
int ioctl(int __fd, int __request, ...);
#if !defined(BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD)
/* enable_if(1) just exists to break overloading ties. */
int ioctl(int __fd, unsigned __request, ...) __overloadable __enable_if(1, "") __RENAME(ioctl);
#endif
The `_RENAME` macro is defined as `__asm__(x)` and serves the purpose of
replacing an existing symbol with the new one, decorated with the keyword.
Unfortunately, Mono's `offsets-tool` doesn't parse the header properly as
`CppSharp` doesn't understand `__asm__`:
Processing triple: armv7-none-linux-androideabi
Error parsing '/Users/rodo/git/xa2/external/mono/mono/metadata/metadata-cross-helpers.c'
/Users/rodo/android-toolchain/ndk/sysroot/usr/include/bits/ioctl.h(60,5): error: conflicting types for 'ioctl'
Error parsing '/Users/rodo/git/xa2/external/mono/mono/mini/mini-cross-helpers.c'
/Users/rodo/android-toolchain/ndk/sysroot/usr/include/bits/ioctl.h(60,5): error: conflicting types for 'ioctl'
make: *** [/Users/rodo/git/xa2/external/mono/sdks/builds/android-cross-arm-release/armv7-linux-android.h] Error 1
The workaround, implemented in this commit, is to define the
`BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD` macro thus removing the "conflicting"
declaration from the picture, which changes nothing from the offset tool's point
of view and lets us process the headers in NDK r20 properly.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/offsets-tool/MonoAotOffsetsDumper.cs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/offsets-tool/MonoAotOffsetsDumper.cs b/tools/offsets-tool/MonoAotOffsetsDumper.cs index 6a647a33d38..e20df920f78 100644 --- a/tools/offsets-tool/MonoAotOffsetsDumper.cs +++ b/tools/offsets-tool/MonoAotOffsetsDumper.cs @@ -130,7 +130,8 @@ namespace CppSharp foreach (var target in AndroidTargets) target.Defines.AddRange (new string[] { "HOST_ANDROID", - "TARGET_ANDROID", "MONO_CROSS_COMPILE", "USE_MONO_CTX" + "TARGET_ANDROID", "MONO_CROSS_COMPILE", "USE_MONO_CTX", + "BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD" }); } |