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 template defines a GCC toolchain. | 5 # This template defines a GCC toolchain. |
6 # | 6 # |
7 # It requires the following variables specifying the executables to run: | 7 # It requires the following variables specifying the executables to run: |
8 # - cc | 8 # - cc |
9 # - cxx | 9 # - cxx |
10 # - ar | 10 # - ar |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 depfile = "\$out.d" | 73 depfile = "\$out.d" |
74 deps = "gcc" | 74 deps = "gcc" |
75 } | 75 } |
76 tool("alink") { | 76 tool("alink") { |
77 command = "rm -f \$out && $ar rcs \$out @\$rspfile" | 77 command = "rm -f \$out && $ar rcs \$out @\$rspfile" |
78 description = "AR \$out" | 78 description = "AR \$out" |
79 rspfile = "\$out.rsp" | 79 rspfile = "\$out.rsp" |
80 rspfile_content = "\$in" | 80 rspfile_content = "\$in" |
81 } | 81 } |
82 tool("solink") { | 82 tool("solink") { |
83 command = "if [ ! -e \$lib -o ! -e \${lib}.TOC ]; then $ld -shared \$ldfla gs -o \$lib -Wl,-soname=\$soname @\$rspfile && { readelf -d \${lib} | grep SONAM E ; nm -gD -f p \${lib} | cut -f1-2 -d' '; } > \${lib}.TOC; else $ld -shared \$l dflags -o \$lib -Wl,-soname=\$soname -Wl,--whole-archive \$in \$solibs -Wl,--no- whole-archive $libs_section_prefix \$libs $libs_section_postfix && { readelf -d \${lib} | grep SONAME ; nm -gD -f p \${lib} | cut -f1-2 -d' '; } > \${lib}.tmp & & if ! cmp -s \${lib}.tmp \${lib}.TOC; then mv \${lib}.tmp \${lib}.TOC ; fi; fi" | 83 rspfile = "\$out.rsp" |
84 rspfile_content = "-Wl,--whole-archive \$in \$solibs -Wl,--no-whole-archiv e $libs_section_prefix \$libs $libs_section_postfix" | |
85 | |
86 # TODO(cjhopman): There needs to be a way for gn to correctly figure out | |
87 # the outputs of a solink command. | |
cjhopman
2014/07/07 23:00:50
Currently, it looks like gn doesn't know about the
brettw
2014/07/08 22:06:54
I don't know the plan for this either, something w
| |
88 | |
89 link_command = "$ld -shared \$ldflags -o \$lib -Wl,-soname=\$soname $rspfi le_content" | |
90 toc_command = "{ readelf -d \${lib} | grep SONAME ; nm -gD -f p \${lib} | cut -f1-2 -d' '; } > \${lib}.tmp" | |
91 replace_command = "if ! cmp -s \${lib}.tmp \${lib}.TOC; then mv \${lib}.tm p \${lib}.TOC; fi" | |
92 command = "$link_command && $toc_command && $replace_command" | |
cjhopman
2014/07/07 23:00:50
This is slightly different from the previous versi
| |
93 | |
94 if (defined(invoker.postsolink)) { | |
brettw
2014/07/08 22:06:54
Can you add the extra stuff you added to the optio
| |
95 command += " && " + invoker.postsolink | |
96 } | |
97 | |
84 description = "SOLINK \$lib" | 98 description = "SOLINK \$lib" |
85 rspfile = "\$out.rsp" | |
86 rspfile_content = "-Wl,--whole-archive \$in \$solibs -Wl,--no-whole-archiv e \$libs" | |
87 #pool = "link_pool" | 99 #pool = "link_pool" |
88 restat = "1" | 100 restat = "1" |
89 } | 101 } |
90 tool("link") { | 102 tool("link") { |
91 command = "$ld \$ldflags -o \$out -Wl,--start-group @\$rspfile \$solibs -W l,--end-group $libs_section_prefix \$libs $libs_section_postfix" | 103 command = "$ld \$ldflags -o \$out -Wl,--start-group @\$rspfile \$solibs -W l,--end-group $libs_section_prefix \$libs $libs_section_postfix" |
92 description = "LINK \$out" | 104 description = "LINK \$out" |
93 rspfile = "\$out.rsp" | 105 rspfile = "\$out.rsp" |
94 rspfile_content = "\$in" | 106 rspfile_content = "\$in" |
95 #pool = "link_pool" | 107 #pool = "link_pool" |
96 } | 108 } |
(...skipping 11 matching lines...) Expand all Loading... | |
108 toolchain_args() { | 120 toolchain_args() { |
109 cpu_arch = invoker.toolchain_cpu_arch | 121 cpu_arch = invoker.toolchain_cpu_arch |
110 os = invoker.toolchain_os | 122 os = invoker.toolchain_os |
111 } | 123 } |
112 | 124 |
113 if (defined(invoker.deps)) { | 125 if (defined(invoker.deps)) { |
114 deps = invoker.deps | 126 deps = invoker.deps |
115 } | 127 } |
116 } | 128 } |
117 } | 129 } |
OLD | NEW |