Commit Graph

80 Commits

Author SHA1 Message Date
David 'Digit' Turner
6c32dacf97 ndk: Fix <sys/atomics.h> declarations.
The atomic operations exported by the platform's C library do not
provide full memory barriers. This can result in incorrect results
when NDK machine code linked against them runs on multi-core devices.

While the bug has been fixed in the platform, this NDK header change
ensures that any source code that includes <sys/atomics.h> will end
up using a correct implementation of these functions, based on the
corresponding GCC builtins.

These builtins always provide a full barrier and have reasonable
performance. Application developers who depend on <sys/atomics.h>
should recompile their unmodified sources against this version
of the NDK as soon as possible.
2012-04-02 15:59:46 +08:00
David 'Digit' Turner
5704b40d70 ndk: minor update to <netinet/...> headers.
This patch contains a minor update to the netinet headers from the C library.
Most of the changes come from later platform release, but can be safely back-ported
to previous API levels since they don't change the ABI:

- <netinet/icmp6.h>, <netinet/ip6.h>: new headers
- <netinet/in.h>: now always include <linux/ipv6.h> by default
- <netinet/in6.h>: add macros: IN6_IS_ADDR_ULA, IN6ADDR_LOOPBACK_INIT
- <netinet/ip.h>: add macro: IPTOS_MINCOST
- <net/if_ether.h>: always include <sys/types.h> by default.
2012-04-02 15:31:20 +08:00
David 'Digit' Turner
554c5eca78 ndk: libc: Add RLIM_RTTIME to <asm-generic/resource.h>
This is a back-port of a fix that was performed in 4.0.1 to all previous platforms.
2012-04-02 15:14:10 +08:00
David 'Digit' Turner
34c6c855bc ndk: arm: Update <asm/ptrace.h> and <asm/user.h>
This is a minor update to two ARM-specific kernel headers.

- <asm/ptrace.h>: Add two new constants
- <asm/user.h>: Add 'struct vfp_user' and 'struct vfp_user_exc'
2012-04-02 15:11:02 +08:00
Martin Storsjo
6dd4b91b32 Make sure __u64 is defined even for strict ansi or -std=c99
The x86 asm headers define __u64 regardless of __STRICT_ANSI__.
The linux/videodev2.h header requires __u64 to be defined, thus
this fixes compiling with -std=c99 when including the
linux/videodev2.h header.

In glibc, the asm/types.h header defines __u64 regardless of
__STRICT_ANSI__.

This commit copies the updated header from bionic into the ndk
platform headers.
2012-01-27 17:54:02 +02:00
David 'Digit' Turner
7761beeb56 ndk: <time.h> Add missing clock_settime()/clock_nanosleep() declarations
Both functions are part of the C library since Android 1.5 / API level 3
but were missing a declaration in <time.h>, so add then here

+ Fix first parameter from 'int' to 'clockid_t' for clock_getres()
  and clock_gettime()

Fixes http://code.google.com/p/android/issues/detail?id=20140

Change-Id: Ic2191d5eb54475c149b9a6b8f3ba55bc8ed4643f
2011-10-12 03:43:29 +02:00
David 'Digit' Turner
085e2b14d5 ndk: remove obsolete libthread_db.a binaries
We don't use these since NDK r5, since we now provide
customized versions of the library under
$NDK/sources/android/libthread_db

Change-Id: I2e3103b85c14e75a00ba9cece7a872d2156f5ef9
2011-10-12 03:07:48 +02:00
David 'Digit' Turner
c63ce7a143 ndk: remove obsolete <android/api-level.h> headers
These are now auto-generated by the gen-platforms.sh NDK script

Change-Id: I5a38e956b58a34c5db96e24f2a46bc1ca1554376
2011-10-12 03:07:48 +02:00
David 'Digit' Turner
e872f4e101 ndk: Remove obsolete platform files
Remove the prebuilt system shared libraries and unified symbol files
from development/ndk. We don't need them anymore:

  - the unified symbol files are replaced by separate functions/variables
    symbol list, which were added in a previous commit, i.e.:

	libc.so.txt  --> libc.so.functions.txt
	                 libc.so.variables.txt

 - the shared libraries are now generated on the fly by the NDK
   gen-platforms.sh script, from the functions/variables symbol lists.

Note that we need to keep the static libraries and runtime objects,
they are required to build the cross-toolchains and target binaries.

Change-Id: Ifa0a7f2d741ed32b80216561ca3f17e67df06ce9
2011-10-10 21:52:17 +02:00
David 'Digit' Turner
02053eb7a1 ndk: separate functions and variables symbol lists
This change introduces separate symbol lists for functions
and variables of each NDK system shared library.

Note that we don't remove the unified symbol files yet. This
will be done later when we complete other changes under ndk/,
namely the ability to generate platforms trees containing shell
libraries generated directly from them.

These files were generated using the following:

  cd development/ndk
  for DIR in platforms/*/*/lib; do
    for ARCH in arm x86; do
      $NDK/build/tools/gen-system-symbols $DIR $DIR/../symbols
    done
  done

This means that the symbol lists were generated by parsing the
existing prebuilt shared libraries under platforms/ and extracting
their function and variable names.

Change-Id: Ie1e791d98260a7f0d8d2e9f71323a7ea448f2dd4
2011-10-10 21:52:09 +02:00
David 'Digit' Turner
bb3784d646 ndk: update JNIEXPORT declaration in <jni.h>
This patch updates the definition of JNIEXPORT in <jni.h> to
use the "default" ELF visibility attribute for JNI_OnLoad and
any function that uses the macro for its definition.

This is handy when a developer wants to use hidden visibility
by default by using a compiler flag like -fvisibility=hidden
in its Android.mk or custom build script.

Change-Id: I95112932731216a9a4986820a1875edfb3f52e5b
2011-08-23 16:08:17 +02:00
David 'Digit' Turner
cd181903b5 ndk: arm: also update other CRT runtime objects.
Turns out that updating crtbegin_so.o and crend_so.o is not
enough for the standalone toolchain. We also need to update
the object files used to generate static and dynamic
executables.

This fixes the standalone toolchain NDK tests.

Change-Id: Ibf113b09766f00b30895951a5639343728be3f3a
2011-07-15 05:21:36 +02:00
David 'Digit' Turner
a062ad61b0 ndk: Fix android-3/arch-arm crt{begin,end}_so.o
Turns out that the previously commited versions of these files do not
allow for proper linking with a patched toolchain. With -shared, gcc complains
that:

    .preinit_array section is not allowed in DSO

So use the versions from android-9/arch-arm instead, which seems to work fine.

Change-Id: I9aeaab449ddad058451c7d6493c983ab2ed1c4eb
2011-07-14 08:15:16 +02:00
David 'Digit' Turner
75cedfadcd ndk: Add crtbegin_so.o / crtend_so.o to android-3
This change adds crtbegin_so.o and crtend_so.o under
platforms/android-3/arch-arm/lib.

This is in preparation of another toolchain patch that will require
these files for all platform versions (for now, they are only defined
starting from android-9).

Note that these files are just copies of the existing ones, named
crtbegin_dynamic.o and crtend_android.o respectively.

The NDK build script will automatically use the new files if it finds
them, so shouldn't need to be updated.

Change-Id: I6a446266b54b871cd957dfd737054b302678b2d3
2011-07-14 05:51:31 +02:00
David 'Digit' Turner
3e1498c4c4 ndk: x86: Sanitize platform headers and libraries.
This change sanitizes the x86-specific platform headers and libraries.
It does two things:

- Remove the stuff under android-3/arch-x86

- Update the content of android-9/arch-x86 from a recent AOSP
  full_x86-eng build (see caveats below).

Some files appear to move because they didn't change (e.g. kernel headers).

This change was generated by following these steps:

1/ Build full_x86-eng from the AOSP tree

2/ From $ANDROID_ROOT/ndk, run:

   build/tools/dev-system-import.sh --direct --arch=x86 9

3/ Under $ANDROID_ROOT/development/ndk, do:

   git rm -r android-3/arch-x86
   git add android-9/arch-x86
   git checkout -- android-9/include
   git ls-files -o | xargs rm
   git commit

IMPORTANT:
   The AOSP tip-of-tree used to generate these files
   includes post-Gingerbread changes !!

   The final version of the android-9/arch-x86 files will have to
   be generated from the gingerbread branch after we back-port all
   x86-support changes to it.

   These binaries are thus not final, but can be used to generate
   working experimental NDK packages, including prebuilt GNU libstdc++
   and STLport binaries that implement -fstack-protector correctly.

Change-Id: I260896185a098b9b356bd26f492692e4a4f66f8f
2011-05-27 06:14:16 +02:00
David 'Digit' Turner
509176259d ndk: Update libc.a to Gingerbread version.
This updates the static C library version provided with
the NDK to the version from the AOSP gingerbread-release
branch, more specifically using the platform/bionic.git SHA1 of:

    3f14ff34dfbd00fcffb18b10a1a3e17e2cc5ebdf

This file is only used to rebuild a gdbserver binary. This version
contains changes necessary to fix gdbserver crashing issues on
certain Honeycomb devices.

You will need to rebuild the NDK gdbserver binary after this patch
is submitted (see build/tools/build-gdbserver.sh --help).

Change-Id: Iab7ff707a9bdbdca0d0fd017178e25da9d48e43d
2011-05-24 03:56:38 +02:00
David 'Digit' Turner
9ad28785ba Fix pwrite() declaration in NDK platform headers.
The corresponding fix is already in the Bionic libc source tree.

See http://code.google.com/p/android/issues/detail?id=8908

Change-Id: Id1329f996cd6708e46f48d33d998b8b3d26bf5d7
2011-03-15 16:30:35 +01:00
David 'Digit' Turner
c7d8870875 ndk: Fix stdint.h definitions for C++
Fix the stdint.h header for C++ inclusion. The limit and constant related macros
should only be defined if __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS are
defined, respectively.

Change-Id: I85b00ed857f40b9c17d530f1405f0f098c5f10f3
2011-03-11 14:42:12 +01:00
David Turner
0b80c5e83c am d2454506: Merge "Move files to proper location in development/ndk/platforms"
* commit 'd24545065acbacc7e9f1482f08013a4046640ad7':
  Move files to proper location in development/ndk/platforms
2011-02-28 09:13:43 -08:00
Bruce Beare
a9b5a9d315 Move files to proper location in development/ndk/platforms
Change-Id: I1b001e7b8c878bfc7213556f19c6812d64d46ef3
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-02-09 08:58:48 -08:00
David 'Digit' Turner
cbc7f69548 ndk: Replace 'asm' with '__asm__' in <asm/byteorder.h>
See https://review.source.android.com/#change,20076 for details.
Essentially this is to allow compilation with -std=c99

Change-Id: I4c830c38b2615352765ee40773c5aa701e5d2b68
2011-01-05 23:08:29 +01:00
Martin Storsjo
80736a1bca Use __asm__ instead of asm in public libc headers
If compiling userland code with -std=c99, the current header produces an
error. The content of this header originally is a kernel internal header,
where asm() is acceptable. In a header visible to userland, this should be
__asm__ instead.

This change is done for all newly extracted headers by the extraction
script, by https://review.source.android.com/19406, which was recently
merged.

Change-Id: I69332124a56577673a14e84cd7d9a4462c307724
2010-12-28 21:47:03 +01:00
David 'Digit' Turner
9ddaf219fa Add missing declarations to <netinet/in.h>
These are required to properly build the Boost libraries with the
Android NDK.

Change-Id: Ice272f24b359ffce19838f5500641c4fcda8e57f
2010-12-14 14:42:52 +01:00
David 'Digit' Turner
1e7011fcd5 ndk: Add auto-generated <android/api-level.h>
See ndk.git/build/tools/dev-generate-api-levels.sh

Change-Id: Id64e565e7da6bf23f4bfa0fca52a06dbfe843c37
2010-11-22 22:38:57 +01:00
David 'Digit' Turner
3c7c38b2bb NDK: Last cleanup of the platform headers
- fix a declaration omission in 3/<grp.h>
- add missing 8/<err.h>
- simplify 8/<stdio.h>
- update 9/ headers to the latest Bionic versions
- fix a typo in android_native_app_glue.h
- use __BEGIN_DECLS .. __END_DECLS whenever possible.
- remove C++-style comments from headers

Change-Id: I58b98b3973cde494436206194ba33416a11ca8ee
2010-11-04 04:07:16 -07:00
David 'Digit' Turner
10795d840b Declare localeconv() in <locale.h>
The function is not implemented by our C library, but it is not
possible to build GNU libstdc++-v3 if the declaration is not part
of this header.

Change-Id: Iff6fa63465dde0d4e38c0f91709475bb35b31af9
2010-10-28 17:39:11 -07:00
David 'Digit' Turner
7c2ba504e9 ndk: remove undefined symbols from system headers
This change removes the declaration of functions that are not
implemented by our various versions of our C library.

The corresponding declarations are moved inside #if 0 .. #endif
blocks (so it becomes easy to remember that they are missing)

Also refresh the headers a little (i.e. adding a few missing decl
and macros, remove C++ comments, etc)

See http://code.google.com/p/android/issues/detail?id=7807

Change-Id: I4ae1b1f3a181419eee2004c41b54768cc15e896f
NOTE: The missing decl are still there but encased in #if 0 .. #endif
      blocks (to make it easier to implement them later). There are
      a few exceptions in order to build STLport and libstdc++-v3
      properly.
2010-10-08 17:07:39 +02:00
David 'Digit' Turner
7012117d4a Unify NDK platform headers.
This commit removes duplication of system headers per platform, i.e. remove
copies of common headers like <stdlib.h> from arch-arm/usr/include and arch-x86/usr/include
and move them to a common include directory. More specifically:

- common headers:        android-N/arch-A/usr/include --> android-N/include
- arch-specific headers: android-N/arch-A/usr-include --> android-N/arch-A/include
- arch-specific libs:    android-N/arch-A/usr/lib     --> android-N/arch-A/lib

Change-Id: Ifdba5038d108901931f3e3a7c14ebe6270d2d276

NOTE: This also contains careful separation of API-level-specific headers.
      For example, platforms/android-5/include/pthread.h contains new function
      declarations that are not available when using platforms/android-3/include/pthread.h

NOTE: The NDK's build-platforms.sh script has been updated to understand the new
      layout. This change in develeopment/ndk does not change the layout of
      platform files under $NDK/platforms after build-platforms.sh is called.
2010-09-22 18:04:36 +02:00
David 'Digit' Turner
74ff6746d1 Remove C++ headers from the platform directories.
We now rely instead on the content of $NDK/sources/cxx-stl/system/include
that is automatically used if a module has C++ sources.

Change-Id: I4319d9260fcf9fb31c59c2f21ca64b536725d4f5
2010-07-07 12:57:25 -07:00
David 'Digit' Turner
c817c5210e Copy platforms and samples from ndk/ source tree.
The idea is to allow developing the NDK in the open, while
having the platforms and samples under a private branch until
the corresponding release are open-sourced.

Change-Id: Iee995fb6c4d3ee1387dea7486e599e079c9e4c6d
2010-06-09 17:02:09 -07:00