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

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: 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..fb89433c4a8806279633b7a78c4e00997d3a94b7 100644
--- a/build/toolchain/gcc_toolchain.gni
+++ b/build/toolchain/gcc_toolchain.gni
@@ -10,6 +10,15 @@ 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 flag is used to let the compilation and linking steps know that
+# resource whitelisting should be done.
+if (enable_resource_whitelist_generation) {
+ _whitelist_flag = "--whitelist"
agrieve 2016/07/27 01:42:27 nit: move this to be closer to where it is used.
estevenson 2016/07/28 21:56:45 Done.
+} else {
+ _whitelist_flag = ""
+}
# This template defines a toolchain for something that works like gcc
# (including clang).
@@ -230,6 +239,9 @@ template("gcc_toolchain") {
outputs = [
agrieve 2016/07/27 01:42:27 nit: add a comment here that ninja doesn't support
estevenson 2016/07/28 21:56:45 Done.
"$object_subdir/{{source_name_part}}.o",
]
+ compile_wrapper = rebase_path("//build/toolchain/gcc_compile_wrapper.py",
+ root_build_dir)
+ command = "$python_path \"$compile_wrapper\" $_whitelist_flag --whitelist-file={{output}}.whitelist $command"
agrieve 2016/07/27 01:42:27 nit: this will result in a double space when white
estevenson 2016/07/28 21:56:45 Done.
}
tool("cxx") {
@@ -240,6 +252,9 @@ template("gcc_toolchain") {
outputs = [
"$object_subdir/{{source_name_part}}.o",
]
+ compile_wrapper = rebase_path("//build/toolchain/gcc_compile_wrapper.py",
+ root_build_dir)
+ command = "$python_path \"$compile_wrapper\" $_whitelist_flag --whitelist-file={{output}}.whitelist $command"
}
tool("asm") {
@@ -261,7 +276,7 @@ template("gcc_toolchain") {
# 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\" $_whitelist_flag --rspfile=\"$rspfile\" --output={{output}} --ar=\"$ar\" {{arflags}} rcsD @\"$rspfile\""
description = "AR {{output}}"
rspfile_content = "{{inputs}}"
outputs = [
@@ -279,6 +294,7 @@ template("gcc_toolchain") {
soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so".
sofile = "{{output_dir}}/$soname" # Possibly including toolchain dir.
rspfile = sofile + ".rsp"
+ whitelistfile = "{{output_dir}}/$soname.whitelist"
if (defined(invoker.strip)) {
unstripped_sofile = "{{root_out_dir}}/lib.unstripped/$soname"
@@ -305,7 +321,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\" $_whitelist_flag --rspfile=\"$rspfile\" -- $link_command"
rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive $solink_libs_section_prefix {{libs}} $solink_libs_section_postfix"
@@ -333,6 +349,7 @@ template("gcc_toolchain") {
outputs = [
sofile,
tocfile,
+ whitelistfile,
]
if (sofile != unstripped_sofile) {
outputs += [ unstripped_sofile ]

Powered by Google App Engine
This is Rietveld 408576698