[PATCH] D30121: [asan] Fix dead stripping of globals on Linux.

Evgeniy Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 17 15:22:35 PST 2017


eugenis created this revision.

Use a combination of !associated, comdat, @llvm.compiler.used and
custom sections to allow dead stripping of globals and their asan
metadata. Sometimes.

Currently this works on LLD, which supports SHF_LINK_ORDER with
sh_link pointing to the associated section.

This also works on BFD, which seems to treat comdats as
all-or-nothing with respect to linker GC. There is a weird quirk
where the "first" global in each link is never GC-ed because of the
section symbols.

At this moment it does not work on Gold (as in the globals are never
stripped).


Repository:
  rL LLVM

https://reviews.llvm.org/D30121

Files:
  include/llvm/Transforms/Utils/ModuleUtils.h
  lib/Transforms/Instrumentation/AddressSanitizer.cpp
  lib/Transforms/Utils/ModuleUtils.cpp
  test/Instrumentation/AddressSanitizer/global_metadata.ll
  test/Instrumentation/AddressSanitizer/global_metadata_darwin.ll
  test/Instrumentation/AddressSanitizer/instrument_global.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30121.88971.patch
Type: text/x-patch
Size: 14624 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170217/02ad9d0b/attachment.bin>


More information about the llvm-commits mailing list