[llvm-commits] [compiler-rt] r147302 - /compiler-rt/trunk/lib/asan/asan_rtl.cc
Kostya Serebryany
kcc at google.com
Tue Dec 27 16:59:39 PST 2011
Author: kcc
Date: Tue Dec 27 18:59:39 2011
New Revision: 147302
URL: http://llvm.org/viewvc/llvm-project?rev=147302&view=rev
Log:
[asan] make sure __asan_report_* functions are not inlined (so that they are not optimized away and are kept in the resulting library). Patch by glider at google.com
Modified:
compiler-rt/trunk/lib/asan/asan_rtl.cc
Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=147302&r1=147301&r2=147302&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Tue Dec 27 18:59:39 2011
@@ -331,12 +331,12 @@
}
// exported functions
-#define ASAN_REPORT_ERROR(type, is_write, size) \
-extern "C" void __asan_report_ ## type ## size(uintptr_t addr) \
- __attribute__((visibility("default"))); \
-extern "C" void __asan_report_ ## type ## size(uintptr_t addr) { \
- GET_BP_PC_SP; \
- __asan_report_error(pc, bp, sp, addr, is_write, size); \
+#define ASAN_REPORT_ERROR(type, is_write, size) \
+extern "C" void __asan_report_ ## type ## size(uintptr_t addr) \
+ __attribute__((visibility("default"))) __attribute__((noinline)); \
+extern "C" void __asan_report_ ## type ## size(uintptr_t addr) { \
+ GET_BP_PC_SP; \
+ __asan_report_error(pc, bp, sp, addr, is_write, size); \
}
ASAN_REPORT_ERROR(load, false, 1)
@@ -355,8 +355,7 @@
// dynamic libraries access the symbol even if it is not used by the executable
// itself. This should help if the build system is removing dead code at link
// time.
-extern "C"
-void __asan_force_interface_symbols() {
+static void force_interface_symbols() {
volatile int fake_condition = 0; // prevent dead condition elimination.
if (fake_condition) {
__asan_report_load1(NULL);
@@ -775,7 +774,7 @@
asanThreadRegistry().Init();
asanThreadRegistry().GetMain()->ThreadStart();
- __asan_force_interface_symbols(); // no-op.
+ force_interface_symbols(); // no-op.
if (FLAG_v) {
Report("AddressSanitizer Init done\n");
More information about the llvm-commits
mailing list