This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by MaskRay on Feb 23 2022, 1:17 AM.

Details

Summary

-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.

Diff Detail