OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright 2016 The Chromium Authors. All rights reserved. | 3 # Copyright 2016 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 import os | 7 import os |
8 import os.path | 8 import os.path |
9 import shutil | 9 import shutil |
10 import subprocess | 10 import subprocess |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 located. | 123 located. |
124 full_args: list of string, Full argument list for the linker driver. | 124 full_args: list of string, Full argument list for the linker driver. |
125 | 125 |
126 Returns: | 126 Returns: |
127 list of string, Build step outputs. | 127 list of string, Build step outputs. |
128 """ | 128 """ |
129 if not len(dsym_path_prefix): | 129 if not len(dsym_path_prefix): |
130 raise ValueError('Unspecified dSYM output file') | 130 raise ValueError('Unspecified dSYM output file') |
131 | 131 |
132 linker_out = _FindLinkerOutput(full_args) | 132 linker_out = _FindLinkerOutput(full_args) |
133 (head, tail) = os.path.split(linker_out) | 133 base = os.path.basename(linker_out) |
134 dsym_out = os.path.join(dsym_path_prefix, tail + '.dSYM') | 134 dsym_out = os.path.join(dsym_path_prefix, base + '.dSYM') |
135 | 135 |
136 # Remove old dSYMs before invoking dsymutil. | 136 # Remove old dSYMs before invoking dsymutil. |
137 _RemovePath(dsym_out) | 137 _RemovePath(dsym_out) |
138 subprocess.check_call(['xcrun', 'dsymutil', '-o', dsym_out, linker_out]) | 138 subprocess.check_call(['xcrun', 'dsymutil', '-o', dsym_out, linker_out]) |
139 return [dsym_out] | 139 return [dsym_out] |
140 | 140 |
141 | 141 |
142 def RunSaveUnstripped(unstripped_path_prefix, full_args): | 142 def RunSaveUnstripped(unstripped_path_prefix, full_args): |
143 """Linker driver action for -Wcrl,unstripped,<unstripped_path_prefix>. Copies | 143 """Linker driver action for -Wcrl,unstripped,<unstripped_path_prefix>. Copies |
144 the linker output to |unstripped_path_prefix| before stripping. | 144 the linker output to |unstripped_path_prefix| before stripping. |
145 | 145 |
146 Args: | 146 Args: |
147 unstripped_path_prefix: string, The path at which the unstripped output | 147 unstripped_path_prefix: string, The path at which the unstripped output |
148 should be located. | 148 should be located. |
149 full_args: list of string, Full argument list for the linker driver. | 149 full_args: list of string, Full argument list for the linker driver. |
150 | 150 |
151 Returns: | 151 Returns: |
152 list of string, Build step outputs. | 152 list of string, Build step outputs. |
153 """ | 153 """ |
154 if not len(unstripped_path_prefix): | 154 if not len(unstripped_path_prefix): |
155 raise ValueError('Unspecified unstripped output file') | 155 raise ValueError('Unspecified unstripped output file') |
156 | 156 |
157 linker_out = _FindLinkerOutput(full_args) | 157 linker_out = _FindLinkerOutput(full_args) |
158 (head, tail) = os.path.split(linker_out) | 158 base = os.path.basename(linker_out) |
159 unstripped_out = os.path.join(unstripped_path_prefix, tail + '.unstripped') | 159 unstripped_out = os.path.join(unstripped_path_prefix, base + '.unstripped') |
160 | 160 |
161 shutil.copyfile(linker_out, unstripped_out) | 161 shutil.copyfile(linker_out, unstripped_out) |
162 return [unstripped_out] | 162 return [unstripped_out] |
163 | 163 |
164 | 164 |
165 def RunStrip(strip_args_string, full_args): | 165 def RunStrip(strip_args_string, full_args): |
166 """Linker driver action for -Wcrl,strip,<strip_arguments>. | 166 """Linker driver action for -Wcrl,strip,<strip_arguments>. |
167 | 167 |
168 Args: | 168 Args: |
169 strip_args_string: string, Comma-separated arguments for `strip`. | 169 strip_args_string: string, Comma-separated arguments for `strip`. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 _LINKER_DRIVER_ACTIONS = [ | 214 _LINKER_DRIVER_ACTIONS = [ |
215 ('dsym,', RunDsymUtil), | 215 ('dsym,', RunDsymUtil), |
216 ('unstripped,', RunSaveUnstripped), | 216 ('unstripped,', RunSaveUnstripped), |
217 ('strip,', RunStrip), | 217 ('strip,', RunStrip), |
218 ] | 218 ] |
219 | 219 |
220 | 220 |
221 if __name__ == '__main__': | 221 if __name__ == '__main__': |
222 Main(sys.argv) | 222 Main(sys.argv) |
223 sys.exit(0) | 223 sys.exit(0) |
OLD | NEW |