sincos should not be used with Android's Bionic.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Linaro Android |
Fix Released
|
Undecided
|
Bernhard Rosenkraenzer |
Bug Description
Early versions of Android's bionic (which are the only ones that can be used due to binary compatibility) do not contain sincos.
Even though it was later added, the implementation simply calls sin and cos [1], so calling it is a pessimization, not an optimization:
[1] https:/
Here is a patch to fix this (please let me know if this isn't the best way to submit patches):
diff -burN a/gcc-4.
--- a/gcc-4.
+++ b/gcc-4.
@@ -95,5 +95,9 @@
is present in the runtime library. */
#define TARGET_
-/* Whether we have sincos that follows the GNU extension. */
-#define TARGET_HAS_SINCOS (OPTION_GLIBC || OPTION_BIONIC)
+/* Whether we have sincos that follows the GNU extension.
+ Linaro set this for OPTION_BIONIC. However, on arm, libm
+ is from Android-3 which doesn't provide sincos and on x86
+ sincos calls sin and cos internally anyway, so this
+ optimization becomes a pessimization. */
+#define TARGET_HAS_SINCOS (OPTION_GLIBC)
tags: | added: linaro-android |
Changed in linaro-android: | |
status: | Triaged → Fix Released |
I think the better thing to do is add a proper sincos() implementation to bionic, allowing us to take advantage of the optimization instead of turning it off to avoid the pessimization. I just did that:
http:// review. android. git.linaro. org/#change, 1319
Of course, this doesn't help with prehistoric builds (android-3), but I doubt those still have any relevance...