[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)
commitcfd8f11d48146e551016b98c7314e3126170907d
treeec5505f8de940fec1ae472763d4427fe513bb879
parentd2f17c4e2bed1b5dc470422caaaec4490a52db71
[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.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239379 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Instrumentation/AddressSanitizer.cpp
test/Instrumentation/AddressSanitizer/do-not-instrument-llvm-metadata-darwin.ll [new file with mode: 0644]