Fix an ODR violation in the sanitizer runtimes.
authorChandler Carruth <chandlerc@gmail.com>
Mon, 30 Dec 2013 23:36:11 +0000 (23:36 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 30 Dec 2013 23:36:11 +0000 (23:36 +0000)
commita989fb5ce7cfbb99342fe3360ed51975a57ca398
treee749163520af667cf26aacd929bc96dc4b151bfe
parent35d8703dbe89f717ef6c71b35e4b29aa51bbd7a7
Fix an ODR violation in the sanitizer runtimes.

A helper function is a C++ function, and so even though one of the two
definitions is weak, it still technically triggers the ODR. Perhaps
these two definitions are ODR equivalent, but I'm not even confident in
that.

Instead, just define the function once, declare it as weak, and use
a wrapper that is clearly file-local. This avoids two definitions. Also
make the function extern "C" so that we can't even mess up the type
signature somehow or otherwise fail to match up the weak declaration
here with the interceptor defined elsewhere.

llvm-svn: 198253
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc