Commit Graph

16 Commits

Author SHA1 Message Date
Andrew Hsieh
3598d53b42 Drop clang version check for __builtin_isinf and __builtin_isnan
This CL unconditionally removes the existance of __builtin_isinf and
__builtin_isnan from math.h for clang, because (unlike other math functions)
clang doesn't like those to be declared.

See LLVM bugzilla entry: http://llvm.org/bugs/show_bug.cgi?id=20958

The reason for decorating all math functions with __attribute__((pcs("aapcs")))
is to offer developers the ability to compile their code with hardfp and still
link Android's libm.so which follows softfp calling convention.

Before issue 20958 is fixed, those who want clang to compile their code with
hardfp in NDK has to go all the way hard, ie.
1) LOCAL_CFLAGS += -mhard-float -D_NDK_MATH_NO_SOFTFP=1
   Note that _NDK_MATH_NO_SOFTFP=1 remove __attribute__((pcs("aapcs"))) for all math functions
2) LOCAL_LDLIBS += -lm_hard  # link libm_hard.a recompiled with -mhard-float instead of bionic libm.so

Change-Id: Ie2f95e73e58e1574e8cadbcab92a5209d94448e1
2015-01-16 14:24:04 -08:00
Andrew Hsieh
3dbef8fe11 Bump up clang vesion accepting __builtin_isnan __attribute__((pcs("aapcs")))
Upstream clang3.6 still doesn't allow change of calling convension of
__builtin_isnan from the default to "softfp" (via __attribute__((pcs("aapcs"))))
as required by bionic libm.so for 32-bit ARM.  Let's hope clang3.7
fix that.  See upstream bug http://llvm.org/bugs/show_bug.cgi?id=20958

Change-Id: Ibdcc1783ffa7cf2f36e733983bd6d912ad38df70
2014-09-26 16:20:56 +08:00
Andrew Hsieh
b280e72a97 Bump __clang_minor__ check to 6 for __builtin_isnan
It appears that upstream 3.5 still can't accept __builtin_isnan redeclared
with calling convention, eg.

cat > isnan.c <<EOF
int __builtin_isnan(double) __attribute__((pcs("aapcs")));
EOF

  clang  -target armv5te-none-linux-androideabi -c isnan.c
  isnan.c:1:5: error: function declared 'aapcs' here was previously declared without calling convention
  int __builtin_isnan(double) __attribute__((pcs("aapcs")));
      ^
  isnan.c:1:5: note: previous declaration is here

Change-Id: Iff466fd913c3deec27aa3ff355a208543028d368
2014-04-25 09:55:31 -07:00
David Friedman
3b601c6550 Fixed apparent copy/paste mistake
Bug: 11634373

Change-Id: I44766217f414988bfd3be68043a4b80dd21554d8
2014-02-05 11:18:32 +08:00
Andrew Hsieh
ca34e29d94 Merge "Fix headers to be inclued alone" 2014-01-16 17:03:03 +00:00
Andrew Hsieh
42bb3bcadc Merge "Fix typo in comments in looper.h" 2014-01-16 17:02:47 +00:00
Andrew Hsieh
2c8776805a Fix headers to be inclued alone
See b.android.com/64679 for one of header sys/prctl.h

Change-Id: Ie415ebe2086d2f0190d84fba0c57cc7e1e5822ae
2014-01-13 12:58:46 +08:00
Andrew Hsieh
d980848377 Fix typo in comments in looper.h
Remove android-13's looper.h because it's identical to android-9's
Note that ndk/platforms/android-N only keep delta to previous level

Change-Id: Ibd2c3e168cfe7f6902fdc6eca2e2778d8ccf1fac
2014-01-08 17:24:22 +08:00
Andrew Hsieh
fbb32955a4 Fixed asset_manager.h, rect_manager.h, and jni.h
1. Fixed missing #include <sys/types.h> in android/asset_manager.h for API >= 13
2. Fixed missing #include <stdint.h> in android/rect_manager.h for API >= 14
3. Added JNICALL to JNI_OnLoad and JNI_OnUnload in jni.h

Change-Id: I875ec0b6e6f7c2f433c176f0a738eb78f3c33062
2014-01-08 14:10:06 +08:00
Logan Chien
ad40d952a1 Workaround the __builtin_isnan() type error for clang 3.4.
Similar to clang 3.3, it seems that clang 3.4 declares an incompatible
function prototypes for __builtin_isnan().  To workaround this issue,
we should not declare the function prototype for __builtin_isnan().

Note: Though it may be good to fix this in clang type checker, like
__builtin_nexttoward(), however it seems non-trivial since __builtin_isnsn()
might be overloaded.  We can revert this after we have fixed the
clang builtin definition.

Change-Id: I329b56225f3d229b0c141bb8414c4369f154efda
2013-12-25 01:59:29 +00:00
Andrew Hsieh
2a571fda2b Fix -mhard-float for calling __builtin_* math functions
Annotate __builtin math functions with __NDK_FPABI_MATH__ too.
1. __attribute__((pcs("aapcs"))) has no effect on codegen when __buitlin
   function is emitted inlined.
2. When __builtin call into regular function in Android's libm, it has
   proper attribute which observes soft float-abi

Change-Id: I11e8b74fc22f3072b9ce849193e4a56e98c92d64
2013-12-04 11:45:04 +08:00
Andrew Hsieh
5881b5cbe7 Add __NDK_FPABI__ to function taking/returning float/double
Allow user code to be compiled with "-mhard-float" for armeabi-v7a
(which implies -mfloat-abi=hard), and either link with
1. Android native APIs which use softfp, or
2. A customized libm_hard.a which is compiled with -mhard-float. Need
   -D_NDK_MATH_NO_SOFTFP=1

See tests/device/hard-float/jni/Android.mk for details and restriction
on Clang

Change-Id: I773a842c73368e08b9a6cda0441e95a96fa303b2
2013-10-17 19:15:22 +08:00
Andrew Hsieh
a36935be21 Merge "Add missing math functions" 2013-10-17 10:54:18 +00:00
Andrew Hsieh
0df3e70b99 Add missing math functions
1. Add sincos, sincosf, and sincosl to API >= 9 (for ARM only,
   because X86 and MIPS have it already)
2. Add nan, nanf, nanl, and tgammaf to API >= 13 (11 actually,
   but we don't want to add another API which is not released)
3. Add log2, log2f, log2l, logbl, nexttoward, and nexttowardl to
   API >= 18

See b.android.com/38423

Change-Id: I0a756aeeddafc3862f3c0ae38218cb3301608231
2013-10-15 15:55:12 +08:00
Andrew Hsieh
0c147ba2dc Update libandroid.so for API9 .. API18
This CL update library.  See
f3c3a93bc4 for API13..18 header update

Add functions:

android-9:
  AMotionEvent_getHistoricalRawX
  AMotionEvent_getHistoricalRawY
  AMotionEvent_getHistoricalTouchMajor
  AMotionEvent_getHistoricalTouchMinor
  AMotionEvent_getHistoricalToolMajor
  AMotionEvent_getHistoricalToolMinor
  AMotionEvent_getHistoricalOrientation

android-13:
  AAsset_seek64
  AAsset_getLength64
  AAsset_getRemainingLength64
  AAsset_openFileDescriptor64
  AConfiguration_getScreenWidthDp
  AConfiguration_setScreenWidthDp
  AConfiguration_getScreenHeightDp
  AConfiguration_setScreenHeightDp
  AConfiguration_getSmallestScreenWidthDp
  AConfiguration_setSmallestScreenWidthDp
  AMotionEvent_getAxisValue
  AMotionEvent_getHistoricalAxisValue
  ANativeWindow_fromSurfaceTexture (removed in >=API16)
  android_getTtsEngine
  getTtsEngine

android-14:
  AMotionEvent_getButtonState
  AMotionEvent_getToolType

android-15:
  << none >>

android-16:
  Remove ANativeWindow_fromSurfaceTexture

android-17:
  AConfiguration_getLayoutDirection
  AConfiguration_setLayoutDirection

android-18:
  << none >>

Also
  1. remove android-16/include/android/native_activity.h which is the
     same as android-13's
  2. fix input.h comments and missing args, same as
     9d0136004f for android-9
  3. sort android-9's libandroid.so.functions.txt for easier comparison

See https://code.google.com/p/android/issues/detail?id=47150
    https://code.google.com/p/android/issues/detail?id=58528

Change-Id: Iaa88fe45d188482fd0905ca54180c635ab02dd95
2013-10-14 18:44:24 +08:00
Michael Wright
f3c3a93bc4 Update NDK's android headers
Change-Id: I2ae3b42dcbbdccbcae018f768dc7b56723416d21
2013-08-29 18:17:46 -07:00