Finish pulling info over from the GYP build files

Change-Id: I9716568a0bd98dc00df4b52811bc28fb86e81ba4
diff --git a/tools/bazel.rc b/tools/bazel.rc
index f07bba7..0f89dc9 100644
--- a/tools/bazel.rc
+++ b/tools/bazel.rc
@@ -25,13 +25,16 @@
 build:isan --platform_suffix=-isan
 build:isan --test_env LLVM_SYMBOLIZER=/usr/bin/llvm-symbolizer-3.6
 
-build:ubsan --copt -fsanitize=undefined
+build:ubsan --copt -fsanitize=undefined --copt -fno-sanitize-recover
+# Bad alignment is just slow on x86 and traps on ARM, so we'll find
+# it other ways, and some x86 code does it on purpose.
+build:ubsan --copt -fno-sanitize=alignment
 build:ubsan --linkopt -fsanitize=undefined
 build:ubsan --platform_suffix=-ubsan
 build:ubsan --test_env LLVM_SYMBOLIZER=/usr/bin/llvm-symbolizer-3.6
 
-build:msan --copt -fsanitize=memory
-build:msan --linkopt -fsanitize=memory
+build:msan --copt -fsanitize=memory --copt -fsanitize-memory-track-origins
+build:msan --linkopt -fsanitize=memory --ldopt -fsanitize-memory-track-origins
 build:msan --platform_suffix=-msan
 build:msan --test_env MSAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.6
 
diff --git a/tools/build_rules/fortran.bzl b/tools/build_rules/fortran.bzl
index 0162244..635e7d7 100644
--- a/tools/build_rules/fortran.bzl
+++ b/tools/build_rules/fortran.bzl
@@ -7,7 +7,7 @@
 
   cmd = toolchain_cflags + ['-c', ctx.file.src.path, '-o', ctx.outputs.pic_o.path]
   filtered_cmd = []
-  # Strip out the C/C++ specific flags.
+  # Strip out the C/C++/Clang specific flags.
   exclude_flags = ['-fcolor-diagnostics',
                    '-Wswitch-enum',
                    '-Wpointer-arith',
@@ -18,7 +18,8 @@
                    '-Werror',
                    '-Wextra',
                    '-Wno-builtin-macro-redefined',
-                   '-D__has_feature(x)=0']
+                   '-D__has_feature(x)=0',
+                   '-fmacro-backtrace-limit=0']
 
   for flag in cmd:
     if flag not in exclude_flags:
diff --git a/tools/cpp/CROSSTOOL b/tools/cpp/CROSSTOOL
index 2917076..d159e5d 100644
--- a/tools/cpp/CROSSTOOL
+++ b/tools/cpp/CROSSTOOL
@@ -131,6 +131,9 @@
       flag_group {
         flag: "-DAOS_DEBUG=1"
       }
+      flag_group {
+        flag: "-fno-omit-frame-pointer"
+      }
     }
   }
 
@@ -224,6 +227,8 @@
   # Enable coloring even if there's no attached terminal. Bazel removes the
   # escape sequences if --nocolor is specified.
   compiler_flag: "-fcolor-diagnostics"
+  compiler_flag: "-fmessage-length=80"
+  compiler_flag: "-fmacro-backtrace-limit=0"
 
   compiler_flag: "-Wall"
   compiler_flag: "-Wextra"
@@ -373,6 +378,9 @@
       flag_group {
         flag: "-DAOS_DEBUG=1"
       }
+      flag_group {
+        flag: "-fno-omit-frame-pointer"
+      }
     }
   }
 
@@ -395,15 +403,9 @@
   feature {
     name: "all_modes"
     flag_set {
-      action: "c-compile"
-      flag_group {
-        flag: "-std=gnu99"
-      }
-    }
-    flag_set {
       action: "preprocess-assemble"
       action: "assemble"
-      action: "c++-link"
+      action: "c-compile"
       flag_group {
         flag: "-std=gnu99"
       }
@@ -433,6 +435,10 @@
     }
   }
 
+  compiler_flag: "-mfpu=neon"
+  # TODO(brians): See if it will run with this enabled.
+  #compiler_flag: "-mhwdiv=arm,thumb"
+
   # Anticipated future default.
   # This makes GCC and Clang do what we want when called through symlinks.
   unfiltered_cxx_flag: "-no-canonical-prefixes"
@@ -484,6 +490,7 @@
   compiler_flag: "-Wsign-compare"
   compiler_flag: "-Wformat=2"
   compiler_flag: "-Werror"
+  compiler_flag: "-Wunused-local-typedefs"
 
   # Keep stack frames for debugging, even in opt mode.
   compiler_flag: "-fno-omit-frame-pointer"