Skip to content
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

Work around an Android C++ compiler bug #851

Merged
merged 1 commit into from
Feb 20, 2018

Conversation

joshpeterson
Copy link

The class library code in GetErrorMessage exposes a C++ compiler bug
on Android in the r13b NDK. We can't easily update the NDK, so instead
we will work around the bug by changing the class library code. We don't
expect any change in behavior from this change.

This corrects case 986215.

Release notes:

IL2CPP: Work around a C++ compiler bug in the Android NDK that occurs when obtaining the message from a socket exception.

I'll back port this fix to 2018.1, 2017.3, and 2017.2

if (s_ErrorMessagesInitialized)
return;

s_ErrorMessagesInitialized = true;
Copy link
Member

Choose a reason for hiding this comment

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

Nit, this is racy. Ideally we'd take a lock but at very least we should not set s_ErrorMessagesInitialized to true until the end of this initialization.

Although, if we race in that case we'll get exception since you can't add duplicate keys. So, lock?

Copy link
Member

Choose a reason for hiding this comment

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

Or just put this in static constructor and let runtime handle for you.

Copy link
Author

Choose a reason for hiding this comment

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

I've fixed this issue.

The class library code in `GetErrorMessage` exposes a C++ compiler bug
on Android in the r13b NDK. We can't easily update the NDK, so instead
we will work around the bug by changing the class library code. We don't
expect any change in behavior from this change.
@joshpeterson
Copy link
Author

The Mono build is green with the latest changes.

@joshpeterson joshpeterson merged commit 9410509 into unity-master Feb 20, 2018
@joshpeterson joshpeterson deleted the workaround-android-compiler-bug branch February 20, 2018 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants