| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 # This value will be inherited in the toolchain below. | 5 # This value will be inherited in the toolchain below. |
| 6 concurrent_links = exec_script("get_concurrent_links.py", [], "value") | 6 concurrent_links = exec_script("get_concurrent_links.py", [], "value") |
| 7 | 7 |
| 8 # This template defines a toolchain for something that works like gcc | 8 # This template defines a toolchain for something that works like gcc |
| 9 # (including clang). | 9 # (including clang). |
| 10 # | 10 # |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 # - solink_libs_section_postfix | 31 # - solink_libs_section_postfix |
| 32 # Same as libs_section_{pre,post}fix except used for solink instead of link
. | 32 # Same as libs_section_{pre,post}fix except used for solink instead of link
. |
| 33 # - post_solink | 33 # - post_solink |
| 34 # The content of this string, if specified, will be appended to the solink | 34 # The content of this string, if specified, will be appended to the solink |
| 35 # command. | 35 # command. |
| 36 # - deps | 36 # - deps |
| 37 # Just forwarded to the toolchain definition. | 37 # Just forwarded to the toolchain definition. |
| 38 # - is_clang | 38 # - is_clang |
| 39 # - strip | 39 # - strip |
| 40 # Location of the strip executable. When specified, strip will be run on | 40 # Location of the strip executable. When specified, strip will be run on |
| 41 # all shared libraries and executables as they are built. The pre-stripped | 41 # all executables as they are built. The stripped artifacts will be put in |
| 42 # artifacts will be put in lib.stripped/ and exe.stripped/. | 42 # exe.stripped/. |
| 43 template("gcc_toolchain") { | 43 template("gcc_toolchain") { |
| 44 toolchain(target_name) { | 44 toolchain(target_name) { |
| 45 assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value") | 45 assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value") |
| 46 assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value") | 46 assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value") |
| 47 assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") | 47 assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") |
| 48 assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value") | 48 assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value") |
| 49 assert(defined(invoker.readelf), | 49 assert(defined(invoker.readelf), |
| 50 "gcc_toolchain() must specify a \"readelf\" value") | 50 "gcc_toolchain() must specify a \"readelf\" value") |
| 51 assert(defined(invoker.nm), "gcc_toolchain() must specify a \"nm\" value") | 51 assert(defined(invoker.nm), "gcc_toolchain() must specify a \"nm\" value") |
| 52 assert(defined(invoker.toolchain_cpu), | 52 assert(defined(invoker.toolchain_cpu), |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 outputs += invoker.solink_outputs | 185 outputs += invoker.solink_outputs |
| 186 } | 186 } |
| 187 link_output = sofile | 187 link_output = sofile |
| 188 depend_output = tocfile | 188 depend_output = tocfile |
| 189 } | 189 } |
| 190 | 190 |
| 191 tool("link") { | 191 tool("link") { |
| 192 exename = "{{target_output_name}}{{output_extension}}" | 192 exename = "{{target_output_name}}{{output_extension}}" |
| 193 outfile = "{{root_out_dir}}/$exename" | 193 outfile = "{{root_out_dir}}/$exename" |
| 194 rspfile = "$outfile.rsp" | 194 rspfile = "$outfile.rsp" |
| 195 unstripped_outfile = outfile | |
| 196 | 195 |
| 197 if (defined(invoker.strip)) { | 196 if (defined(invoker.strip)) { |
| 198 unstripped_outfile = "{{root_out_dir}}/exe.unstripped/$exename" | 197 stripped_outfile = "{{root_out_dir}}/exe.stripped/$exename" |
| 199 } | 198 } |
| 200 | 199 |
| 201 command = "$ld {{ldflags}} -o $unstripped_outfile -Wl,--start-group @$rspf
ile {{solibs}} -Wl,--end-group $libs_section_prefix {{libs}} $libs_section_postf
ix" | 200 command = "$ld {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solib
s}} -Wl,--end-group $libs_section_prefix {{libs}} $libs_section_postfix" |
| 202 if (defined(invoker.strip)) { | 201 if (defined(invoker.strip)) { |
| 203 strip = invoker.strip | 202 strip = invoker.strip |
| 204 strip_command = | 203 strip_command = |
| 205 "${strip} --strip-unneeded -o $outfile $unstripped_outfile" | 204 "${strip} --strip-unneeded -o $stripped_outfile $outfile" |
| 206 command += " && " + strip_command | 205 command += " && " + strip_command |
| 207 } | 206 } |
| 208 if (defined(invoker.postlink)) { | 207 if (defined(invoker.postlink)) { |
| 209 command += " && " + invoker.postlink | 208 command += " && " + invoker.postlink |
| 210 } | 209 } |
| 211 description = "LINK $outfile" | 210 description = "LINK $outfile" |
| 212 rspfile_content = "{{inputs}}" | 211 rspfile_content = "{{inputs}}" |
| 213 outputs = [ | 212 outputs = [ |
| 214 outfile, | 213 outfile, |
| 215 ] | 214 ] |
| 216 if (outfile != unstripped_outfile) { | 215 if (defined(invoker.strip)) { |
| 217 outputs += [ unstripped_outfile ] | 216 outputs += [ stripped_outfile ] |
| 218 } | 217 } |
| 219 if (defined(invoker.link_outputs)) { | 218 if (defined(invoker.link_outputs)) { |
| 220 outputs += invoker.link_outputs | 219 outputs += invoker.link_outputs |
| 221 } | 220 } |
| 222 } | 221 } |
| 223 | 222 |
| 224 tool("stamp") { | 223 tool("stamp") { |
| 225 command = "touch {{output}}" | 224 command = "touch {{output}}" |
| 226 description = "STAMP {{output}}" | 225 description = "STAMP {{output}}" |
| 227 } | 226 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 244 if (defined(invoker.is_clang)) { | 243 if (defined(invoker.is_clang)) { |
| 245 is_clang = invoker.is_clang | 244 is_clang = invoker.is_clang |
| 246 } | 245 } |
| 247 } | 246 } |
| 248 | 247 |
| 249 if (defined(invoker.deps)) { | 248 if (defined(invoker.deps)) { |
| 250 deps = invoker.deps | 249 deps = invoker.deps |
| 251 } | 250 } |
| 252 } | 251 } |
| 253 } | 252 } |
| OLD | NEW |