focus hidden-visibility flags
authorMike Klein <mtklein@chromium.org>
Mon, 27 Mar 2017 00:11:48 +0000 (20:11 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Mon, 27 Mar 2017 12:50:16 +0000 (12:50 +0000)
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>

gn/BUILD.gn

index 0ee9d39321dae701638c8af284e8d1827b7e5e60..3573740f99a086e6e5196993dd7723426fe9ecc1 100644 (file)
@@ -147,14 +147,19 @@ config("default") {
     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") {