Skip to content

Commit ab05b29

Browse files
committed
Support bundling libquadmath into APKs
This was the only library missing the logic. I didn't notice it at first because this library is only built for x86 (I did most of my testing on ARM/ARM64 only).
1 parent e296e39 commit ab05b29

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

tools/gcc-wrapper/main.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ static const char STDCXX_LIBRARY[] = "stdc++";
3333
static const char ATOMIC_LIBRARY[] = "atomic";
3434
static const char GOMP_LIBRARY[] = "gomp";
3535
static const char ITM_LIBRARY[] = "itm";
36+
static const char QUADMATH_LIBRARY[] = "quadmath";
3637

3738
static const char LIBATOMIC_SHARED[] = "libatomic.so";
3839

@@ -47,6 +48,7 @@ static const char LIBATOMIC_SHARED[] = "libatomic.so";
4748
static const char LIBGOMP_SHARED[] = "libgomp.so";
4849
static const char LIBITM_SHARED[] = "libitm.so";
4950
static const char LIBSSP_SHARED[] = "libssp.so";
51+
static const char LIBQUADMATH_SHARED[] = "libquadmath.so";
5052

5153
static const char LIBASAN_SHARED[] = "libasan.so";
5254
static const char LIBHWASAN_SHARED[] = "libhwasan.so";
@@ -71,6 +73,7 @@ static const char GCC_OPT_L_STDCXX[] = "-lstdc++";
7173
static const char GCC_OPT_L_ATOMIC[] = "-latomic";
7274
static const char GCC_OPT_L_GOMP[] = "-lgomp";
7375
static const char GCC_OPT_L_ITM[] = "-litm";
76+
static const char GCC_OPT_L_QUADMATH[] = "-lquadmath";
7477
static const char GCC_OPT_XLINKER[] = "-Xlinker";
7578
static const char GCC_OPT_WL[] = "-Wl,";
7679
static const char GCC_OPT_F_FAT_LTO_OBJECTS[] = "-ffat-lto-objects";
@@ -569,6 +572,7 @@ int main(int argc, char* argv[], char* envp[]) {
569572
int wants_libgomp = 0;
570573
int wants_libgcc = 0;
571574
int wants_libitm = 0;
575+
int wants_libquadmath = 0;
572576
int wants_librt = 0;
573577
int wants_libssp = 0;
574578
int wants_force_static = 0;
@@ -713,6 +717,8 @@ int main(int argc, char* argv[], char* envp[]) {
713717
wants_libgomp = 1;
714718
} else if (strcmp(cur, GCC_OPT_L_ITM) == 0 || strcmp(cur, GCC_OPT_F_GNU_TM) == 0) {
715719
wants_libitm = 1;
720+
} else if (strcmp(cur, GCC_OPT_L_QUADMATH) == 0) {
721+
wants_libquadmath = 1;
716722
} else if (strcmp(cur, GCC_OPT_L_RT) == 0) {
717723
have_rt_library = 1;
718724
} else if (prev != NULL && strcmp(prev, GCC_OPT_L) == 0) {
@@ -726,6 +732,8 @@ int main(int argc, char* argv[], char* envp[]) {
726732
wants_libgomp = 1;
727733
} else if (strcmp(cur, ITM_LIBRARY) == 0) {
728734
wants_libitm = 1;
735+
} else if (strcmp(cur, QUADMATH_LIBRARY) == 0) {
736+
wants_libquadmath = 1;
729737
}
730738
} else if (strcmp(cur, CMAKE_C_COMPILER_ID) == 0 || strcmp(cur, CMAKE_CXX_COMPILER_ID) == 0) {
731739
cmake_init = 1;
@@ -1649,6 +1657,15 @@ int main(int argc, char* argv[], char* envp[]) {
16491657
}
16501658
}
16511659

1660+
/* libquadmath */
1661+
if (wants_libquadmath) {
1662+
err = copy_shared_library(sysroot_library_directory, output_directory, LIBQUADMATH_SHARED, LIBQUADMATH_SHARED);
1663+
1664+
if (err != ERR_SUCCESS) {
1665+
goto end;
1666+
}
1667+
}
1668+
16521669
/* libssp */
16531670
if (wants_libssp) {
16541671
err = copy_shared_library(sysroot_library_directory, output_directory, LIBSSP_SHARED, LIBSSP_SHARED);

0 commit comments

Comments
 (0)