focus hidden-visibility flags

This makes things like dladdr and backtrace_symbols not totally useless on Linux.

Change-Id: I26666a76c5b50fbf88aaf9709c869de0a697bb02
Reviewed-on: https://skia-review.googlesource.com/10176
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
diff --git a/gn/BUILD.gn b/gn/BUILD.gn
index 0ee9d39..3573740 100644
--- a/gn/BUILD.gn
+++ b/gn/BUILD.gn
@@ -147,14 +147,19 @@
     cflags += [
       "-fstrict-aliasing",
       "-fPIC",
-      "-fvisibility=hidden",
       "-Werror",
     ]
     cflags_cc += [
       "-std=c++11",
       "-fno-threadsafe-statics",
-      "-fvisibility-inlines-hidden",
     ]
+
+    # The main idea is to slim the exported API, but these flags also improve link time on Mac.
+    # These would make stack traces worse on Linux, so we don't just set them willy-nilly.
+    if (is_component_build || is_mac) {
+      cflags += [ "-fvisibility=hidden" ]
+      cflags_cc += [ "-fvisibility-inlines-hidden" ]
+    }
   }
 
   if (current_cpu == "arm") {