Merge "Switch libm to building with clang."
This commit is contained in:
commit
5df23dc85e
|
@ -1,5 +1,5 @@
|
||||||
ifneq ($(TARGET_USE_PRIVATE_LIBM),true)
|
ifneq ($(TARGET_USE_PRIVATE_LIBM),true)
|
||||||
LOCAL_PATH:= $(call my-dir)
|
LOCAL_PATH := $(call my-dir)
|
||||||
|
|
||||||
# TODO: this comes from from upstream's libc, not libm, but it's an
|
# TODO: this comes from from upstream's libc, not libm, but it's an
|
||||||
# implementation detail that should have hidden visibility, so it needs
|
# implementation detail that should have hidden visibility, so it needs
|
||||||
|
@ -232,14 +232,21 @@ libm_ld_src_files += \
|
||||||
# TODO: re-enable i387/e_sqrtf.S for x86, and maybe others.
|
# TODO: re-enable i387/e_sqrtf.S for x86, and maybe others.
|
||||||
|
|
||||||
libm_common_cflags := \
|
libm_common_cflags := \
|
||||||
|
-Wall \
|
||||||
|
-Wextra \
|
||||||
|
-Wunused \
|
||||||
|
-Werror=pointer-to-int-cast \
|
||||||
|
-Werror=int-to-pointer-cast \
|
||||||
|
-Werror=type-limits \
|
||||||
|
-Werror \
|
||||||
-DFLT_EVAL_METHOD=0 \
|
-DFLT_EVAL_METHOD=0 \
|
||||||
-std=c99 \
|
-std=gnu99 \
|
||||||
-include $(LOCAL_PATH)/freebsd-compat.h \
|
-include $(LOCAL_PATH)/freebsd-compat.h \
|
||||||
-Wno-missing-braces \
|
-Wno-missing-braces \
|
||||||
-Wno-parentheses \
|
-Wno-parentheses \
|
||||||
-Wno-sign-compare \
|
-Wno-sign-compare \
|
||||||
-Wno-uninitialized \
|
-Wno-uninitialized \
|
||||||
-Wno-unknown-pragmas \
|
-Wno-unused-variable \
|
||||||
-fvisibility=hidden \
|
-fvisibility=hidden \
|
||||||
|
|
||||||
# Workaround the GCC "(long)fn -> lfn" optimization bug which will result in
|
# Workaround the GCC "(long)fn -> lfn" optimization bug which will result in
|
||||||
|
@ -255,7 +262,8 @@ libm_ld_includes := $(LOCAL_PATH)/upstream-freebsd/lib/msun/ld128/
|
||||||
# libm.a for target.
|
# libm.a for target.
|
||||||
#
|
#
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE:= libm
|
LOCAL_MODULE := libm
|
||||||
|
LOCAL_CLANG := true
|
||||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
||||||
LOCAL_ARM_MODE := arm
|
LOCAL_ARM_MODE := arm
|
||||||
LOCAL_CFLAGS := $(libm_common_cflags)
|
LOCAL_CFLAGS := $(libm_common_cflags)
|
||||||
|
@ -287,7 +295,8 @@ include $(BUILD_STATIC_LIBRARY)
|
||||||
# libm.so for target.
|
# libm.so for target.
|
||||||
#
|
#
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE:= libm
|
LOCAL_MODULE := libm
|
||||||
|
LOCAL_CLANG := true
|
||||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
||||||
LOCAL_SYSTEM_SHARED_LIBRARIES := libc
|
LOCAL_SYSTEM_SHARED_LIBRARIES := libc
|
||||||
LOCAL_WHOLE_STATIC_LIBRARIES := libm
|
LOCAL_WHOLE_STATIC_LIBRARIES := libm
|
||||||
|
|
|
@ -22,18 +22,21 @@
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _GNU_SOURCE 1
|
#define _GNU_SOURCE 1
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#if !defined(__clang__)
|
||||||
// Disable sincos optimization for all functions in this file,
|
// Disable sincos optimization for all functions in this file,
|
||||||
// otherwise gcc would generate infinite calls.
|
// otherwise gcc would generate infinite calls.
|
||||||
// Refer to gcc PR46926.
|
// Refer to gcc PR46926.
|
||||||
// -fno-builtin-sin or -fno-builtin-cos can disable sincos optimization,
|
// -fno-builtin-sin or -fno-builtin-cos can disable sincos optimization,
|
||||||
// but these two options do not work inside optimize pragma in-file.
|
// but these two options do not work inside optimize pragma in-file.
|
||||||
// Thus we just enforce -O0 when compiling this file.
|
// Thus we just enforce -O0 when compiling this file.
|
||||||
|
// clang doesn't implement this optimization anyway, so it doesn't need this.
|
||||||
#pragma GCC optimize ("O0")
|
#pragma GCC optimize ("O0")
|
||||||
|
#endif
|
||||||
|
|
||||||
void sincos(double x, double* p_sin, double* p_cos) {
|
void sincos(double x, double* p_sin, double* p_cos) {
|
||||||
*p_sin = sin(x);
|
*p_sin = sin(x);
|
||||||
|
|
Loading…
Reference in New Issue