-
Notifications
You must be signed in to change notification settings - Fork 3
/
soaap-ninja-v32.diff
107 lines (103 loc) · 6.15 KB
/
soaap-ninja-v32.diff
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
--- out/Release/build.ninja 2014-04-09 12:52:02.795072764 +0000
+++ out/Release/build.ninja 2014-04-09 12:52:28.997065887 +0000
@@ -1,14 +1,25 @@
-cc = cc
-cxx = c++
+soaap_llvm_path = /replace/with/your/SOAAP/llvm
+soaap_build_path = /replace/with/your/SOAAP/builddir
+soaap_chromium_path = /replace/with/your/SOAAP/chromium
+
+cc = $soaap_llvm_path/bin/clang
+cxx = $soaap_llvm_path/bin/clang++ -stdlib=libc++
ld = $cc
ldxx = $cxx
ar = /usr/bin/ar
+llc = $soaap_llvm_path/bin/llc
+llvm_file_map = $soaap_chromium_path/llvm-file-map
+llvm_link_wrapper = $soaap_chromium_path/llvm-link-wrapper
+soaap_binary = $soaap_build_path/bin/soaap
+soaap_include_dir = $soaap_build_path/include
+
+SOAAP_FLAGS = --soaap-sandbox-platform=capsicum --soaap-summarise-traces=10
pool link_pool
depth = 1
rule cc
- command = $cc -MMD -MF $out.d $defines $includes $cflags $cflags_c $cflags_pch_c -c $in -o $out
+ command = $cc -MMD -MF $out.d $defines $includes -I$soaap_include_dir $cflags $cflags_c $cflags_pch_c -c $in -o $out && $cc -DSOAAP -MMD -MF $out.d $defines $includes `echo $cflags | sed 's/O2/O0/g'` `echo $cflags_c | sed 's/O2/O0/g'` `echo $cflags_pch_c | sed 's/O2/O0/g'` -I$soaap_include_dir -c $in -gline-tables-only -emit-llvm -o $out.bc
description = CC $out
depfile = $out.d
deps = gcc
@@ -16,21 +27,21 @@
command = $cc $defines $includes $cflags $cflags_c $cflags_pch_c -c $in -o $out
description = CC $out
rule cxx
- command = $cxx -MMD -MF $out.d $defines $includes $cflags $cflags_cc $cflags_pch_cc -c $in -o $out
+ command = $cxx -MMD -MF $out.d $defines $includes -I$soaap_include_dir $cflags $cflags_cc $cflags_pch_cc -c $in -o $out && $cxx -MMD -MF $out.d $defines $includes `echo $cflags | sed 's/O2/O0/g'` `echo $cflags_cc | sed 's/O2/O0/g' | sed 's/-fno-rtti//g'` `echo $cflags_pch_cc | sed 's/O2/O0/g'` -c $in -gline-tables-only -gsoaap -emit-llvm -DSOAAP -I$soaap_include_dir -o $out.bc
description = CXX $out
depfile = $out.d
deps = gcc
rule alink
- command = rm -f $out && $ar rcs $out $in
+ command = rm -f $out && $ar rcs $out $in && rm -f $out.bc && $llvm_link_wrapper $out.bc `$llvm_file_map $in`
description = AR $out
rule alink_thin
- command = rm -f $out && $ar rcsT $out $in
+ command = rm -f $out && $ar rcsT $out $in && rm -f $out.bc && $llvm_link_wrapper $out.bc `$llvm_file_map $in`
description = AR $out
rule solink
command = if [ ! -e $lib -o ! -e ${lib}.TOC ]; then $ld -shared $ldflags -o $lib -Wl,-soname=$soname $
- -Wl,--whole-archive $in $solibs -Wl,--no-whole-archive $libs && { readelf -d ${lib} | grep SONAME ; nm -gD -f p $
+ -Wl,--whole-archive $in $solibs -Wl,--no-whole-archive $libs && { readelf -d ${lib} | grep SONAME && nm -gD -f p $
${lib} | cut -f1-2 -d' '; } > ${lib}.TOC; else $ld -shared $ldflags -o $lib -Wl,-soname=$soname $
- -Wl,--whole-archive $in $solibs -Wl,--no-whole-archive $libs && { readelf -d ${lib} | grep SONAME ; nm -gD -f p $
+ -Wl,--whole-archive $in $solibs -Wl,--no-whole-archive $libs && { readelf -d ${lib} | grep SONAME && nm -gD -f p $
${lib} | cut -f1-2 -d' '; } > ${lib}.tmp && if ! cmp -s ${lib}.tmp ${lib}.TOC; then mv ${lib}.tmp ${lib}.TOC ; $
fi; fi
description = SOLINK $lib
@@ -38,15 +49,15 @@
restat = 1
rule solink_module
command = if [ ! -e $lib -o ! -e ${lib}.TOC ]; then $ld -shared $ldflags -o $lib -Wl,-soname=$soname $
- -Wl,--start-group $in $solibs -Wl,--end-group $libs && { readelf -d ${lib} | grep SONAME ; nm -gD -f p ${lib} | $
+ -Wl,--start-group $in $solibs -Wl,--end-group $libs && { readelf -d ${lib} | grep SONAME && nm -gD -f p ${lib} | $
cut -f1-2 -d' '; } > ${lib}.TOC; else $ld -shared $ldflags -o $lib -Wl,-soname=$soname -Wl,--start-group $in $
- $solibs -Wl,--end-group $libs && { readelf -d ${lib} | grep SONAME ; nm -gD -f p ${lib} | cut -f1-2 -d' '; } > $
+ $solibs -Wl,--end-group $libs && { readelf -d ${lib} | grep SONAME && nm -gD -f p ${lib} | cut -f1-2 -d' '; } > $
${lib}.tmp && if ! cmp -s ${lib}.tmp ${lib}.TOC; then mv ${lib}.tmp ${lib}.TOC ; fi; fi
description = SOLINK(module) $lib
pool = link_pool
restat = 1
rule link
- command = $ld $ldflags -o $out -Wl,--start-group $in $solibs -Wl,--end-group $libs
+ command = $ld $ldflags -o $out -Wl,--start-group $in $solibs -Wl,--end-group $libs && $llvm_link_wrapper $out.bc `$llvm_file_map $in`
description = LINK $out
pool = link_pool
rule stamp
@@ -55,6 +66,15 @@
rule copy
command = ln -f $in $out 2>/dev/null || (rm -rf $out && cp -af $in $out)
description = COPY $in $out
+rule llc
+ command = $llc -filetype=obj $in
+ description = LLC $out
+rule chromebclink
+ command = $ld -B /usr/local/bin -Wl,-z,now -Wl,-z,relro -Wl,--unresolved-symbols=ignore-all -pthread -Wl,-z,noexecstack -fPIC -Wl,--no-keep-memory -L. -L/usr/local/lib -L/usr/local/lib/nss -Wl,-O1 -Wl,--as-needed -o $out $in -lX11 -lXcursor -lXrender -lXss -lXext -L/usr/local/lib -lexecinfo -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lglib-2.0 -lintl -lXtst -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -lXinerama -lXi -lXrandr -lXcomposite -lXdamage -lXfixes -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lfreetype -lfontconfig -lnss3 -lsmime3 -lnssutil3 -lplds4 -lplc4 -lnspr4 -lasound -lxml2 -lxslt -lz -liconv -lm -lcups -lssl -lcrypto -pthread -lcrypt -lssp_nonshared -L/usr/local/lib -lgcrypt -lgpg-error -lexpat -lusb -ldbus-1 `cat objfiles.txt | xargs`
+ description = CHROME_BCLINK $out
+rule soaap
+ command = $soaap_binary ${SOAAP_FLAGS} $in
+ description = SOAAP $in
subninja obj/breakpad/breakpad_processor_support.ninja
subninja obj/third_party/webrtc/modules/remote_bitrate_estimator/rbe_components.ninja
@@ -801,6 +821,13 @@
subninja obj/build/chromium_builder_perf_av.ninja
subninja obj/build/chromium_builder_nacl_win_integration.ninja
+# SOAAP-related targets
+build chrome.o : llc chrome.bc
+build chrome.bc : phony chrome
+build chrome.bc.exe : chromebclink chrome.o
+build chrome.soaap : soaap chrome.bc
+build chrome.dbcsoaap : soaap chrome.dbc
+
# Short names for targets.
build inspector_overlay_page: phony gen/blink/InspectorOverlayPage.h
build common_video: phony obj/third_party/webrtc/common_video/libcommon_video.a