[asan] Prevent __attribute__((annotate)) triggering errors on Darwin
authorAnna Zaks <ganna@apple.com>
Tue, 9 Jun 2015 00:58:08 +0000 (00:58 +0000)
committerAnna Zaks <ganna@apple.com>
Tue, 9 Jun 2015 00:58:08 +0000 (00:58 +0000)
commit119046098a1b0a862b292c2937c5b625880a19ef
tree1e681dffd7e9e1a258c03fb168c12ef5d86247b7
parent705eb8f6b1bf02ec79ba045631114bd68ea26bf7
[asan] Prevent __attribute__((annotate)) triggering errors on Darwin

The following code triggers a fatal error in the compiler instrumentation
of ASan on Darwin because we place the attribute into llvm.metadata section,
which does not have the proper MachO section name.

void foo() __attribute__((annotate("custom")));
void foo() {;}

This commit reorders the checks so that we skip everything in llvm.metadata
first. It also removes the hard failure in case the section name does not
parse. That check will be done lower in the compilation pipeline anyway.

(Reviewed in http://reviews.llvm.org/D9093.)

llvm-svn: 239379
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
llvm/test/Instrumentation/AddressSanitizer/do-not-instrument-llvm-metadata-darwin.ll [new file with mode: 0644]