OLD | NEW |
---|---|
1 -- Copyright 2011 the V8 project authors. All rights reserved. | 1 -- Copyright 2011 the V8 project authors. All rights reserved. |
2 -- Redistribution and use in source and binary forms, with or without | 2 -- Redistribution and use in source and binary forms, with or without |
3 -- modification, are permitted provided that the following conditions are | 3 -- modification, are permitted provided that the following conditions are |
4 -- met: | 4 -- met: |
5 -- | 5 -- |
6 -- * Redistributions of source code must retain the above copyright | 6 -- * Redistributions of source code must retain the above copyright |
7 -- notice, this list of conditions and the following disclaimer. | 7 -- notice, this list of conditions and the following disclaimer. |
8 -- * Redistributions in binary form must reproduce the above | 8 -- * Redistributions in binary form must reproduce the above |
9 -- copyright notice, this list of conditions and the following | 9 -- copyright notice, this list of conditions and the following |
10 -- disclaimer in the documentation and/or other materials provided | 10 -- disclaimer in the documentation and/or other materials provided |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 local CLANG_PLUGINS = os.getenv "CLANG_PLUGINS" | 83 local CLANG_PLUGINS = os.getenv "CLANG_PLUGINS" |
84 | 84 |
85 if not CLANG_BIN or CLANG_BIN == "" then | 85 if not CLANG_BIN or CLANG_BIN == "" then |
86 error "CLANG_BIN not set" | 86 error "CLANG_BIN not set" |
87 end | 87 end |
88 | 88 |
89 if not CLANG_PLUGINS or CLANG_PLUGINS == "" then | 89 if not CLANG_PLUGINS or CLANG_PLUGINS == "" then |
90 CLANG_PLUGINS = DIR | 90 CLANG_PLUGINS = DIR |
91 end | 91 end |
92 | 92 |
93 local function MakeClangCommandLine(plugin, plugin_args, triple, arch_define) | 93 local function MakeClangCommandLine( |
94 plugin, plugin_args, triple, arch_define, clang_options) | |
94 if plugin_args then | 95 if plugin_args then |
95 for i = 1, #plugin_args do | 96 for i = 1, #plugin_args do |
96 plugin_args[i] = "-Xclang -plugin-arg-" .. plugin | 97 plugin_args[i] = "-Xclang -plugin-arg-" .. plugin |
97 .. " -Xclang " .. plugin_args[i] | 98 .. " -Xclang " .. plugin_args[i] |
98 end | 99 end |
99 plugin_args = " " .. table.concat(plugin_args, " ") | 100 plugin_args = " " .. table.concat(plugin_args, " ") |
100 end | 101 end |
101 return CLANG_BIN .. "/clang++ -std=c++11 -c " | 102 return CLANG_BIN .. "/clang++ -std=c++11 -c " |
102 .. " -Xclang -load -Xclang " .. CLANG_PLUGINS .. "/libgcmole.so" | 103 .. " -Xclang -load -Xclang " .. CLANG_PLUGINS .. "/libgcmole.so" |
103 .. " -Xclang -plugin -Xclang " .. plugin | 104 .. " -Xclang -plugin -Xclang " .. plugin |
104 .. (plugin_args or "") | 105 .. (plugin_args or "") |
105 .. " -Xclang -triple -Xclang " .. triple | 106 .. " -Xclang -triple -Xclang " .. triple |
106 .. " -D" .. arch_define | 107 .. " -D" .. arch_define |
107 .. " -DENABLE_DEBUGGER_SUPPORT" | 108 .. " -DENABLE_DEBUGGER_SUPPORT" |
108 .. " -DV8_I18N_SUPPORT" | 109 .. " -DV8_I18N_SUPPORT" |
109 .. " -I./" | 110 .. " -I./" |
110 .. " -Ithird_party/icu/source/common" | 111 .. " -Ithird_party/icu/source/common" |
111 .. " -Ithird_party/icu/source/i18n" | 112 .. " -Ithird_party/icu/source/i18n" |
113 .. " " .. clang_options | |
112 end | 114 end |
113 | 115 |
114 function InvokeClangPluginForEachFile(filenames, cfg, func) | 116 function InvokeClangPluginForEachFile(filenames, cfg, func) |
115 local cmd_line = MakeClangCommandLine(cfg.plugin, | 117 local cmd_line = MakeClangCommandLine(cfg.plugin, |
116 cfg.plugin_args, | 118 cfg.plugin_args, |
117 cfg.triple, | 119 cfg.triple, |
118 cfg.arch_define) | 120 cfg.arch_define, |
121 cfg.clang_options) | |
Michael Starzinger
2015/02/18 09:41:54
nit: Maybe call this "arch_options" instead? WDYT?
Michael Achenbach
2015/02/18 11:15:29
Done.
| |
119 for _, filename in ipairs(filenames) do | 122 for _, filename in ipairs(filenames) do |
120 log("-- %s", filename) | 123 log("-- %s", filename) |
121 local action = cmd_line .. " " .. filename .. " 2>&1" | 124 local action = cmd_line .. " " .. filename .. " 2>&1" |
122 if FLAGS.verbose then print('popen ', action) end | 125 if FLAGS.verbose then print('popen ', action) end |
123 local pipe = io.popen(action) | 126 local pipe = io.popen(action) |
124 func(filename, pipe:lines()) | 127 func(filename, pipe:lines()) |
125 local success = pipe:close() | 128 local success = pipe:close() |
126 if not success then error("Failed to run: " .. action) end | 129 if not success then error("Failed to run: " .. action) end |
127 end | 130 end |
128 end | 131 end |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
194 | 197 |
195 function mtConfig:extend(t) | 198 function mtConfig:extend(t) |
196 local e = {} | 199 local e = {} |
197 for k, v in pairs(self) do e[k] = v end | 200 for k, v in pairs(self) do e[k] = v end |
198 for k, v in pairs(t) do e[k] = v end | 201 for k, v in pairs(t) do e[k] = v end |
199 return config(e) | 202 return config(e) |
200 end | 203 end |
201 | 204 |
202 local ARCHITECTURES = { | 205 local ARCHITECTURES = { |
203 ia32 = config { triple = "i586-unknown-linux", | 206 ia32 = config { triple = "i586-unknown-linux", |
204 arch_define = "V8_TARGET_ARCH_IA32" }, | 207 arch_define = "V8_TARGET_ARCH_IA32", |
208 clang_options = "-m32" }, | |
205 arm = config { triple = "i586-unknown-linux", | 209 arm = config { triple = "i586-unknown-linux", |
206 arch_define = "V8_TARGET_ARCH_ARM" }, | 210 arch_define = "V8_TARGET_ARCH_ARM", |
211 clang_options = "-m32" }, | |
207 x64 = config { triple = "x86_64-unknown-linux", | 212 x64 = config { triple = "x86_64-unknown-linux", |
208 arch_define = "V8_TARGET_ARCH_X64" }, | 213 arch_define = "V8_TARGET_ARCH_X64", |
214 clang_options = "" }, | |
209 arm64 = config { triple = "x86_64-unknown-linux", | 215 arm64 = config { triple = "x86_64-unknown-linux", |
210 arch_define = "V8_TARGET_ARCH_ARM64" }, | 216 arch_define = "V8_TARGET_ARCH_ARM64", |
217 clang_options = "" }, | |
211 } | 218 } |
212 | 219 |
213 ------------------------------------------------------------------------------- | 220 ------------------------------------------------------------------------------- |
214 -- GCSuspects Generation | 221 -- GCSuspects Generation |
215 | 222 |
216 local gc, gc_caused, funcs | 223 local gc, gc_caused, funcs |
217 | 224 |
218 local WHITELIST = { | 225 local WHITELIST = { |
219 -- The following functions call CEntryStub which is always present. | 226 -- The following functions call CEntryStub which is always present. |
220 "MacroAssembler.*CallExternalReference", | 227 "MacroAssembler.*CallExternalReference", |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
386 | 393 |
387 for _, arch in ipairs(ARCHS) do | 394 for _, arch in ipairs(ARCHS) do |
388 if not ARCHITECTURES[arch] then | 395 if not ARCHITECTURES[arch] then |
389 error ("Unknown arch: " .. arch) | 396 error ("Unknown arch: " .. arch) |
390 end | 397 end |
391 | 398 |
392 errors = SafeCheckCorrectnessForArch(arch, report) or errors | 399 errors = SafeCheckCorrectnessForArch(arch, report) or errors |
393 end | 400 end |
394 | 401 |
395 os.exit(errors and 1 or 0) | 402 os.exit(errors and 1 or 0) |
OLD | NEW |