Bionic (software)

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Bionic
Developer(s) Open Handset Alliance
Initial release September 23, 2008; 6 years ago (2008-09-23)[1]
Operating system Android[2]
Platform x86, x86-64, ARM, ARM64, MIPS, MIPS64
Type C standard library
License 3-clause BSD licence

Bionic is the standard C library (including libc, libdl, libm, and libpthread) developed by Google for their Android[2] operating system.

Overview[edit]

Publicly stated goals for Bionic were the following:[3][4]

  • The BSD license is a non-copyleft license and Google wished to isolate Android applications from the effects of both the GPL and the LGPL:
  • Small size: Bionic was much smaller than the GNU C Library; more importantly its memory requirements were (and remain) much lower.
  • Speed: Bionic was designed for CPUs at relatively low clock frequencies.

Some parts of the libc source, such as stdio, are from the BSDs (mainly OpenBSD), whereas others, such as the pthread implementation, were written from scratch. The dynamic memory allocator is jemalloc (though it used to be dlmalloc). The libm source is largely FreeBSD's, but with optimized assembler from the various SoC vendors. The dynamic linker (and libdl) were written from scratch. Bionic doesn't include libthread_db (used by gdbserver), but there's one in the NDK; Android uses a statically-linked gdbserver so developers can use the latest gdb even on old devices.

Bionic only supports Linux kernels, but currently supports the aarch64, arm, mips, mips64, x86, and x86-64 architectures.

Platform code uses bionic directly, but third-party developers use the Android Native Development Kit (NDK). Many third-party developers still target Gingerbread, leading to a widespread belief that bionic is missing a lot of features (bionic in Lollipop contains over 200 functions missing from bionic in Gingerbread).

The Android platform uses libc++ for the C++ standard library. The NDK currently offers stlport, libc++, and the GNU STL.

Differences from POSIX[edit]

Although bionic aims to implement all of POSIX, there are still (as of Lollipop) almost 200 functions missing (though the long double complex math functions make up a large chunk of that). There are also POSIX functions like the endpwent/getpwent/setpwent family that make no sense on a system without a passwd database, that aren't implemented because any code that's trying to use these functions.

_FORTIFY_SOURCE[edit]

As of Android Jelly Bean MR1 (4.2), bionic builds used in Android include support for glibc's _FORTIFY_SOURCE,[5] which is a feature where unsafe string and memory functions (such as strcpy() strcat() and memcpy()) include checks for buffer overruns when buffer sizes can be determined at compile time. This feature is only available for applications compiled with gcc for ARM processors.[6]

See also[edit]

References[edit]

  1. ^ "Announcing the Android 1.0 SDK, release 1". September 9, 2008. Retrieved September 21, 2012. 
  2. ^ a b "Android Anatomy and Physiology" (PDF). Google I/O. 2008-05-28. Retrieved 2014-05-23. 
  3. ^ Burnette, Ed (June 4, 2008). "Patrick Brady dissects Android". ZDNet. 
  4. ^ Turner, David (2009-02-07). "Questions about Bionic". The name "Bionic" comes from the fact that it is part-BSD and part-Linux: its source code consists in a mix of BSD C library pieces with custom Linux-specific bits used to deal with threads, processes, signals and a few others things. 
  5. ^ "Jelly Bean". Android Developers. android.com. Retrieved 2013-12-27. 
  6. ^ "Android 4.2 and FORTIFY_SOURCE". Android Security Discussions. groups.google.com. Retrieved 2013-12-27. 

External links[edit]