forked from trailofbits/clang-cfi-showcase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
67 lines (50 loc) · 1.92 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
CXX = clang++-3.9
CC = clang-3.9
GOLD = $(shell pwd)/gold
CFLAGS = -B${GOLD} -Weverything -Werror -pedantic -std=c99 -O0 -fvisibility=hidden -flto -fno-sanitize-trap=all
CXXFLAGS = -B${GOLD} -Weverything -Werror -pedantic -Wno-c++98-compat -Wno-weak-vtables -std=c++11 -O0 -fvisibility=hidden -flto -fno-sanitize-trap=all
CFI_TARGETS = cfi_icall cfi_vcall cfi_nvcall cfi_unrelated_cast cfi_derived_cast cfi_cast_strict
NO_CFI_TARGETS = $(addprefix no_, $(CFI_TARGETS))
TARGETS = $(CFI_TARGETS) $(NO_CFI_TARGETS)
all: $(TARGETS)
cfi_icall: cfi_icall.c
@echo Compiling $< to $@
@$(CC) $(CFLAGS) -fsanitize=cfi-icall -o $@ $<
no_cfi_icall: cfi_icall.c
@echo Compiling $< to $@
@$(CC) $(CFLAGS) -o $@ $<
cfi_vcall: cfi_vcall.cpp
@echo Compiling $< to $@
@$(CXX) $(CXXFLAGS) -fsanitize=cfi-vcall -o $@ $<
no_cfi_vcall: cfi_vcall.cpp
@echo Compiling $< to $@
@$(CXX) $(CXXFLAGS) -o $@ $<
cfi_nvcall: cfi_nvcall.cpp
@echo Compiling $< to $@
@$(CXX) $(CXXFLAGS) -fsanitize=cfi-nvcall -o $@ $<
no_cfi_nvcall: cfi_nvcall.cpp
@echo Compiling $< to $@
@$(CXX) $(CXXFLAGS) -o $@ $<
cfi_unrelated_cast: cfi_unrelated_cast.cpp
@echo Compiling $< to $@
@$(CXX) $(CXXFLAGS) -fsanitize=cfi-unrelated-cast -o $@ $<
no_cfi_unrelated_cast: cfi_unrelated_cast.cpp
@echo Compiling $< to $@
@$(CXX) $(CXXFLAGS) -o $@ $<
cfi_derived_cast: cfi_derived_cast.cpp
@echo Compiling $< to $@
@$(CXX) $(CXXFLAGS) -fsanitize=cfi-derived-cast -o $@ $<
no_cfi_derived_cast: cfi_derived_cast.cpp
@echo Compiling $< to $@
@$(CXX) $(CXXFLAGS) -o $@ $<
cfi_cast_strict: cfi_cast_strict.cpp
@echo Compiling $< to $@
@$(CXX) $(CXXFLAGS) -fsanitize=cfi-derived-cast -fsanitize=cfi-cast-strict -o $@ $<
no_cfi_cast_strict: cfi_cast_strict.cpp
@echo Compiling $< to $@
@# stil use cfi-derived-cast, just not the strict version to
@# show the strict version behavior
@$(CXX) $(CXXFLAGS) -fsanitize=cfi-derived-cast -o $@ $<
clean:
rm -f $(TARGETS)
.PHONY: clean all