Fix the standalone Android FIPS build.

Change-Id: Idce6c93f5a37e1f05afaa6fb928e15b92d75e911
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/38365
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 66596af..b7f468f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -387,6 +387,14 @@
       set(FIPS_DELOCATE "1")
     endif()
   endif()
+  if(FIPS_SHARED)
+    # The Android CMake files set -ffunction-sections and -fdata-sections,
+    # which is incompatible with FIPS_SHARED.
+    set(CMAKE_C_FLAGS
+        "${CMAKE_C_FLAGS} -fno-function-sections -fno-data-sections")
+    set(CMAKE_CXX_FLAGS
+        "${CMAKE_CXX_FLAGS} -fno-function-sections -fno-data-sections")
+  endif()
 endif()
 
 if(OPENSSL_SMALL)