Commit Graph

93 Commits

Author SHA1 Message Date
Elliott Hughes
52e68cd202 Remove "sha1.h".
This was removed from bionic by commit c82c0b7e072491da4818e7de37411fbb2055fce1
in 2014-06. The symbols are still in NDK cruft for LP32, but no longer in the
NDK's libc.so. Microsoft points out that we should probably remove the header
too.

Bug: 11156955
Change-Id: Id463f8f20d3d8c4428f6aecb317577d78ccad215
2016-01-25 09:34:33 -08:00
Dimitry Ivanov
11ae5ebfb6 Replace __page_size reference with PAGE_SIZE for android-12 and below
Also remove __getpageshift since it is not present in later version of
android (>12)

Bug: http://b/26475272
Bug: https://github.com/android-ndk/ndk/issues/1
Change-Id: I117194ede3b13a63ff020364b0f573fb25d5205d
2016-01-09 14:16:13 -08:00
Dimitry Ivanov
6bef207c7b Remove new set of LIBC_PRIVATE symbols from libc
Bug: http://b/26234924
Change-Id: If0acb2105c75bf9e6dd97230391f3944157990ae
2016-01-05 15:26:03 -08:00
Dan Albert
6e84c13895 Update byteswap.h from bionic to match endian.h.
Change-Id: I79e445a167800ce083039d0cb65c5a966d7e6a72
2015-12-09 19:17:28 -08:00
Dan Albert
616a494ec1 Update endian.h from bionic.
This consolidates the guts of the three endian.h files (endian.h,
sys/endian.h, and machine/endian.h) into just sys/endian.h, and turns
the others into headers that forward to it.

This also consolidates all the architecture specific machine/endian.h
files into a single generic header.

Finally, this is also the update version of sys/endian.h, which just
forwards to compiler builtins rather than implementing it ourselves.

Change-Id: Ifce64dc684ce3d3231f3f43a94c083bbd8661840
2015-12-08 14:20:25 -08:00
Dan Albert
c57abe4eb2 Always use the newest sys/cdefs.h.
This is all macros, so there's no reason to have one per API level.

This is still quite a ways from matching what we have in bionic, but
that's a problem for another day.

Change-Id: I804edfd6299d9ba15a3ba59e1091f301eace2142
2015-12-08 14:19:48 -08:00
Peter Collingbourne
c90758f420 Modify ctype.h headers to test for non-GNU inline semantics correctly
GCC and Clang will not define __GNUC_STDC_INLINE__ when compiling C++, so this
macro currently implies regular C++ inline semantics in C++. This may cause
the compiler to emit an external definition of the function, which will cause
link errors when compiling with -fvisibility=hidden; see e.g. crbug.com/481902.

To fix this, also test the __cplusplus macro when deciding whether to assume
non-GNU inline semantics.

Change-Id: Icbd1f42279c2f65610e62f21d4a0a09d3b0e091c
2015-05-13 17:41:18 -07:00
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
b6f18dba42 Fix headers to be included alone
Change-Id: I7eb9a6ed51b938506d440b91e6b3d42daf817fd7
2014-11-17 09:54:27 +08:00
Andrew Hsieh
d3ab539366 Change sysconf(3) to return long
See bionic 60d84af1726225320b26683b726e5e735d9d76e8

BUG=18390956

Change-Id: I20c6aa48115610b35e1d59f9f37ce5abbe6ac2f7
2014-11-17 09:48:36 +08:00
Andrew Hsieh
c810b3ce7a Remove macros putc*/getc* from API<21 stdio.h to use
Macros putc, getc and their unlock cousins use internal functions and
variables not necessarily available in future libc.so (*1).  Remove macros
and use functions aleady exists in libc.so instead.

(*1) https://android-review.googlesource.com/#/c/110662/

Change-Id: I3faa2d74de40ef8376119b38f2a39d46ece47d07
2014-10-15 11:09:47 +08:00
Andrew Hsieh
ec2d5674a8 Merge "Bump up clang vesion accepting __builtin_isnan __attribute__((pcs("aapcs")))" 2014-09-29 01:20:12 +00: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
9eac1b60d3 Added sys/ucontext.h and sys/user.h to all API levels.
Also
1. Header singal.h now includes <sys/ucontext.h>
2. asm/user.h include sys/user.h
3. change use of user_i387_struct to user_fpregs_struct

See bionic 26a8eb50a84e131d34d10d5d167d67e9995399bd

Change-Id: I9592e98b90d773ef5babb428a6a6ef208fe86327
2014-09-19 15:50:12 +00:00
Andrew Hsieh
83fb2f6940 ptrace(3) should be varargs
See bionic 98b088dce70a2625d5cfa1872e427af5f06bfd99

Change-Id: I9e1993aa41fb8309beb1d653d48c5aacad44e4cd
2014-09-04 13:11:20 -07:00
Andrew Hsieh
6c2d94dfcf Add __gnuc_va_list in stdio.h to stop gcc from generating include-fixed/stdio.h
When GCC is built bionic's stdio.h (among other headers) is fixed: __va_list
is replaced with __gnuc_va_list, and put in include-fixed/stdio.h,
unless stdio.h already contains __gnuc_va_list.  When GCC is later
used bionic's stdio.h is never included.

The problem in the context of NDK is that all 32-bit Android toolchain
are built with android-9 header and expect to work with all API levels
sometime with sustantially different stdio.h.

This CL stops GCC from generating include-fixed/stdio.h by putting
__gnuc_va_list in it.

See bionic df85f50b and b.android.com/73728

Change-Id: I7a490496efbd491a0376608b9ae6e9e2dfc15fb3
2014-09-04 13:00:28 -07:00
Andrew Hsieh
9983b467e5 Fix ssize_t, WCHAR_MIN and WCHAR_MAX
1) ssize_t is int, instead of long int
2) WCHAR_MIN and WCHAR_MAX be consistent with bionic's:
   respond to __WCHAR_UNSIGNED__, work for both signed (X86/MIPS)
   and unsigned (ARM) wchar_t, and work for -fshort-wchar too

Change-Id: Ief1be007571b50c5d63a819df489f9d3f9b47bc8
2014-06-10 10:51:46 +08:00
Andrew Hsieh
e85f942ec6 Fix warning about undefined __LP64__
See b.android.com/69975

Change-Id: If7f2b6fa29c36221b1a0d31a334cb34cecb4e8bc
2014-06-02 14:44:19 +08:00
Andrew Hsieh
154e19fda6 Restore stdint.h for android-3..19 to the original headers
$NDK/tests/standalone/run.sh fail to run with last update on stdint.h
to android-20 level.  Restore stdint.h for fear of the new one breaking
the existing apps

Also fix signal_portable.h to use SIGRTMIN/MAX in old headers
(which got renamed to __SIGRTMIN in new header)

Also change _JBLEN to 1024 which shall be large enough to store CPU
states for forseable future.

Change-Id: Ia9c03558a258c10434eb8e6985adc122532feaa3
2014-05-12 12:14:33 +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
Andrew Hsieh
497b94df02 Merge "Headers update from bionic for x86_64 support" 2014-04-02 08:21:49 +00:00
Pavel Chupin
e54e92427d Headers update from bionic for x86_64 support
* Add i386/elf_machdep.h, it is used during the build of 32-bit part of
multilib compiler;
* Remove page.h. See https://android-review.googlesource.com/#/c/83299;
* Update other x86 headers from bionic for compatibility which are
required for successful build;

Change-Id: Ia66301849e699b79c657146424a806d0aa22342b
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2014-03-25 19:22:22 +04:00
Pavel Chupin
ac612d2495 Move _types.h to 32-bit arch dirs to avoid impact on 64-bits
This change moves _types.h from common area to all 32-bits archs.
Required for successful NDK build.

Change-Id: Ife676a285f4b77aef4c33e465a0dbc7cab1481a3
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2014-03-25 19:21:34 +04:00
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
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
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