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

Side by Side Diff: build/toolchain/gcc_toolchain.gni

Issue 485833003: Pull new GN, update toolchain definitions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Android Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « build/toolchain/android/BUILD.gn ('k') | build/toolchain/mac/BUILD.gn » ('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 # This template defines a toolchain for something that works like gcc 5 # This template defines a toolchain for something that works like gcc
6 # (including clang). 6 # (including clang).
7 # 7 #
8 # It requires the following variables specifying the executables to run: 8 # It requires the following variables specifying the executables to run:
9 # - cc 9 # - cc
10 # - cxx 10 # - cxx
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } else { 68 } else {
69 solink_libs_section_prefix = "" 69 solink_libs_section_prefix = ""
70 } 70 }
71 71
72 if (defined(invoker.solink_libs_section_postfix)) { 72 if (defined(invoker.solink_libs_section_postfix)) {
73 solink_libs_section_postfix = invoker.solink_libs_section_postfix 73 solink_libs_section_postfix = invoker.solink_libs_section_postfix
74 } else { 74 } else {
75 solink_libs_section_postfix = "" 75 solink_libs_section_postfix = ""
76 } 76 }
77 77
78 # Make these apply to all tools below. 78 # These library switches can apply to all tools below.
79 lib_prefix = "-l" 79 lib_switch = "-l"
80 lib_dir_prefix="-L" 80 lib_dir_switch = "-L"
81 81
82 tool("cc") { 82 tool("cc") {
83 # cflags_pch_c 83 depfile = "{{output}}.d"
84 command = "$cc -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_c - c \$in -o \$out" 84 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} { {cflags_c}} -c {{source}} -o {{output}}"
85 description = "CC \$out"
86 depfile = "\$out.d"
87 depsformat = "gcc" 85 depsformat = "gcc"
86 description = "CC {{output}}"
87 outputs = [
88 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
89 ]
88 } 90 }
91
89 tool("cxx") { 92 tool("cxx") {
90 # cflags_pch_cc 93 depfile = "{{output}}.d"
91 command = "$cxx -MMD -MF \$out.d \$defines \$includes \$cflags \$cflags_cc -c \$in -o \$out" 94 command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
92 description = "CXX \$out"
93 depfile = "\$out.d"
94 depsformat = "gcc" 95 depsformat = "gcc"
96 description = "CXX {{output}}"
97 outputs = [
98 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
99 ]
95 } 100 }
101
102 tool("asm") {
103 # For GCC we can just use the C compiler to compile assembly.
104 depfile = "{{output}}.d"
105 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} { {cflags_c}} -c {{source}} -o {{output}}"
106 depsformat = "gcc"
107 description = "ASM {{output}}"
108 outputs = [
109 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
110 ]
111 }
112
96 tool("alink") { 113 tool("alink") {
97 command = "rm -f \$out && $ar rcs \$out @\$rspfile" 114 rspfile = "{{output}}.rsp"
98 description = "AR \$out" 115 command = "rm -f {{output}} && $ar rcs {{output}} @$rspfile"
99 rspfile = "\$out.rsp" 116 description = "AR {{output}}"
100 rspfile_content = "\$in" 117 rspfile_content = "{{inputs}}"
118 outputs = [
119 "{{target_out_dir}}/{{target_output_name}}{{output_extension}}"
120 ]
121 default_output_extension = ".a"
122 output_prefix = "lib"
101 } 123 }
124
102 tool("solink") { 125 tool("solink") {
103 rspfile = "\$out.rsp" 126 soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so".
104 rspfile_content = "-Wl,--whole-archive \$in \$solibs -Wl,--no-whole-archiv e $solink_libs_section_prefix \$libs $solink_libs_section_postfix" 127 rspfile = soname + ".rsp"
105 128
106 # TODO(cjhopman): There needs to be a way for gn to correctly figure out 129 # These variables are not build into GN but are helpers that implement
jamesr 2014/08/20 19:38:27 built
107 # the outputs of a solink command. 130 # (1) linking to produce a .so, (2) extracting the symbols from that file
131 # to a temporary file, (3) if the temporary file has differences from the
132 # existing .TOC file, overwrite it, oterwise, don't change it.
jamesr 2014/08/20 19:38:27 otherwise
133 tocname = soname + ".TOC"
134 temporary_tocname = soname + ".tmp"
135 link_command = "$ld -shared {{ldflags}} -o $soname -Wl,-soname=$soname @$r spfile"
136 toc_command = "{ readelf -d $soname | grep SONAME ; nm -gD -f p $soname | cut -f1-2 -d' '; } > $temporary_tocname"
137 replace_command = "if ! cmp -s $temporary_tocname $tocname; then mv $tempo rary_tocname $tocname; fi"
108 138
109 link_command = "$ld -shared \$ldflags -o \$lib -Wl,-soname=\$soname @\$rsp file"
110 toc_command = "{ readelf -d \${lib} | grep SONAME ; nm -gD -f p \${lib} | cut -f1-2 -d' '; } > \${lib}.tmp"
111 replace_command = "if ! cmp -s \${lib}.tmp \${lib}.TOC; then mv \${lib}.tm p \${lib}.TOC; fi"
112 command = "$link_command && $toc_command && $replace_command" 139 command = "$link_command && $toc_command && $replace_command"
113
114 if (defined(invoker.postsolink)) { 140 if (defined(invoker.postsolink)) {
115 command += " && " + invoker.postsolink 141 command += " && " + invoker.postsolink
116 } 142 }
143 rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whol e-archive $solink_libs_section_prefix {{libs}} $solink_libs_section_postfix"
117 144
118 description = "SOLINK \$lib" 145 description = "SOLINK $soname"
119 #pool = "link_pool" 146
120 restat = "1" 147 # Use this for {{output_extension}} expansions unless a target manually
148 # overrides it (in which case {{output_extension}} will be what the target
149 # specifies).
150 default_output_extension = ".so"
151
152 output_prefix = "lib"
153
154 # Since the above commands only updates the .TOC file when it changes, ask
155 # Ninja to check if the timestamp actually changed to know if downstream
156 # dependencies should be recompiled.
157 restat = true
158
159 # Tell GN about the output files. It will link to the soname but use the
160 # tocname for dependency management.
161 outputs = [
162 soname,
163 tocname,
164 ]
165 link_output = soname
166 depend_output = tocname
121 } 167 }
168
122 tool("link") { 169 tool("link") {
123 command = "$ld \$ldflags -o \$out -Wl,--start-group @\$rspfile \$solibs -W l,--end-group $libs_section_prefix \$libs $libs_section_postfix" 170 outfile = "{{target_output_name}}{{output_extension}}"
124 description = "LINK \$out" 171 rspfile = "$outfile.rsp"
125 rspfile = "\$out.rsp" 172 command = "$ld {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solib s}} -Wl,--end-group $libs_section_prefix {{libs}} $libs_section_postfix"
126 rspfile_content = "\$in" 173 description = "LINK $outfile"
127 #pool = "link_pool" 174 rspfile_content = "{{inputs}}"
175 outputs = [ outfile ]
128 } 176 }
177
129 tool("stamp") { 178 tool("stamp") {
130 command = "\${postbuilds}touch \$out" 179 command = "touch {{output}}"
131 description = "STAMP \$out" 180 description = "STAMP {{output}}"
132 } 181 }
182
133 tool("copy") { 183 tool("copy") {
134 command = "ln -f \$in \$out 2>/dev/null || (rm -rf \$out && cp -af \$in \$ out)" 184 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} & & cp -af {{source}} {{output}})"
135 description = "COPY \$in \$out" 185 description = "COPY {{source}} {{output}}"
136 } 186 }
137 187
138 # When invoking this toolchain not as the default one, these args will be 188 # When invoking this toolchain not as the default one, these args will be
139 # passed to the build. They are ignored when this is the default toolchain. 189 # passed to the build. They are ignored when this is the default toolchain.
140 toolchain_args() { 190 toolchain_args() {
141 cpu_arch = invoker.toolchain_cpu_arch 191 cpu_arch = invoker.toolchain_cpu_arch
142 os = invoker.toolchain_os 192 os = invoker.toolchain_os
143 if (defined(invoker.is_clang)) { 193 if (defined(invoker.is_clang)) {
144 is_clang = invoker.is_clang 194 is_clang = invoker.is_clang
145 } 195 }
146 } 196 }
147 197
148 if (defined(invoker.deps)) { 198 if (defined(invoker.deps)) {
149 deps = invoker.deps 199 deps = invoker.deps
150 } 200 }
151 } 201 }
152 } 202 }
OLDNEW
« no previous file with comments | « build/toolchain/android/BUILD.gn ('k') | build/toolchain/mac/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698