@@ -729,6 +729,7 @@ int main(int argc, char* argv[], char* envp[]) {
729729 int wants_libssp = 0 ;
730730 int wants_libm = 0 ;
731731 int wants_libpino_math = 0 ;
732+ int wants_libpino_mman = 0 ;
732733 int wants_force_static = 0 ;
733734
734735 #if defined(OBGGCC )
@@ -850,6 +851,7 @@ int main(int argc, char* argv[], char* envp[]) {
850851 1 + /* -static-libhwasan */
851852 1 + /* -mfpu=<value> */
852853 2 + /* -l pino-math */
854+ 2 + /* -l pino-mman */
853855 1 /* NULL */
854856 )
855857 );
@@ -1386,6 +1388,18 @@ int main(int argc, char* argv[], char* envp[]) {
13861388 if ((linking && !linking_shared ) && LIBC_VERSION (libc_major , libc_minor ) < LIBC_VERSION (16 , 0 )) {
13871389 kargv [kargc ++ ] = (char * ) GCC_OPT_NO_PIE ;
13881390 }
1391+
1392+ wants_libpino_mman = LIBC_VERSION (libc_major , libc_minor ) < LIBC_VERSION (21 , 0 );
1393+
1394+ /*
1395+ Android versions below 5.0 (API level 21) did not have an mmap64() implementation.
1396+ The NDK provided a pseudo-implementation for this as an inline, and we moved it to its
1397+ own external library.
1398+ */
1399+ if (wants_libpino_mman ) {
1400+ kargv [kargc ++ ] = (char * ) GCC_OPT_L ;
1401+ kargv [kargc ++ ] = (char * ) PINO_MMAN_LIBRARY ;
1402+ }
13891403 #endif
13901404
13911405 #if defined(OBGGCC )
@@ -1933,14 +1947,23 @@ int main(int argc, char* argv[], char* envp[]) {
19331947 }
19341948 }
19351949
1936- /* libm */
1950+ /* libpino-math */
19371951 if (wants_libm ) {
19381952 err = copy_shared_library (sysroot_library_directory , output_directory , LIBPINO_MATH_SHARED , LIBPINO_MATH_SHARED );
19391953
19401954 if (err != ERR_SUCCESS ) {
19411955 goto end ;
19421956 }
19431957 }
1958+
1959+ /* libpino-mman */
1960+ if (wants_libpino_mman ) {
1961+ err = copy_shared_library (sysroot_library_directory , output_directory , LIBPINO_MMAN_SHARED , LIBPINO_MMAN_SHARED );
1962+
1963+ if (err != ERR_SUCCESS ) {
1964+ goto end ;
1965+ }
1966+ }
19441967 }
19451968 #endif
19461969
0 commit comments