Static/dynamic library linking behavior change (10.1 -> 10.2+)
There was some change in linking behavior, which may or may not be an issue.
I'm attaching a simple project that is able to reproduce the change:
- test app linked to shared library
- shared library linked with static library
- the shared library has a method to access static variable defined in the static library
- the test app accesses method from shared library and also directly accessing static variable from the static library (the app itself is not linked to static library, at least not explicitly).
Behavior in ndk 10.1.0 (I have also verified that it is behavior in google ndk r10e):
- calls in the test app refer to the same memory
Behavior in ndk 10.2.0 and 10.3.0:
- calls refer to different memory locations
Updated by Dmitry Moskalchuk almost 5 years ago
- Category set to build/core
- Status changed from In Progress to Closed
- % Done changed from 0 to 100
Alex, thank you for reporting this issue! Having your minimal example, I was able to reproduce it.
It was a bug, introduced by "this":https://github.com/crystax/android-platform-ndk/commit/bcd2d89a4c9b4853dc67d5441a591980d94c9c38 commit. I've "fixed":https://github.com/crystax/android-platform-ndk/commit/c5cc5abcf69f537bcbd0d63c535cbfa05b13d03c it and added test case, preventing its appearing in the future.
This fix will be included to the upcoming 10.3.1 release.