[llvm-commits] [compiler-rt] r146529 - in /compiler-rt/trunk/lib/asan: Makefile.old asan_rtl.cc
Kostya Serebryany
kcc at google.com
Tue Dec 13 16:19:03 PST 2011
Author: kcc
Date: Tue Dec 13 18:19:03 2011
New Revision: 146529
URL: http://llvm.org/viewvc/llvm-project?rev=146529&view=rev
Log:
[asan] insert __asan_init into ".preinit_array" section. Linux-only.
Modified:
compiler-rt/trunk/lib/asan/Makefile.old
compiler-rt/trunk/lib/asan/asan_rtl.cc
Modified: compiler-rt/trunk/lib/asan/Makefile.old
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/Makefile.old?rev=146529&r1=146528&r2=146529&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/Makefile.old (original)
+++ compiler-rt/trunk/lib/asan/Makefile.old Tue Dec 13 18:19:03 2011
@@ -287,8 +287,6 @@
$(LIBASAN_A): $(BIN) $(LIBASAN_OBJ) $(MAKEFILE)
mkdir -p $(LIBASAN_INST_DIR)
ar ru $@ $(LIBASAN_OBJ)
- $(CXX) -shared $(CFLAGS) $(LIBASAN_OBJ) $(LD_FLAGS) -o $(BIN)/libasan$(SUFF).so
-
TEST_OBJECTS_COMMON=\
$(BIN)/asan_test$(SUFF).o \
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=146529&r1=146528&r2=146529&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Tue Dec 13 18:19:03 2011
@@ -774,3 +774,11 @@
Report("AddressSanitizer Init done\n");
}
}
+
+#ifdef __linux__
+// On Linux, we force __asan_init to be called before anyone else
+// by placing it into .preinit_array section.
+// FIXME: do we have anything like this on Mac?
+__attribute__((section(".preinit_array")))
+ typeof(__asan_init) *__asan_preinit =__asan_init;
+#endif
More information about the llvm-commits
mailing list