[llvm-commits] [compiler-rt] r156822 - in /compiler-rt/trunk: lib/Makefile.mk lib/tsan/CMakeLists.txt lib/tsan/Makefile.mk lib/tsan/rtl/Makefile.mk make/platform/clang_linux.mk

Kostya Serebryany kcc at google.com
Tue May 15 08:17:35 PDT 2012


Author: kcc
Date: Tue May 15 10:17:35 2012
New Revision: 156822

URL: http://llvm.org/viewvc/llvm-project?rev=156822&view=rev
Log:
[tsan] makefile machinery to build tsan-rt (linux-x86_64 only)

Added:
    compiler-rt/trunk/lib/tsan/CMakeLists.txt
    compiler-rt/trunk/lib/tsan/Makefile.mk
    compiler-rt/trunk/lib/tsan/rtl/Makefile.mk
Modified:
    compiler-rt/trunk/lib/Makefile.mk
    compiler-rt/trunk/make/platform/clang_linux.mk

Modified: compiler-rt/trunk/lib/Makefile.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/Makefile.mk?rev=156822&r1=156821&r2=156822&view=diff
==============================================================================
--- compiler-rt/trunk/lib/Makefile.mk (original)
+++ compiler-rt/trunk/lib/Makefile.mk Tue May 15 10:17:35 2012
@@ -17,6 +17,7 @@
 SubDirs += asan
 SubDirs += interception
 SubDirs += profile
+SubDirs += tsan
 
 # FIXME: We don't currently support building an atomic library, and as it must
 # be a separate library from the runtime library, we need to remove its source

Added: compiler-rt/trunk/lib/tsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/CMakeLists.txt?rev=156822&view=auto
==============================================================================
--- compiler-rt/trunk/lib/tsan/CMakeLists.txt (added)
+++ compiler-rt/trunk/lib/tsan/CMakeLists.txt Tue May 15 10:17:35 2012
@@ -0,0 +1,8 @@
+# Build for the AddressSanitizer runtime support library.
+
+file(GLOB TSAN_SOURCES "*.cc")
+
+if(CAN_TARGET_X86_64)
+  add_library(clang_rt.tsan-x86_64 STATIC ${TSAN_SOURCES})
+  set_target_properties(clang_rt.tsan-x86_64 PROPERTIES COMPILE_FLAGS "${TARGET_X86_64_CFLAGS}")
+endif()

Added: compiler-rt/trunk/lib/tsan/Makefile.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/Makefile.mk?rev=156822&view=auto
==============================================================================
--- compiler-rt/trunk/lib/tsan/Makefile.mk (added)
+++ compiler-rt/trunk/lib/tsan/Makefile.mk Tue May 15 10:17:35 2012
@@ -0,0 +1,18 @@
+#===- lib/tsan/Makefile.mk ---------------------------------*- Makefile -*--===#
+#
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+#===------------------------------------------------------------------------===#
+
+ModuleName := tsan
+SubDirs := rtl
+Sources :=
+ObjNames :=
+Dependencies :=
+
+Implementation := Generic
+
+TsanFunctions :=

Added: compiler-rt/trunk/lib/tsan/rtl/Makefile.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/Makefile.mk?rev=156822&view=auto
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/Makefile.mk (added)
+++ compiler-rt/trunk/lib/tsan/rtl/Makefile.mk Tue May 15 10:17:35 2012
@@ -0,0 +1,23 @@
+#===- lib/tsan/rtl/Makefile.mk -----------------------------*- Makefile -*--===#
+#
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+#===------------------------------------------------------------------------===#
+
+ModuleName := tsan
+SubDirs :=
+
+Sources := $(foreach file,$(wildcard $(Dir)/*.cc),$(notdir $(file)))
+AsmSources := $(foreach file,$(wildcard $(Dir)/*.S),$(notdir $(file)))
+ObjNames := $(Sources:%.cc=%.o) $(AsmSources:%.S=%.o)
+
+Implementation := Generic
+
+# FIXME: use automatic dependencies?
+Dependencies := $(wildcard $(Dir)/*.h)
+
+# Define a convenience variable for all the tsan functions.
+TsanFunctions += $(Sources:%.cc=%) $(AsmSources:%.S=%)

Modified: compiler-rt/trunk/make/platform/clang_linux.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/platform/clang_linux.mk?rev=156822&r1=156821&r2=156822&view=diff
==============================================================================
--- compiler-rt/trunk/make/platform/clang_linux.mk (original)
+++ compiler-rt/trunk/make/platform/clang_linux.mk Tue May 15 10:17:35 2012
@@ -47,6 +47,12 @@
 Arch.asan-x86_64 := x86_64
 endif
 
+# Configuration for TSAN runtime.
+ifeq ($(CompilerTargetArch),x86_64)
+Configs += tsan-x86_64
+Arch.tsan-x86_64 := x86_64
+endif
+
 endif
 
 ###
@@ -59,6 +65,7 @@
 CFLAGS.profile-x86_64 := $(CFLAGS) -m64
 CFLAGS.asan-i386 := $(CFLAGS) -m32
 CFLAGS.asan-x86_64 := $(CFLAGS) -m64
+CFLAGS.tsan-x86_64 := $(CFLAGS) -m64 -fPIE -fno-builtin
 
 # Use our stub SDK as the sysroot to support more portable building. For now we
 # just do this for the non-ASAN modules, because the stub SDK doesn't have
@@ -74,6 +81,7 @@
 FUNCTIONS.profile-x86_64 := GCDAProfiling
 FUNCTIONS.asan-i386 := $(AsanFunctions) $(InterceptionFunctions)
 FUNCTIONS.asan-x86_64 := $(AsanFunctions) $(InterceptionFunctions)
+FUNCTIONS.tsan-x86_64 := $(TsanFunctions) $(InterceptionFunctions)
 
 # Always use optimized variants.
 OPTIMIZED := 1





More information about the llvm-commits mailing list