summaryrefslogtreecommitdiff
path: root/libc/include/android
AgeCommit message (Collapse)Author
2021-02-11Rename __ANDROID_UNGUARDED_AVAILABILITY__ -> ↵Elliott Hughes
__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__. Also reduce some of the duplication in the macros. Bug: http://b/179067538 Test: treehugger Change-Id: I81ab341731b0faad6c7c5f00037feff8576abafb
2021-02-01Fix __VERSIONER_NO_GUARD cases for availability.Dan Albert
libc++ still depends on these being declared even if they are unavailable. This results in a worse error message (a link error rather than a compiler diagnostic) if these functions end up being used, but without the decl headers like libc++'s math.h can't be included because it refers to an undeclared function. For the cases where weak symbols aren't being used, don't annotate these functions with their availability information. Also need to avoid using __builtin_available for this case because the NDK doesn't have __isOSVersionAtLeast yet. __ANDROID_UNGUARDED_AVAILABILITY__ is being used as a proxy for "building for the NDK" here because we don't have a good signal for that which works for both the NDK proper and the NDK-in-the-platform case. Test: imported into the NDK, built and tested NDK Bug: None Change-Id: I9ef3e19a8fa083bca0be47b80dfef7ba52a94866
2021-01-15Guard __libc_current_sigrtmin/max with __builtin_availableJiyong Park
The two APIs were added for the API level 21 and beyond. Currently, its existence is tested using the null check which is done regardless of the min sdk version of the compilation unit. (which in turn required us to mark the API symbol weak regardless of the min sdk version.) Now, we have a better way of testing the API availability; __builtin_available. The null check is replaced with the call to the compiler-provided macro which determines if the code is running in a version of OS where the API is known to exist. Bug: 150860940 Bug: 134795810 Test: m Change-Id: Ib96c78f8d3cc71d7e755d1eab86051517bbbcc44
2021-01-15__INTRODUCED_IN macros add the availability attributeJiyong Park
__INTRODUCED_IN (and its variants) macro is used to mark the availability of an API symbol. The macros were used by the versioner tool for the NDK clients. When the Bionic headers are processed by the tool, APIs with the macros are guarded with __ANDROID_API__. e.g., void foo() __INTRDUCED_IN(30); is processed into \#if __ANDROID_API__ >= 30 void foo(); \#endif by the versioner. The macros however didn't play a role for other cases, e.g. OS components. This is too strict for NDK clients and too loose for the non-NDK clients. For the former, this completely hides the APIs that are newer than the min sdk version (__ANDROID_API__). For the latter, a call to such an API can be made without being guarded. This change is the first step towards a better way of handling the native APIs availability. The plan is that every NDK APIs are annotated with the availability attribute and callers are required to guard their API calls with a runtime check if the API is newer than the min sdk version of the caller. In this change, the macros now emits the availability attribute for the non-NDK clients (i.e. when not processed by versioner). Bug: 163288375 Bug: 134795810 Test: m Change-Id: I6eb2bce2bc2770cbfd69815e6816b6f25b3d6127
2021-01-07Fix things so that <features.h> can be used from assembler again.Elliott Hughes
Bug: https://github.com/android/ndk/issues/1422 Test: builds Change-Id: I1b94ffe688f3d420533074c94f7ffed606ca923f
2020-08-11Add api-level.h to dac, improve docs.Dan Albert
We don't list most of bionic on dac since it would be overwhelming for the current layout, but this file in particular seems useful, especially __ANDROID_API__. Unfortunately, c2devsite doesn't include macro documentation. Until then, it's still useful to include the functions defined in this header. I've also elaborated a bit in the __ANDROID_API__ documentation, since the existing phrasing led to confusion over whether it was closer to minSdkVersion or compileSdkVersion. In practice these are identical for the NDK, but if we switch to weakly-linked APIs via the availability attribute that would change. Test: built docs, looked at them Bug: None Change-Id: I5cf78a6143b5c15790c369bdf888611e4c1189db
2020-08-07Make swab(3) inline prior to API 28.Dan Albert
Test: make checkbuild Bug: https://stackoverflow.com/q/54392471/632035 Change-Id: Iaeb55231ea2395d7e1e31be63034f5db19025060
2020-07-31More cleanup for #inclusivefixit.Elliott Hughes
Found manually with grep, since the script seems to miss stuff. Test: treehugger Change-Id: I5933cbade9792801d4a0bec1ccb077efa6ad8fbc
2020-04-09Add API constant for S.Dan Albert
Test: treehugger Bug: http://b/152037166 Change-Id: I9039377e80574cd59e13726a12072fe3002df67d
2020-03-26Add ffsl(3), ffsll(3).Elliott Hughes
POSIX added these GNU extensions for issue 8. I've made these always inline without the usual "until API level X" proviso because they're single instructions that the compiler can inline and there's really no point providing these if they add function call overhead --- everyone should just use __builtin_ffs() and friends instead in that case. Bug: https://austingroupbugs.net/view.php?id=617 Test: treehugger Change-Id: I33fc4b8648ea25917329e81c1b4c60eb9a66d667
2020-02-13Clean up mips references in the headers.Elliott Hughes
Test: treehugger Change-Id: I1997af980b9e46c7c530f9e6cb1aa407b2d63d76
2020-02-11Clean up the math headers.Elliott Hughes
I had hoped that this would then let us remove more of the "introduced in" annotations, but it looks like that's not really going to happen until the NDK's minimum supported API is 21. Also remove a .c file that wasn't referenced anywhere. Test: treehugger Change-Id: I8b4a61c082293f8445195a4fa5ee30595d70444e
2020-01-30versioner: don't require mips headers.Elliott Hughes
If we remove the mips uapi headers, versioner fails because it assumes they're available. We'll need a new versioner prebuilt beforre we can remove the libc/versioner-dependencies/mips* symlinks. Test: treehugger Change-Id: Ife6df0cb57938f806a31ec334d648df9694c3d17
2020-01-09Consistent <termios.h> behavior on all API levels.Elliott Hughes
Bug: https://issuetracker.google.com/146886722 (where the difference was noticed) Bug: http://b/69816452 (most recent fixes) Test: treehugger Change-Id: I487399c44f63ba276ccde74bf0c4a01e4cd4f4bf
2019-12-23versioner: Add __VERSIONER_FORTIFY_INLINELogan Chien
This commit adds `__VERSIONER_FORTIFY_INLINE` to fortify overload functions. Fortified functions are always overloaded and are likely to be different from `libc.map.txt`. Bug: 118991081 Test: source development/vndk/tools/header-checker/android/envsetup.sh && \ source build/envsetup.sh && \ lunch aosp_arm64-userdebug && \ m versioner && \ ./bionic/tools/versioner/run_tests.py Change-Id: I28903d0f039d74a07eb2833c754ff017335bac95
2019-12-23versioner: Only enable annotation while running versionerLogan Chien
Bug: 118991081 Test: source development/vndk/tools/header-checker/android/envsetup.sh && \ source build/envsetup.sh && \ lunch aosp_arm64-userdebug && \ m versioner && \ ./bionic/tools/versioner/run_tests.py Change-Id: Id6cc776f8ea27bf7230c7a63dd75445a99e5ba58
2019-12-20Stop using the __ANDROID_API_x__ constants.Elliott Hughes
Historically we've made a few mistakes where they haven't matched the right number. And most non-Googlers are much more familiar with the numbers, so it seems to make sense to rely more on them. Especially in header files, which we actually expect real people to have to read from time to time. Test: treehugger Change-Id: I0d4a97454ee108de1d32f21df285315c5488d886
2019-10-15Remove __ANDROID_NDK__ from bionic, and document our #defines.Elliott Hughes
__ANDROID_NDK__ is moving into the NDK's <android/ndk-version.h> instead. Test: treehugger Change-Id: I192016165a929547009d15dbcc30e8f6dad1ac88
2019-10-08Restore __ANDROID_NDK__.Elliott Hughes
At heart a revert of "Don't #define __ANDROID_NDK__ for the platform build!", which was commit eb6143037423a241ba8035304936149b300f7a5d. The original change was insufficiently motivated, and meant that the NDK -- not just the platform -- no longer defines __ANDROID_NDK__. Which then broke at least building toybox with NDK r19. Change-Id: Ic616688e4d17d25714a9ef381269d7431deac9b0
2019-08-29Support statvfs on API levels before 19.Elliott Hughes
Split statfs and statvfs. The former has been available forever, and the latter is implemented in terms of the former. The implementation has been moved into headers so that it can be used at low API levels. There's no reason for any Android or Linux code to use statvfs rather than statfs, but code that needs to build on Darwin too will want to use statvfs because Darwin's statfs is very spartan. Bug: https://github.com/android-ndk/ndk/issues/609 Test: treehugger Change-Id: Icf3d5723a260099fddb2d9f902e3047b0f041647
2019-08-20Reland "fdsan: make fatal by default."Josh Gao
The two tests known to be failing (installd_dexopt_test and BpfMapTest) have been fixed, so let's try this again. This reverts commit 76351e3e3fbbd386c059251dbc6b1081a8f77088. Bug: http://b/137788030 Bug: http://b/139092341 Bug: http://b/139175951 Test: treehugger
2019-08-09Revert "fdsan: make fatal by default."Pete Gillin
This reverts commit 66b5e3ca1941a118bbb8ea41bfe98f9725ee8d5d. Reason for revert: Causes installd_dexopt_test to fail. Presumably there is an existing issue which this change is turning into a hard fail, so that needs to be fixed before this can be rolled forwards. See b/139092341. Bug: 139092341 Bug: 137788030 Change-Id: I1beccddff64c86541bc003b9b009f4046ec9cbf1
2019-08-07fdsan: make fatal by default.Josh Gao
Make fdsan fatal by default on native processes, and Java processes that target R or later. Bug: http://b/137788030 Test: manual Change-Id: I5900efc606fc0d47b69223574ad7dca89afe4eda
2019-07-23Reserve signal for java heap dumps.Florian Mayer
We will put instrumentation in ART to write out Java heap memory information on receipt of this signal. Bug: 136210868 Test: Flash blueline-userdebug and boot Change-Id: I63173a4051c46b8569faaf3064e1db1dbd0ea3fe
2019-04-24threads.h: Add C11 thread support.Elliott Hughes
FreeBSD, glibc, and musl have all implemented C11 threads at this point. POSIX is looking at how to align with it. Probably time to jump on the bandwagon ourselves... Implemented in the same style as <termios.h> so we can provide this functionality even on older API levels. This does mean that this is strictly more expensive than calling pthread functions directly. Although this isn't in POSIX yet, assume that it's going to be basically the same as C11 and add the header test anyway. We should revisit this when POSIX actually adds <threads.h>. Test: new tests Change-Id: I8602d67ce71ca7f8ed1529daa0a8ea1feb083dd6
2019-03-25Reserve realtime signal for libprofile-extrasPirama Arumuga Nainar
Bug: http://b/128524141 This signal is used by libprofile-extras to trigger flush of gcov coverage data. Test: libprofile-extras in system/extras/toolchain-extras Change-Id: I77dd5b1d67371a9cfaad54ad60254bfb2dd18ba9
2019-03-20Add introduced-in annotation to fdsanLogan Chien
This commit adds missing INTRODUCTED_IN(29) annotations to fdsan.h. Note: This is not revealed until recently because API level 29 is added in Mar 14 and the prebuilt binary for versioner hasn't been updated. Test: ./bionic/tools/versioner/run_tests.py Change-Id: Ie7bf555bb47c97d15f0c5fa36a76bc6cd64e206b
2019-03-14Remove __INTRODUCED_IN_FUTURE.Elliott Hughes
This hasn't been particularly useful, we haven't used it consistently, and it has caused trouble. Test: builds Change-Id: Ic5b5b5124af98aa8301e602fd75b0eb72a5fc7f6
2019-03-14The future is now (2019 edition).Elliott Hughes
This year, we accidentally shipped NDK r20beta1 first :-( Bug: https://github.com/android-ndk/ndk/issues/932 Test: builds Change-Id: Id66a16ea09e7928843e61612fbdef09e72610d49
2019-02-20linker: allow using reserved space for multiple libraries.Torne (Richard Coles)
Introduce a new flag ANDROID_DLEXT_RESERVED_ADDRESS_RECURSIVE which instructs the linker to use the reserved address space to load all of the newly-loaded libraries required by a dlopen() call instead of only the main library. They will be loaded consecutively into that region if they fit. The RELRO sections of all the loaded libraries will also be considered for reading/writing shared RELRO data. This will allow the WebView implementation to potentially consist of more than one .so file while still benefiting from the RELRO sharing optimisation, which would otherwise only apply to the "root" .so file. Test: bionic-unit-tests (existing and newly added) Bug: 110790153 Change-Id: I61da775c29fd5017d9a1e2b6b3757c3d20a355b3
2018-11-15Fix a comment in <android/api-level.h>.Elliott Hughes
Bug: N/A Test: N/A Change-Id: Id6ef27caf8fe095d2be7fbf18fed74cc1334f86b
2018-11-15Make android_get_application_target_sdk_version available to the NDK.Elliott Hughes
Also move this and android_get_device_api_level into <android/api-level.h> so that they're always available. This involves cleaning up <sys/cdefs.h> slightly. Bug: N/A Test: builds Change-Id: I25435c55f3549cd0d827a7581bee75ea8228028b
2018-11-06ART isn't using the ART-specific linker features any more.Elliott Hughes
Bug: N/A Test: ran tests Change-Id: Ide3c295035687019608a2c4716a4a21cb889d121
2018-10-23libc: Add default __STRING implementationLogan Chien
This commit defines a default `__STRING()` definition. There should be a default definition because the unit test cases of versioner will include `android/versioning.h` directly. We cannot include `sys/cdefs.h` in `android/versioning.h` either because that will lead to circular inclusion. Bug: 113263746 Test: ./bionic/tools/versioner/run_tests.py Change-Id: Ie99c0eef4414fd687347baf3a2d295468877464f
2018-10-18Add RT signal to load heapprofd library.Florian Mayer
Tests: Ran malloc_debug_unit_tests Tests: Flashed to walleye, sent signal, observed "Unable to open shared library: heapprofd.so". Change-Id: Ia8ce216837e29e3edbda8789ca28023d53fa1fda
2018-10-17Don't #define __ANDROID_NDK__ for the platform build!Elliott Hughes
Caused an ODR violation trying to build current ToT of toybox. Bug: N/A Test: can successfully build code with `#ifdef __ANDROID_NDK__` Change-Id: Ia80b8889b267779ee01f6257744e1794db0ebc65
2018-10-04Another round of documentation.Elliott Hughes
Bug: N/A Test: N/A Change-Id: I1b818fbb36ddd6d084dee56828290c2717a0c9b0
2018-09-18fdsan: add type for libziparchive's ZipArchive.Josh Gao
Test: debuggerd `pidof system_server` | grep " fd " Change-Id: I6a9a4306ecffe3899e4cc7285a0eb33efaa62616
2018-09-17fdsan: add types for Java sockets.Josh Gao
Test: art/tools/run-libcore-tests.sh Change-Id: If61211bc4ae225c3f89db989a167f9dc4fce375a
2018-09-06Add android_get_device_api_level.Elliott Hughes
Bug: http://b/113615412 Test: ran tests Change-Id: I0a7ae336c96c9ed6543b6935cbc242d14d4a4a67
2018-08-30fdsan: add type for ART's FdFile.Josh Gao
Bug: http://b/113558485 Test: none Change-Id: I9bc874d8689cc54563f2a5878d324b27ad85060e
2018-08-30Remove ARM/MIPS fenv duplication.Elliott Hughes
Bug: http://b/32709207 Test: ran tests Change-Id: I58d354e9f8b1e6023427ba271bf39e4e24b7f8ab
2018-08-28Merge changes from topic "fdsan_abort_msg"Josh Gao
* changes: fdsan: provide abort message in warning tombstones. Implement pthread_sigqueue. Stringify api_level in <android/versioning.h>. Delete archaic pre-ANSI C support.
2018-08-28Merge changes from topic "bionic_fdsan_java"Treehugger Robot
* changes: fdsan: make the tag type values sequential. fdsan: expose functions to get and interpret tags.
2018-08-28Merge "Add fdsan owner type for sqlite."Treehugger Robot
2018-08-27Stringify api_level in <android/versioning.h>.Josh Gao
Make it so that we can use __ANDROID_API_<letter>__ constants in __INTRODUCED_IN macros. Test: treehugger Change-Id: I0929c01e23e58f51d12f73200e1daf5ef484ea5d
2018-08-24Merge "Start documenting libc."Elliott Hughes
2018-08-23fdsan: make the tag type values sequential.Josh Gao
In retrospect, allocating tag types from both ends will just make the future creation of user-defined tags harder, because constants that are introduced, and then used in previous versions might collide with user-defined tags. Move all of the tag values to the front, so that we can allocate from the end to minimize this. Test: bionic_unit_tests Change-Id: I5063adf8301b1063bd4931a6ce8b70dfe2411efd
2018-08-23Add fdsan owner type for sqlite.Josh Gao
Test: none Change-Id: Ib331d108e7e0431250eba3609f3557d8e4665aba
2018-08-23fdsan: expose functions to get and interpret tags.Josh Gao
Make it easier to write tests in users of fdsan by exposing functions to allow users to get and interpret the tags. Test: bionic_unit_tests Change-Id: Iafa9bcaeb5e4db230f3dfec6f483274f34602694