Преглед на файлове

Tweak UBSan options to reduce object file size. (#547)

The recovery is mostly useful when triaging multiple failures, it seems
easy for us to skip. Giving up the nice diagnostics doesn't lose much
for some types of error where there isn't any real information to
convey, so seems worth doing that for a few cases.

Removing the nice diagnostics from the rest of UBSan saves another
20%-ish of output size on LLVM, but seems like it would be giving up
usability. I think there are other approaches we can use instead so this
PR just focuses on the easy wins.
Chandler Carruth преди 5 години
родител
ревизия
5fe800202b
променени са 1 файла, в които са добавени 7 реда и са изтрити 0 реда
  1. 7 0
      bazel/cc_toolchains/clang_cc_toolchain_config.bzl

+ 7 - 0
bazel/cc_toolchains/clang_cc_toolchain_config.bzl

@@ -441,6 +441,13 @@ def _impl(ctx):
             flag_groups = [flag_group(flags = [
                 "-fsanitize=address,undefined",
                 "-fsanitize-address-use-after-scope",
+                # We don't need the recovery behavior of UBSan as we expect
+                # builds to be clean. Not recoverying is a bit cheaper.
+                "-fno-sanitize-recover=undefined",
+                # Force some expensive UBSan checks to the cheaper trap mode.
+                # The dedicated debugging message is unlikely to be critical for
+                # these.
+                "-fsanitize-trap=alignment,null,return,unreachable",
                 # Needed due to clang AST issues, such as in
                 # clang/AST/Redeclarable.h line 199.
                 "-fno-sanitize=vptr",