Improve logging Adds coloured logging and tweaks the build flags to generate more meaningful stacktraces. Change-Id: Iab643a0cf995faacba0fa32424a1f6a0145ed30e
diff --git a/gn/standalone/BUILD.gn b/gn/standalone/BUILD.gn index 59f60fd..9a8ef68 100644 --- a/gn/standalone/BUILD.gn +++ b/gn/standalone/BUILD.gn
@@ -44,6 +44,10 @@ cflags = [ "-fno-rtti" ] } +config("visibility_hidden") { + cflags = [ "-fvisibility=hidden" ] +} + config("default") { asmflags = [] cflags = [] @@ -89,6 +93,8 @@ "-mfpmath=sse", ] ldflags += [ "-m32" ] + } else if (current_cpu == "arm64") { + cflags += [ "-fno-omit-frame-pointer" ] } if (is_linux) { @@ -145,26 +151,35 @@ } config("debug_symbols") { - if (is_android) { - cflags = [ - "-gline-tables-only", - "-funwind-tables", - ] - } else { - cflags = [ "-g2" ] + cflags = [ + "-g", + "-O0", + ] + if (is_android || is_linux) { + cflags += [ "-funwind-tables" ] + ldflags = [ "-rdynamic" ] } } config("release") { cflags = [ - "-O3", "-fdata-sections", "-ffunction-sections", ] + if (is_android) { + cflags += [ "-Oz" ] + } else { + cflags += [ "-O3" ] + } if (is_mac) { ldflags = [ "-dead_strip" ] } else { - ldflags = [ "-Wl,--gc-sections" ] + ldflags = [ + "-fuse-ld=gold", + "-Wl,--gc-sections", + "-Wl,--icf=all", + "-Wl,-O1", + ] } defines = [ "NDEBUG" ] }
diff --git a/gn/standalone/BUILDCONFIG.gn b/gn/standalone/BUILDCONFIG.gn index b1d103f..272eb58 100644 --- a/gn/standalone/BUILDCONFIG.gn +++ b/gn/standalone/BUILDCONFIG.gn
@@ -50,6 +50,7 @@ "//gn/standalone:extra_warnings", "//gn/standalone:no_exceptions", "//gn/standalone:no_rtti", + "//gn/standalone:visibility_hidden", "//gn/standalone/libc++:config", "//gn/standalone/sanitizers:sanitizers_cflags", ]