Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(627)

Unified Diff: build/toolchain/gcc_toolchain.gni

Issue 2175413004: Enable whitelist generation for all builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed agrieve's comments and removed stderr filtering. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: build/toolchain/gcc_toolchain.gni
diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni
index 4cdd0461aa9851b0cb4f1eade6532c77814d3b5f..33638e34666fb2ea9e8ef4a804f8022b7af6bfb9 100644
--- a/build/toolchain/gcc_toolchain.gni
+++ b/build/toolchain/gcc_toolchain.gni
@@ -10,6 +10,7 @@ import("//build/toolchain/cc_wrapper.gni")
import("//build/toolchain/goma.gni")
import("//build/toolchain/toolchain.gni")
import("//build/toolchain/concurrent_links.gni")
+import("//tools/grit/grit_rule.gni")
# This template defines a toolchain for something that works like gcc
# (including clang).
@@ -223,23 +224,43 @@ template("gcc_toolchain") {
object_subdir = "{{target_out_dir}}/{{label_name}}"
tool("cc") {
+ if (enable_resource_whitelist_generation) {
+ whitelistfile = "{{output}}.whitelist"
+ } else {
+ whitelistfile = ""
+ }
depfile = "{{output}}.d"
command = "$cc -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}}${extra_cppflags}${extra_cflags} -c {{source}} -o {{output}}"
depsformat = "gcc"
description = "CC {{output}}"
outputs = [
+ # The whitelist file is also an output, but ninja does not
+ # currently support multiple outputs for tool("cc").
"$object_subdir/{{source_name_part}}.o",
]
+ compile_wrapper = rebase_path("//build/toolchain/gcc_compile_wrapper.py",
+ root_build_dir)
+ command = "$python_path \"$compile_wrapper\" --resource-whitelist=\"$whitelistfile\" $command"
agrieve 2016/07/29 01:55:21 For all of these commands, we should not pass --re
estevenson 2016/07/29 15:33:57 Done.
}
tool("cxx") {
+ if (enable_resource_whitelist_generation) {
+ whitelistfile = "{{output}}.whitelist"
+ } else {
+ whitelistfile = ""
+ }
depfile = "{{output}}.d"
command = "$cxx -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}}${extra_cppflags}${extra_cxxflags} -c {{source}} -o {{output}}"
depsformat = "gcc"
description = "CXX {{output}}"
outputs = [
+ # The whitelist file is also an output, but ninja does not
+ # currently support multiple outputs for tool("cxx").
"$object_subdir/{{source_name_part}}.o",
]
+ compile_wrapper = rebase_path("//build/toolchain/gcc_compile_wrapper.py",
+ root_build_dir)
+ command = "$python_path \"$compile_wrapper\" --resource-whitelist=\"$whitelistfile\" $command"
}
tool("asm") {
@@ -255,13 +276,18 @@ template("gcc_toolchain") {
tool("alink") {
rspfile = "{{output}}.rsp"
+ if (enable_resource_whitelist_generation) {
+ whitelistfile = "{{output}}.whitelist"
+ } else {
+ whitelistfile = ""
+ }
# This needs a Python script to avoid using simple sh features in this
# command, in case the host does not use a POSIX shell (e.g. compiling
# POSIX-like toolchains such as NaCl on Windows).
ar_wrapper =
rebase_path("//build/toolchain/gcc_ar_wrapper.py", root_build_dir)
- command = "$python_path \"$ar_wrapper\" --output={{output}} --ar=\"$ar\" {{arflags}} rcsD @\"$rspfile\""
+ command = "$python_path \"$ar_wrapper\" --resource-whitelist=\"$whitelistfile\" --output={{output}} --ar=\"$ar\" {{arflags}} rcsD @\"$rspfile\""
description = "AR {{output}}"
rspfile_content = "{{inputs}}"
outputs = [
@@ -279,6 +305,11 @@ template("gcc_toolchain") {
soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so".
sofile = "{{output_dir}}/$soname" # Possibly including toolchain dir.
rspfile = sofile + ".rsp"
+ if (enable_resource_whitelist_generation) {
+ whitelistfile = "$sofile.whitelist"
agrieve 2016/07/29 01:55:21 nit: whitelistfile -> whitelist_file
estevenson 2016/07/29 15:33:57 Done.
+ } else {
+ whitelistfile = ""
+ }
if (defined(invoker.strip)) {
unstripped_sofile = "{{root_out_dir}}/lib.unstripped/$soname"
@@ -305,7 +336,7 @@ template("gcc_toolchain") {
# requiring sh control structures, pipelines, and POSIX utilities.
# The host might not have a POSIX shell and utilities (e.g. Windows).
solink_wrapper = rebase_path("//build/toolchain/gcc_solink_wrapper.py")
- command = "$python_path \"$solink_wrapper\" --readelf=\"$readelf\" --nm=\"$nm\" $strip_switch --sofile=\"$unstripped_sofile\" --tocfile=\"$tocfile\" --output=\"$sofile\" -- $link_command"
+ command = "$python_path \"$solink_wrapper\" --readelf=\"$readelf\" --nm=\"$nm\" $strip_switch --sofile=\"$unstripped_sofile\" --tocfile=\"$tocfile\" --output=\"$sofile\" --resource-whitelist=\"$whitelistfile\" -- $link_command"
rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive $solink_libs_section_prefix {{libs}} $solink_libs_section_postfix"
@@ -333,6 +364,7 @@ template("gcc_toolchain") {
outputs = [
sofile,
tocfile,
+ whitelistfile,
agrieve 2016/07/29 01:55:21 Should not list this in outputs unless enable_reso
estevenson 2016/07/29 15:33:57 Done.
]
if (sofile != unstripped_sofile) {
outputs += [ unstripped_sofile ]

Powered by Google App Engine
This is Rietveld 408576698