Use default symbol visibility for everything.

Almost no symbols were being exported because we were using the wrong
config. The only way everything was working was because a bug in our
build system where the .o files were also being linked into consumers of
the .so.

The -Wl,-Bsymbolic flag also needs to be used because otherwise the
assembly code needs to be modified to handle different types of
relocations referencing internal symbols that are now being exported.

Change-Id: I00ab60e43412389a857b7db7cabd1e729555162b
diff --git a/BUILD.gn b/BUILD.gn
index f66a3a3..cdfe3ff 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -112,19 +112,16 @@
   cflags = [
     "-Wno-sign-compare",
     "-Wno-missing-field-initializers",
-    "-Wno-pointer-bool-conversion"
+    "-Wno-pointer-bool-conversion",
   ]
 }
 
-source_set("ffmpeg_internal") {
+shared_library("ffmpeg") {
   sources = ffmpeg_c_sources + ffmpeg_gas_sources + [
               "$ffmpeg_config_root/config.h",
               "$ffmpeg_config_root/libavutil/avconfig.h",
             ]
-  include_dirs = [
-    ffmpeg_config_root,
-    ".",
-  ]
+  public_configs = [ ":ffmpeg_dependent_config" ]
   defines = [
     "HAVE_AV_CONFIG_H",
     "_POSIX_C_SOURCE=200112",
@@ -170,6 +167,9 @@
     configs += [ "//build/config:release" ]
   }
 
+  # Make all symbols visible.
+  configs -= [ "//build/config:symbol_visibility_hidden" ]
+
   cflags += [
     # ffmpeg uses its own deprecated functions.
     "-Wno-deprecated-declarations",
@@ -198,6 +198,8 @@
     "-fomit-frame-pointer",
   ]
   ldflags = [
+    # Avoid PIC relocation errors from assembly code.
+    "-Wl,-Bsymbolic",
     "-L",
     rebase_path(target_gen_dir, root_build_dir),
   ]
@@ -206,10 +208,3 @@
     deps += [ ":ffmpeg_yasm" ]
   }
 }
-
-shared_library("ffmpeg") {
-  public_configs = [ ":ffmpeg_dependent_config" ]
-  deps = [
-    ":ffmpeg_internal",
-  ]
-}