diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -1544,6 +1544,14 @@ #define _LIBCPP_BUILTIN_CONSTANT_P(x) false #endif +// Support for _FILE_OFFSET_BITS=64 landed gradually in Android, so the full set +// of functions used in cstdio may not be available for low API levels when +// using 64-bit file offsets on LP32. +#if defined(__BIONIC__) && defined(__USE_FILE_OFFSET64) && __ANDROID_API__ < 24 +#define _LIBCPP_HAS_NO_FGETPOS +#define _LIBCPP_HAS_NO_FSETPOS +#endif + #endif // __cplusplus #endif // _LIBCPP_CONFIG diff --git a/libcxx/include/cstdio b/libcxx/include/cstdio --- a/libcxx/include/cstdio +++ b/libcxx/include/cstdio @@ -131,9 +131,13 @@ using ::ungetc; using ::fread; using ::fwrite; +#ifndef _LIBCPP_HAS_NO_FGETPOS using ::fgetpos; +#endif using ::fseek; +#ifndef _LIBCPP_HAS_NO_FSETPOS using ::fsetpos; +#endif using ::ftell; using ::rewind; using ::clearerr;