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

Side by Side Diff: build/toolchain/mac/BUILD.gn

Issue 2157573002: [Mac/GN] Add a new linker_driver.py option to save unstripped linker output. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compiler config 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 unified diff | Download patch
« no previous file with comments | « build/config/mac/symbols.gni ('k') | build/toolchain/mac/linker_driver.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 # TODO(brettw) Use "gcc_toolchain.gni" like the Linux toolchains. This requires 5 # TODO(brettw) Use "gcc_toolchain.gni" like the Linux toolchains. This requires
6 # some enhancements since the commands on Mac are slightly different than on 6 # some enhancements since the commands on Mac are slightly different than on
7 # Linux. 7 # Linux.
8 8
9 import("../goma.gni") 9 import("../goma.gni")
10 import("//build/config/clang/clang.gni") 10 import("//build/config/clang/clang.gni")
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 lib_dir_switch = "-L" 97 lib_dir_switch = "-L"
98 98
99 # Object files go in this directory. Use label_name instead of 99 # Object files go in this directory. Use label_name instead of
100 # target_output_name since labels will generally have no spaces and will be 100 # target_output_name since labels will generally have no spaces and will be
101 # unique in the directory. 101 # unique in the directory.
102 object_subdir = "{{target_out_dir}}/{{label_name}}" 102 object_subdir = "{{target_out_dir}}/{{label_name}}"
103 103
104 # If dSYMs are enabled, this flag will be added to the link tools. 104 # If dSYMs are enabled, this flag will be added to the link tools.
105 if (enable_dsyms) { 105 if (enable_dsyms) {
106 dsym_switch = " -Wcrl,dsym," + rebase_path(root_out_dir) + " " 106 dsym_switch = " -Wcrl,dsym," + rebase_path(root_out_dir) + " "
107 _dsym_output =
108 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}.dSYM/"
107 } else { 109 } else {
108 dsym_switch = "" 110 dsym_switch = ""
109 } 111 }
110 112
113 if (save_unstripped_output) {
114 _unstripped_output = "{{root_out_dir}}/{{target_output_name}}{{output_exte nsion}}.unstripped"
115 }
116
111 tool("cc") { 117 tool("cc") {
112 depfile = "{{output}}.d" 118 depfile = "{{output}}.d"
113 precompiled_header_type = "gcc" 119 precompiled_header_type = "gcc"
114 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} { {cflags_c}} -c {{source}} -o {{output}}" 120 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} { {cflags_c}} -c {{source}} -o {{output}}"
115 depsformat = "gcc" 121 depsformat = "gcc"
116 description = "CC {{output}}" 122 description = "CC {{output}}"
117 outputs = [ 123 outputs = [
118 "$object_subdir/{{source_name_part}}.o", 124 "$object_subdir/{{source_name_part}}.o",
119 ] 125 ]
120 } 126 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 # Tell GN about the output files. It will link to the dylib but use the 231 # Tell GN about the output files. It will link to the dylib but use the
226 # tocname for dependency management. 232 # tocname for dependency management.
227 outputs = [ 233 outputs = [
228 dylib, 234 dylib,
229 tocname, 235 tocname,
230 ] 236 ]
231 link_output = dylib 237 link_output = dylib
232 depend_output = tocname 238 depend_output = tocname
233 239
234 if (enable_dsyms) { 240 if (enable_dsyms) {
235 outputs += [ "{{root_out_dir}}/{{target_output_name}}{{output_extension} }.dSYM/" ] 241 outputs += [ _dsym_output ]
242 }
243 if (save_unstripped_output) {
244 outputs += [ _unstripped_output ]
236 } 245 }
237 } 246 }
238 247
239 tool("solink_module") { 248 tool("solink_module") {
240 sofile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # eg "./libfoo.so" 249 sofile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # eg "./libfoo.so"
241 rspfile = sofile + ".rsp" 250 rspfile = sofile + ".rsp"
242 251
243 link_command = "$linker_driver $ld -bundle {{ldflags}} -o \"$sofile\" -Wl, -filelist,\"$rspfile\"" 252 link_command = "$linker_driver $ld -bundle {{ldflags}} -o \"$sofile\" -Wl, -filelist,\"$rspfile\""
244 if (is_component_build) { 253 if (is_component_build) {
245 link_command += " -Wl,-install_name,@rpath/{{target_output_name}}{{outpu t_extension}}" 254 link_command += " -Wl,-install_name,@rpath/{{target_output_name}}{{outpu t_extension}}"
(...skipping 10 matching lines...) Expand all
256 # overrides it (in which case {{output_extension}} will be what the target 265 # overrides it (in which case {{output_extension}} will be what the target
257 # specifies). 266 # specifies).
258 default_output_dir = "{{root_out_dir}}" 267 default_output_dir = "{{root_out_dir}}"
259 default_output_extension = ".so" 268 default_output_extension = ".so"
260 269
261 outputs = [ 270 outputs = [
262 sofile, 271 sofile,
263 ] 272 ]
264 273
265 if (enable_dsyms) { 274 if (enable_dsyms) {
266 outputs += [ "{{root_out_dir}}/{{target_output_name}}{{output_extension} }.dSYM/" ] 275 outputs += [ _dsym_output ]
276 }
277 if (save_unstripped_output) {
278 outputs += [ _unstripped_output ]
267 } 279 }
268 } 280 }
269 281
270 tool("link") { 282 tool("link") {
271 outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" 283 outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}"
272 rspfile = "$outfile.rsp" 284 rspfile = "$outfile.rsp"
273 285
274 # Note about --filelist: Apple's linker reads the file list file and 286 # Note about --filelist: Apple's linker reads the file list file and
275 # interprets each newline-separated chunk of text as a file name. It 287 # interprets each newline-separated chunk of text as a file name. It
276 # doesn't do the things one would expect from the shell like unescaping 288 # doesn't do the things one would expect from the shell like unescaping
277 # or handling quotes. In contrast, when Ninja finds a file name with 289 # or handling quotes. In contrast, when Ninja finds a file name with
278 # spaces, it single-quotes them in $inputs_newline as it would normally 290 # spaces, it single-quotes them in $inputs_newline as it would normally
279 # do for command-line arguments. Thus any source names with spaces, or 291 # do for command-line arguments. Thus any source names with spaces, or
280 # label names with spaces (which GN bases the output paths on) will be 292 # label names with spaces (which GN bases the output paths on) will be
281 # corrupted by this process. Don't use spaces for source files or labels. 293 # corrupted by this process. Don't use spaces for source files or labels.
282 command = "$linker_driver $ld $dsym_switch {{ldflags}} -o \"$outfile\" -Wl ,-filelist,\"$rspfile\" {{solibs}} {{libs}}" 294 command = "$linker_driver $ld $dsym_switch {{ldflags}} -o \"$outfile\" -Wl ,-filelist,\"$rspfile\" {{solibs}} {{libs}}"
283 description = "LINK $outfile" 295 description = "LINK $outfile"
284 rspfile_content = "{{inputs_newline}}" 296 rspfile_content = "{{inputs_newline}}"
285 outputs = [ 297 outputs = [
286 outfile, 298 outfile,
287 ] 299 ]
288 300
289 if (enable_dsyms) { 301 if (enable_dsyms) {
290 outputs += [ "{{root_out_dir}}/{{target_output_name}}{{output_extension} }.dSYM/" ] 302 outputs += [ _dsym_output ]
303 }
304 if (save_unstripped_output) {
305 outputs += [ _unstripped_output ]
291 } 306 }
292 307
293 default_output_dir = "{{root_out_dir}}" 308 default_output_dir = "{{root_out_dir}}"
294 } 309 }
295 310
296 # These two are really entirely generic, but have to be repeated in 311 # These two are really entirely generic, but have to be repeated in
297 # each toolchain because GN doesn't allow a template to be used here. 312 # each toolchain because GN doesn't allow a template to be used here.
298 # See //build/toolchain/toolchain.gni for details. 313 # See //build/toolchain/toolchain.gni for details.
299 tool("stamp") { 314 tool("stamp") {
300 command = stamp_command 315 command = stamp_command
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 401
387 mac_toolchain("ios_clang_x86") { 402 mac_toolchain("ios_clang_x86") {
388 toolchain_cpu = "x86" 403 toolchain_cpu = "x86"
389 toolchain_os = "ios" 404 toolchain_os = "ios"
390 } 405 }
391 406
392 mac_toolchain("ios_clang_x64") { 407 mac_toolchain("ios_clang_x64") {
393 toolchain_cpu = "x64" 408 toolchain_cpu = "x64"
394 toolchain_os = "ios" 409 toolchain_os = "ios"
395 } 410 }
OLDNEW
« no previous file with comments | « build/config/mac/symbols.gni ('k') | build/toolchain/mac/linker_driver.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698