Skip to content

Commit 57d6f73

Browse files
committed
[sanitizer] Add MSan to Makefile-based build rules.
llvm-svn: 175737
1 parent c975cdc commit 57d6f73

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

compiler-rt/lib/Makefile.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ SubDirs += interception
1919
SubDirs += profile
2020
SubDirs += sanitizer_common
2121
SubDirs += tsan
22+
SubDirs += msan
2223
SubDirs += ubsan
2324

2425
# FIXME: We don't currently support building an atomic library, and as it must

compiler-rt/lib/msan/Makefile.mk

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#===- lib/msan/Makefile.mk ---------------------------------*- Makefile -*--===#
2+
#
3+
# The LLVM Compiler Infrastructure
4+
#
5+
# This file is distributed under the University of Illinois Open Source
6+
# License. See LICENSE.TXT for details.
7+
#
8+
#===------------------------------------------------------------------------===#
9+
10+
ModuleName := msan
11+
SubDirs :=
12+
13+
Sources := $(foreach file,$(wildcard $(Dir)/*.cc),$(notdir $(file)))
14+
ObjNames := $(Sources:%.cc=%.o)
15+
16+
Implementation := Generic
17+
18+
# FIXME: use automatic dependencies?
19+
Dependencies := $(wildcard $(Dir)/*.h)
20+
Dependencies += $(wildcard $(Dir)/../interception/*.h)
21+
Dependencies += $(wildcard $(Dir)/../sanitizer_common/*.h)
22+
23+
# Define a convenience variable for all the msan functions.
24+
MsanFunctions := $(Sources:%.cc=%)

compiler-rt/make/platform/clang_linux.mk

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,13 @@ endif
6060

6161
# Build runtime libraries for x86_64.
6262
ifeq ($(call contains,$(SupportedArches),x86_64),true)
63-
Configs += full-x86_64 profile-x86_64 asan-x86_64 tsan-x86_64 ubsan-x86_64
63+
Configs += full-x86_64 profile-x86_64 asan-x86_64 tsan-x86_64 msan-x86_64 \
64+
ubsan-x86_64
6465
Arch.full-x86_64 := x86_64
6566
Arch.profile-x86_64 := x86_64
6667
Arch.asan-x86_64 := x86_64
6768
Arch.tsan-x86_64 := x86_64
69+
Arch.msan-x86_64 := x86_64
6870
Arch.ubsan-x86_64 := x86_64
6971
endif
7072

@@ -89,6 +91,7 @@ CFLAGS.asan-i386 := $(CFLAGS) -m32 -fPIE -fno-builtin \
8991
CFLAGS.asan-x86_64 := $(CFLAGS) -m64 -fPIE -fno-builtin \
9092
-DASAN_FLEXIBLE_MAPPING_AND_OFFSET=1
9193
CFLAGS.tsan-x86_64 := $(CFLAGS) -m64 -fPIE -fno-builtin
94+
CFLAGS.msan-x86_64 := $(CFLAGS) -m64 -fPIE -fno-builtin
9295
CFLAGS.ubsan-i386 := $(CFLAGS) -m32 -fPIE -fno-builtin
9396
CFLAGS.ubsan-x86_64 := $(CFLAGS) -m64 -fPIE -fno-builtin
9497

@@ -121,6 +124,8 @@ FUNCTIONS.asan-arm-android := $(AsanFunctions) $(InterceptionFunctions) \
121124
$(SanitizerCommonFunctions)
122125
FUNCTIONS.tsan-x86_64 := $(TsanFunctions) $(InterceptionFunctions) \
123126
$(SanitizerCommonFunctions)
127+
FUNCTIONS.msan-x86_64 := $(MsanFunctions) $(InterceptionFunctions) \
128+
$(SanitizerCommonFunctions)
124129
FUNCTIONS.ubsan-i386 := $(UbsanFunctions) $(SanitizerCommonFunctions)
125130
FUNCTIONS.ubsan-x86_64 := $(UbsanFunctions) $(SanitizerCommonFunctions)
126131

0 commit comments

Comments
 (0)