summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2011-12-28 00:59:39 +0000
committerKostya Serebryany <kcc@google.com>2011-12-28 00:59:39 +0000
commit46c70d33d7b6ece449093d5afa7d7d10b7d1c1ed (patch)
treecaac9974b2f1352bc66c6c8286300830936835da
parent5469986da0e45aac94de2b28f0d49b54622c2bc9 (diff)
downloadbcm5719-llvm-46c70d33d7b6ece449093d5afa7d7d10b7d1c1ed.tar.gz
bcm5719-llvm-46c70d33d7b6ece449093d5afa7d7d10b7d1c1ed.zip
[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@google.com
llvm-svn: 147302
-rw-r--r--compiler-rt/lib/asan/asan_rtl.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/compiler-rt/lib/asan/asan_rtl.cc b/compiler-rt/lib/asan/asan_rtl.cc
index 6be79eab6a5..48fd87a8db8 100644
--- a/compiler-rt/lib/asan/asan_rtl.cc
+++ b/compiler-rt/lib/asan/asan_rtl.cc
@@ -331,12 +331,12 @@ static void ASAN_OnSIGILL(int, siginfo_t *siginfo, void *context) {
}
// 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 @@ ASAN_REPORT_ERROR(store, true, 16)
// 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 @@ void __asan_init() {
asanThreadRegistry().Init();
asanThreadRegistry().GetMain()->ThreadStart();
- __asan_force_interface_symbols(); // no-op.
+ force_interface_symbols(); // no-op.
if (FLAG_v) {
Report("AddressSanitizer Init done\n");
OpenPOWER on IntegriCloud