[all-commits] [llvm/llvm-project] 5d64dd: [Clang][ASan] Introduce `-fsanitize-address-destru...

Dan Liew via All-commits all-commits at lists.llvm.org
Thu Feb 25 12:04:09 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5d64dd8e3c22e12e4f7b3d08ffe88fc41e727117
      https://github.com/llvm/llvm-project/commit/5d64dd8e3c22e12e4f7b3d08ffe88fc41e727117
  Author: Dan Liew <dliew at apple.com>
  Date:   2021-02-25 (Thu, 25 Feb 2021)

  Changed paths:
    M clang/docs/ClangCommandLineReference.rst
    M clang/include/clang/Basic/CodeGenOptions.def
    M clang/include/clang/Basic/CodeGenOptions.h
    M clang/include/clang/Basic/Sanitizers.h
    M clang/include/clang/Driver/Options.td
    M clang/include/clang/Driver/SanitizerArgs.h
    M clang/lib/Basic/Sanitizers.cpp
    M clang/lib/CodeGen/BackendUtil.cpp
    M clang/lib/Driver/SanitizerArgs.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    A clang/test/CodeGen/asan-destructor-kind.cpp
    A clang/test/Driver/fsanitize-address-destructor-kind.c

  Log Message:
  -----------
  [Clang][ASan] Introduce `-fsanitize-address-destructor-kind=` driver & frontend option.

The new `-fsanitize-address-destructor-kind=` option allows control over how module
destructors are emitted by ASan.

The new option is consumed by both the driver and the frontend and is propagated into
codegen options by the frontend.

Both the legacy and new pass manager code have been updated to consume the new option
from the codegen options.

It would be nice if the new utility functions (`AsanDtorKindToString` and
`AsanDtorKindFromString`) could live in LLVM instead of Clang so they could be
consumed by other language frontends. Unfortunately that doesn't work because
the clang driver doesn't link against the LLVM instrumentation library.

rdar://71609176

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


  Commit: fdce098b49cb038996441741a7b2ab3652502aec
      https://github.com/llvm/llvm-project/commit/fdce098b49cb038996441741a7b2ab3652502aec
  Author: Dan Liew <dliew at apple.com>
  Date:   2021-02-25 (Thu, 25 Feb 2021)

  Changed paths:
    M clang/lib/Driver/SanitizerArgs.cpp
    A clang/test/Driver/darwin-asan-mkernel-kext.c

  Log Message:
  -----------
  [Clang][ASan] Teach Clang to not emit ASan module destructors when compiling with `-mkernel` or `-fapple-kext`.

rdar://71609176

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


Compare: https://github.com/llvm/llvm-project/compare/169318088406...fdce098b49cb


More information about the All-commits mailing list