Use -Wno-exit-time-destructors.

And fix (by leaking) the one problematic piece of code.

Test: treehugger
Change-Id: I5f99a4361222647654a5e09c016bf0c27566b1ca
diff --git a/liblog/Android.bp b/liblog/Android.bp
index 5c35b78..a8e7174 100644
--- a/liblog/Android.bp
+++ b/liblog/Android.bp
@@ -135,6 +135,7 @@
         "-Wall",
         "-Werror",
         "-Wextra",
+        "-Wexit-time-destructors",
         // This is what we want to do:
         //  liblog_cflags := $(shell \
         //   sed -n \
diff --git a/liblog/logger_write.cpp b/liblog/logger_write.cpp
index 22c7eca..8793e82 100644
--- a/liblog/logger_write.cpp
+++ b/liblog/logger_write.cpp
@@ -135,10 +135,10 @@
 
 // It's possible for logging to happen during static initialization before our globals are
 // initialized, so we place this std::string in a function such that it is initialized on the first
-// call.
+// call. We use a pointer to avoid exit time destructors.
 std::string& GetDefaultTag() {
-  static std::string default_tag = getprogname();
-  return default_tag;
+  static std::string* default_tag = new std::string(getprogname());
+  return *default_tag;
 }
 
 void __android_log_set_default_tag(const char* tag) {