Shrink pdfium

Explicitly export functions and enable the linker's identical code
folding optimization.

This makes libpdfium.so in /system/lib and /system/lib64 ~1MB smaller.
Also, this makes system.raw.img 870KB smaller.

Bug: 182446785
Test: build
Change-Id: I5ed403aa88110f924d1d9d1f69793511662737ee
(cherry picked from commit 94adbcf7b9134f6e49ba84b7ab5b6130c8276dec)
diff --git a/Android.bp b/Android.bp
index 750884b..4af2504 100644
--- a/Android.bp
+++ b/Android.bp
@@ -55,6 +55,14 @@
         "-DOPJ_STATIC",
         "-DPNG_PREFIX",
         "-DPNG_USE_READ_MACROS",
+
+        // Do not export functions by default. Export only functions annotated
+        // with FPDF_EXPORT.
+        "-fvisibility=hidden",
+
+        // Macro definitions to enable FPDF_EXPORT.
+        "-DCOMPONENT_BUILD",
+        "-DFPDF_IMPLEMENTATION",
     ],
 
     arch: {
@@ -143,6 +151,10 @@
         "libz",
     ],
 
+    ldflags: [
+      "-Wl,-icf=all",
+    ],
+
     export_include_dirs: ["public"],
 
 }
diff --git a/third_party/Android.bp b/third_party/Android.bp
index 6571fb1..3fcb08d 100644
--- a/third_party/Android.bp
+++ b/third_party/Android.bp
@@ -80,6 +80,7 @@
 cc_library_static {
     name: "libpdfium-libopenjpeg2",
     defaults: ["pdfium-third-party"],
+    visibility: ["//cts/hostsidetests/securitybulletin/securityPatch/CVE-2016-8332"],
 
     exclude_srcs: [
         "libopenjpeg20/t1_generate_luts.c",