Commit Graph

101 Commits

Author SHA1 Message Date
Andrew Hsieh
0faa78e6e0 Define __PTHREAD_*_INIT_VLAUE in pthread.h for API < 9
Define __PTHREAD_MUTEX_INIT_VALUE, __PTHREAD_RECURSIVE_MUTEX_INIT_VALUE,
and __PTHREAD_ERRORCHECK_MUTEX_INIT_VALUE in pthread.h for API < 9.
Pthread.h in API >= 9 have those already since bionic
9831ad3ce6bd5b22da16a275ed67e7236eae3d1f

Change-Id: Ia97960ecbfed0811dde70f75cb23951ecdf803af
2014-02-24 13:08:12 +08:00
Andrew Hsieh
ca34e29d94 Merge "Fix headers to be inclued alone" 2014-01-16 17:03:03 +00:00
Andrew Hsieh
6d2d58de54 Merge "Fixed asset_manager.h, rect_manager.h, and jni.h" 2014-01-16 17:02:36 +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
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
Andrew Hsieh
7e25851a68 Implement wait4 already exist in header
1. Implement wait4 by calling __wait4 exists in libc.so
2. Add wait4 to libc.a

Change-Id: I08b6555cc50ee88358cd2ec63f9d8d2d4482305a
2013-12-30 11:57:38 +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
David 'Digit' Turner
db275132c5 ndk: Fix wait4() declarations
wait4() was incorrectly declared in <sys/wait.h>, but only added to the
C library in Android 4.3 (API level 18) [1]

This patch:

- Removes the wait4() declarations for any <sys/wait.h> header before
  API level 19.

- Brings the API level 19 <sys/wait.h> which correctly declares wait4().

- Update the libc.so.functions.txt for API level 19 of all platforms
  to include the exported symbol.

NOTE: This does not bring the static libc.a to API level 19, which means
      it is stuck at API level 9 for ARM.

See [2] for the corresponding NDK tests.

http://b.android.com/19854

[1] 17a8b0db63
[2] https://android-review.googlesource.com/#/c/72000/

Change-Id: I7735473d177c44f43b09bb6738e9914945cd4d0a
2013-12-11 17:23:46 +01:00
Andrew Hsieh
b05e7c1985 Annotate JNICALL with __NDK_FPABI__
In armeabi-v7a, VM still expects JNI functions to follow soft-abi.
Annotate it with __NDK_FPABI__ so compiler follows soft-abi in JNI
functions regardless the presence of -mhard-float in command-line.

It's up to developer to apply JNICALL consistently on JNI functions,
ie. those functions whose first arg has type "JNIEnv*" is likely to be

Change-Id: Ica7cca8ab9498ce00de6ffc7fff35f8cc13aedbf
2013-12-04 11:55:17 +08: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
a2e8997b9f Update time.h for CLOCK_BOOTTIME, etc
Add CLOCK_MONOTONIC_RAW, CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_COARSE,
CLOCK_BOOTTIME, CLOCK_REALTIME_ALARM, and CLOCK_BOOTTIME_ALARM

Remove obsolete CLOCK_REALTIME_HR and CLOCK_MONOTONIC_HR

See:
0351955a686fe4e0bf9f30780f78ff0e2402a6b0
b928bda83d4413b703329f607e2706602f15293f
60e5144ca312b210b54ac8e6966108da0c97ff80

Change-Id: Ibc9e297ab71f3dc16eec0746f835f89e554fd68b
2013-11-14 12:14:12 +08:00
Andrew Hsieh
effaa95815 <pthread.h>: Mark pthread_exit() as __noreturn
Same fix as https://android-review.googlesource.com/#/c/67540/
Fix for: https://code.google.com/p/android/issues/detail?id=60686

Change-Id: I27b8f1ed71dbb44f3598f7f4551bd881754ef945
2013-11-04 10:37:50 +08:00
Andrew Hsieh
61097c7e51 Fix prototype of poll
from poll(struct pollfd *, nfds_t, long) to
poll(struct pollfd *, nfds_t, int)

See 11952073af22568bba0b661f7a9d4402c443a888
and ebfbb367fb

Change-Id: Idba600d4b172404f0a1d5d715febcba8a495a770
2013-11-01 08:33:08 +08:00
David 'Digit' Turner
82703204a9 ndk: Add missing declaration for mkdtemp
The mkdtemp() function has always been implemented in the C library
(see [1] for proof) but was missing a declaration in <stdlib.h>, until
Android 4.0.1 [2]

This patch simply adds the missing declaration to former <stdlib.h>
versions. This makes it easier to build certain open-source programs
for Android, because auto-tools probing typically looks at the symbols
in libc.so to define HAVE_MKDTEMP, then the source fails to compile
because of the lack of declaration.

Note that the mkdtemp is also already listed in
platforms/android-*/arch-*/symbols/libc.so.functions.txt, which were
generated by parsing actual system libraries, and thus don't need to
be updated here.

[1] https://android.googlesource.com/platform/bionic/+/android-1.6_r1/libc/stdio/mktemp.c
    https://android.googlesource.com/platform/bionic/+/android-1.6_r1/libc/Android.mk

[2] ad1ff2fb26

Change-Id: I838b54bcb5cbfd2fed24cf7649897889ec7a5559
2013-10-28 18:46:54 +01:00
Andrew Hsieh
956fc5ca9e Merge "Add libm_hard.a for armeabi-v7a" 2013-10-17 11:43:29 +00:00
Andrew Hsieh
059df41ed9 Add libm_hard.a for armeabi-v7a
A math library compiled with -mhard-float.  Build instructions:

1. cd to a recent Android source tree: bionic.git
   fbefb252b09634114977dbd1b48dd42bb2629b83 (internal) in this case
2. Temporarily remove "-mfloat-abi=softfp" from build/core/combo/arch/arm/armv7*
   and build/core/combo/TARGET_linux-arm.mk
3. Temporarily add "-mhard-float -mfloat-abi=hard" to LOCAL_CFLAGS
   for libm.a in bionic/libm/Android.mk
4. make -B -j32 out/target/product/generic/obj/STATIC_LIBRARIES/libm_intermediates/libm.a
5. Rename it

Change-Id: I107eea48af75e97b448862cfc7aae2e8f8911a63
2013-10-17 19:41:06 +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
16af6afb9a Refresh include/sys/vfs.h
1. Sync bionic's, remove mips-specific one
2. Fix statfs.c to transfer the new f_flags too
3. Revise comment about --wrap=symbol

Change-Id: If68818e3dcb2a4056cd0b2e100fcfb8b2156c33a
2013-10-07 15:39:47 +08:00
Andrew Hsieh
c2e61c3c01 Fix issue 58135 about _C_LABEL_STRING macro w/o space between literal in C++
Change-Id: Iefc3c090071f3629998515d43907139b07105672
2013-09-06 17:34:31 +08:00
Andrew Hsieh
d9124876f0 arch-specific diff of header
Change-Id: I78e2186dc7e491095201efc2c709f26e8822a076
2013-09-06 16:25:41 +08:00
Grigoriy Kraynov
eaf0281f45 Remove missing functions imaxabs() and imaxdiv() from inttypes.h
Bionic does not have actual implementation of those functions.
Further implementations should be introduced in new
API-level in order to prevent break of compatibility.

Change-Id: I0aa65ea28082cf4a88c383ce0d8eceaa5288c027
Signed-off-by: Grigoriy Kraynov <grigoriy.kraynov@intel.com>
2013-08-12 16:31:10 +04:00
Andrew Hsieh
09073f3d88 Add minimal supports to build multilib x86 toolchain with OpenMP
Change-Id: I095c15d2a2de11992890c2a03be0f90332d372de
2013-08-02 17:06:40 +08:00
Andrew Hsieh
65675341ac Add TCP_INFO state enum values.
See b.android.com/38881 and fix in bionic
0dff43cab41e4a0bd5bd018584952c68cb224977

Change-Id: I2417fe3cf43919bf363f36c337ea6813f13699d8
2013-07-29 20:15:57 -07:00
David 'Digit' Turner
fe8625d401 ndk: Fix WCHAR_MIN / WCHAR_MAX definitions.
This fixes WCHAR_MIN / WCHAR_MAX to be signed / unsigned based on
the target ABI.

This only impacts ARM where wchar_t is really 'unsigned int'.
One can define _WCHAR_IS_ALWAYS_SIGNED to restore the old behaviour.

See http://b.android.com/55749

Change-Id: Idb63b7b11aecd3cfee37f5b6dd2eba78b308876f
2013-07-20 00:56:53 +02:00
Andrew Hsieh
56de69b35b Merge "ndk: <sys/cdefs.h>: make wchar_t 32-bit for all API levels." 2013-07-08 22:59:16 +00:00
David 'Digit' Turner
f85e243cdb ndk: <sys/cdefs.h>: make wchar_t 32-bit for all API levels.
This patch ensures that wchar_t is a 32-bit number when targetting
API level < 9 (i.e. Froyo or older).

You can restore the previous (and broken) behaviour by defining
_WCHAR_IS_8BIT at compile time. See http://b.android.com/57267
for more context.

BUG=57267

Change-Id: Ib334e8fe95a3f592d5d4bb157b0f123984133597
2013-07-04 16:30:41 +02:00
David 'Digit' Turner
530a3ca575 Fix <inttypes.h> declaration for pointer-related PRI/SCN macros.
This ports the following Bionic libc fix to the NDK header:

  https://android-review.googlesource.com/#/c/61703/2

BUG=57218

Change-Id: I0c5fef17f0c1bb3a89c00edf51f494cbf7bda435
2013-07-03 15:13:49 +02:00
Andrew Hsieh
f56a37e539 Fix wchar.h not to redefine WCHAR_MAX/WCHAR_MIN
Change-Id: I6c6f2e020b72cce4c8665133ea0a0c5db977e348
2013-06-21 11:11:35 -07:00
Andrew Hsieh
9100913446 Merge "stdint.h header is not fully compatible with C99(ISO9899:1999)" 2013-06-19 20:30:02 +00:00
David 'Digit' Turner
bb37dac9fa Fix malloc_usable_size() declaration.
This doesn't break the ABI.

See https://android-review.googlesource.com/#/c/59195 for corresponding
fix in the C library.

See http://b.android.com/55725 for details.

Change-Id: Id01e38ef7951368897b9bbaae09741fa927fd548
2013-05-23 10:08:44 +02:00
Andrew Hsieh
3c10a2037e Fix sys/un.h to be included on its own
See https://code.google.com/p/android/issues/detail?id=53711
https://android-review.googlesource.com/#/c/42763

Change-Id: Ibd8a445dfde752cddab61b3ae53ad077738701ea
2013-04-01 14:02:06 +08:00
Andrew Hsieh
3ccf4f2c03 Deprecate __set_errno; Add #include <stdint.h> in elf.h
1. __set_errno is deprecated and subject to removal in future release
2. elf.h is seen to be included alone, causing compilation error due
   to undefined uint32_t and uint64_t

Change-Id: I4ca348a8ba0689eb3880622dcf5c53be470c57e8
2013-03-27 10:44:19 -07:00
Andrew Hsieh
c4e201a35c Added struct Elf32_auxv_t and Elf64_auxv_t
See https://code.google.com/p/android/issues/detail?id=38441

Change-Id: If06ec47d4e15639461c044248e3fe0020748b305
2013-03-13 19:21:56 -07:00
Sergey Melnikov
e3b1ac14bd stdint.h header is not fully compatible with C99(ISO9899:1999)
1. stdint.h doesn't provide macros:
  * SIG_ATOMIC_MIN
  * SIG_ATOMIC_MAX
  * WCHAR_MIN
  * WCHAR_MAX
  * WINT_MIN
  * WINT_MAX
2. stdint.h provides macros with incorrect type:
  * UINT8_C
  * UINT16_C
  * UINT8_MAX
  * UINT16_MAX

Change-Id: I3f4da907eaee8f46d8eb956950230ca2eb04a3ea
Signed-off-by: Sergey Melnikov <sergey.melnikov@intel.com>
2013-01-17 09:58:16 +04:00
Andrew Hsieh
bbff7fbd64 Sync stddef.h
To be the same as bionic's.  See
ec37237d69289e2bb9836bfa0d071ab958234d00

The new one also no longer undef offsetof and replaces it with
"((size_t) &((TYPE *)0)->MEMBER)" if __compiler_offsetof isn't
defined.  The problem with the old behavior are that
1. __compiler_offsetof isn't defined in linux/compiler.h even though
   all Android compilers support __builtin_offsetof
2. As as result, offsetof defined in stddef.h to use __builtin_offsetof
   is undefined and replaced here.  Problem is,
   "((size_t) &((TYPE *)0)->MEMBER)" isn't considered a compile-time
   constant, and fails some code expect offsetof to be.

Change-Id: I3ebb0de9e1d95305a0890a099360ff6936d24b2f
2013-01-09 17:33:13 +08:00
Andrew Hsieh
8e84a15fed Merge "Sync sys/limits.h and sys/sysconf.h" 2013-01-03 10:34:13 -08:00
Andrew Hsieh
75d889ea23 Sync sys/limits.h and sys/sysconf.h
See http://code.google.com/p/android/issues/detail?id=39680
and a55f63083fb16b2595f517a3260083e5f8cddd02

Change-Id: I2d1548814eb771c26b540f5fee57dabf54fcfdd6
2013-01-03 12:28:48 +08:00
Andrew Hsieh
d693e84421 Sync fenv.h
See See 0f7809d5c364565e210554ca2b5d8eedf8a57ec7
90e10d41c4271a5d517f60f4ff1d2891b8ccc034

Change-Id: Id59b6c24f74f03f7d4b0c420fdb59fb2ab98be0d
2013-01-03 12:12:39 +08:00
Andrew Hsieh
54e2794aba Add binaries to bootstrap GCC build with OpenMP
With --enable-libgomp, gcc/gcc-4.4.3/libiberty/configure line #2124 tries
to link a trivial program but fails w/o the presence of libc.so and libdl.so
and sets "gcc_no_link=yes" at line #2131.  Confiugre later fails with
cryptic message reads "Link tests are not allowed after GCC_NO_EXECUTABLES."

See
  https://android-review.googlesource.com/#/c/34491, 48617, and 48619

Change-Id: I6e761c5fb12f413dca04a26b39f27e9f026d75d3
2012-12-26 15:11:56 +08:00
Andrew Hsieh
7c9e2c6851 Fix wint_t in android-3 and android-8 to be consistent with android-9
Change-Id: Ia36557bfc6d1155ba8106c26bb3fd3c226ad779e
2012-12-24 14:14:55 +08:00
Andrew Hsieh
7980acf254 Remove duplicated definitions of size_t and ssize_t
See 3975cec694a0c9b42e3f7e671fcd678da92836c3

Change-Id: Ia40ff8de3ffe923fb983bb116b740942724c641a
2012-12-21 22:29:26 +08:00
Andrew Hsieh
9ca4e48605 Sync pthread.h and resolv.h
See 9831ad3ce6bd5b22da16a275ed67e7236eae3d1f and
23d3e6b21b4b6debff87da8c6558495e564cc38e

Change-Id: I22c7bbda1cd763e5f67410cc2e4054292e71af04
2012-12-20 19:08:54 +08:00
Andrew Hsieh
ab13dd0e7a Fix <endian.h> and <sys/endian.h>
See 4fa35d8ae80c175425e9525831d7b6a71a3ada60

Change-Id: Ia14386f2e762fd7c0a1fc8f3e7cf8c0ce05b1dd5
2012-12-12 10:04:53 +08:00
Andrew Hsieh
aa33ae38ae Merge "Refresh endian.h" 2012-12-05 21:28:13 -08:00
Andrew Hsieh
ef48154850 Fix a ENOTUP/ENOTSUP typo
See ecb53eab4b63a777c189f880e7f88ebbe0e8101b

Change-Id: Id0cd72f3ccc6e4ecb1bd57045e2f46be234378fa
2012-12-05 13:05:15 +08:00
Andrew Hsieh
7361c3c7bb Refresh endian.h
See http://code.google.com/p/android/issues/detail?id=39824
and b15c58bb0fe55f076751acd7a5d00ded0ec33963

Change-Id: I71858f6d15adb688e0b05685e55582f0f1ddae54
2012-12-05 12:42:18 +08:00
Andrew Hsieh
279fe064b1 Refresh header byteswap.h and dirent.h
Sync with bionic.  No new APIs.

Change-Id: Ie1f71d1c56ce2d0574d8b743f205115d2fbc68b4
2012-11-21 14:17:01 +08:00
Andrew Hsieh
2eb9332422 Fix limits.h to include page.h which provides PAGE_SIZE
See 6331db3fd251ddc350913cc1e8a7941740c25f63 and
http://code.google.com/p/android/issues/detail?id=39983

Change-Id: I85083d754fe9b722efcb8ea73f17d88d505c90d1
2012-11-20 16:14:06 +08:00
David 'Digit' Turner
db5a5ada90 ndk: Remove LONG_LONG_MIN/MAX hack from pthread.h
The LONG_LONG_MIN, LONG_LONG_MAX and ULONG_LONG_MAX are
GLibc-specific macros. Move their declarations from
<pthread.h> to <limits.h> where they belong.

Change-Id: I597465b99893706ade82069238f60df73d8e236e
2012-10-16 09:49:10 +02:00
Andrew Hsieh
36ffaf5406 Replace __unused in linux/sysctl.h with __linux_unused
To avoid conflict with "#define __unused" in sys/cdefs.h

See
  https://android-review.googlesource.com/#/c/43479
  https://android-review.googlesource.com/#/c/43565

Change-Id: I6b8155570f4398b3ee8845d75bd231bca7f1d86f
2012-09-26 15:11:39 -07:00