[all-commits] [llvm/llvm-project] ca6df7: [NFC][CodeGenOptions] Refactor checking SanitizeCo...

Marco Elver via All-commits all-commits at lists.llvm.org
Tue May 25 04:00:33 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ca6df734069ae590d1632e920ceba03bea317549
      https://github.com/llvm/llvm-project/commit/ca6df734069ae590d1632e920ceba03bea317549
  Author: Marco Elver <elver at google.com>
  Date:   2021-05-25 (Tue, 25 May 2021)

  Changed paths:
    M clang/include/clang/Basic/CodeGenOptions.h
    M clang/lib/CodeGen/BackendUtil.cpp

  Log Message:
  -----------
  [NFC][CodeGenOptions] Refactor checking SanitizeCoverage options

Refactor checking SanitizeCoverage options into
CodeGenOptions::hasSanitizeCoverage().

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D102927


  Commit: 85feebf5a3401eab4c71288e2dc089faf547ab4c
      https://github.com/llvm/llvm-project/commit/85feebf5a3401eab4c71288e2dc089faf547ab4c
  Author: Marco Elver <elver at google.com>
  Date:   2021-05-25 (Tue, 25 May 2021)

  Changed paths:
    M clang/test/CodeGen/sanitize-coverage.c

  Log Message:
  -----------
  [NFC][SanitizeCoverage] Test always_inline functions work

Test that always_inline functions are instrumented as expected.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D102929


  Commit: 280333021e9550d80f5c1152a34e33e81df1e178
      https://github.com/llvm/llvm-project/commit/280333021e9550d80f5c1152a34e33e81df1e178
  Author: Marco Elver <elver at google.com>
  Date:   2021-05-25 (Tue, 25 May 2021)

  Changed paths:
    M clang/docs/SanitizerCoverage.rst
    M clang/include/clang/Basic/Attr.td
    M clang/include/clang/Basic/AttrDocs.td
    M clang/lib/CodeGen/CodeGenFunction.cpp
    M clang/lib/Sema/SemaDeclAttr.cpp
    M clang/test/CodeGen/sanitize-coverage.c
    M llvm/bindings/go/llvm/ir_test.go
    M llvm/docs/BitCodeFormat.rst
    M llvm/docs/LangRef.rst
    M llvm/include/llvm/AsmParser/LLToken.h
    M llvm/include/llvm/Bitcode/LLVMBitCodes.h
    M llvm/include/llvm/IR/Attributes.td
    M llvm/lib/AsmParser/LLLexer.cpp
    M llvm/lib/AsmParser/LLParser.cpp
    M llvm/lib/Bitcode/Reader/BitcodeReader.cpp
    M llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
    M llvm/lib/IR/Attributes.cpp
    M llvm/lib/IR/Verifier.cpp
    M llvm/lib/Transforms/IPO/ForceFunctionAttrs.cpp
    M llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
    M llvm/lib/Transforms/Utils/CodeExtractor.cpp
    M llvm/test/Bitcode/attributes.ll
    M llvm/test/Bitcode/compatibility.ll
    M llvm/utils/emacs/llvm-mode.el
    M llvm/utils/llvm.grm
    M llvm/utils/vim/syntax/llvm.vim
    M llvm/utils/vscode/llvm/syntaxes/ll.tmLanguage.yaml

  Log Message:
  -----------
  [SanitizeCoverage] Add support for NoSanitizeCoverage function attribute

We really ought to support no_sanitize("coverage") in line with other
sanitizers. This came up again in discussions on the Linux-kernel
mailing lists, because we currently do workarounds using objtool to
remove coverage instrumentation. Since that support is only on x86, to
continue support coverage instrumentation on other architectures, we
must support selectively disabling coverage instrumentation via function
attributes.

Unfortunately, for SanitizeCoverage, it has not been implemented as a
sanitizer via fsanitize= and associated options in Sanitizers.def, but
rolls its own option fsanitize-coverage. This meant that we never got
"automatic" no_sanitize attribute support.

Implement no_sanitize attribute support by special-casing the string
"coverage" in the NoSanitizeAttr implementation. To keep the feature as
unintrusive to existing IR generation as possible, define a new negative
function attribute NoSanitizeCoverage to propagate the information
through to the instrumentation pass.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=49035

Reviewed By: vitalybuka, morehouse

Differential Revision: https://reviews.llvm.org/D102772


Compare: https://github.com/llvm/llvm-project/compare/ed14062be0c1...280333021e95


More information about the All-commits mailing list