[all-commits] [llvm/llvm-project] 0477ca: [asan] Allow -fsanitize-address-globals-dead-strip...

Fangrui Song via All-commits all-commits at lists.llvm.org
Wed Feb 23 16:08:38 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0477cac332d5abf7b2b51b470370afcbb1e8d513
      https://github.com/llvm/llvm-project/commit/0477cac332d5abf7b2b51b470370afcbb1e8d513
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-02-23 (Wed, 23 Feb 2022)

  Changed paths:
    M clang/lib/CodeGen/BackendUtil.cpp
    M clang/test/CodeGen/asan-globals-gc.cpp
    M clang/test/CodeGen/asan-no-globals-no-comdat.cpp

  Log Message:
  -----------
  [asan] Allow -fsanitize-address-globals-dead-stripping with -fno-data-sections for ELF

-fdata-sections decides whether global variables go into different sections.
This is orthogonal to whether we place their metadata (`.data` or `asan_globals`) into different sections.

With -fno-data-sections, `-fsanitize-address-globals-dead-stripping` can still:

* deduplicate COMDAT `asan.module_ctor` and `asan.module_dtor`
* (with ld --gc-sections): for a data section (e.g. `.data`), if all global variables defined relative to it are unreferenced, discard them and associated `asan_globals` sections (rare but no need to exclude this case)

Similar to c7b90947bd0179d914fea56b52be545c8f60f20a for PE/COFF.

Reviewed By: #sanitizers, kstoimenov, vitalybuka

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




More information about the All-commits mailing list