Chromium Code Reviews| Index: build/toolchain/mac/linker_driver.py |
| diff --git a/build/toolchain/mac/linker_driver.py b/build/toolchain/mac/linker_driver.py |
| index 50ba540c34b877ebd9f74e398013cd47ddf190cc..e2063a001e8e16617a321342d7f042c11b3ff005 100755 |
| --- a/build/toolchain/mac/linker_driver.py |
| +++ b/build/toolchain/mac/linker_driver.py |
| @@ -31,6 +31,10 @@ import sys |
| # "... -o out/gn/obj/foo/libbar.dylib ... -Wcrl,dsym,out/gn ..." |
| # The resulting dSYM would be out/gn/libbar.dylib.dSYM/. |
| # |
| +# -Wcrl,unstripped,<unstripped_path_prefix> |
| +# After invoking the linker, and before strip, this will save a copy of |
| +# the unstripped linker output in the directory unstripped_path_prefix. |
| +# |
| # -Wcrl,strip,<strip_arguments> |
| # After invoking the linker, and optionally dsymutil, this will run |
| # the strip command on the linker's output. strip_arguments are |
| @@ -135,6 +139,29 @@ def RunDsymUtil(dsym_path_prefix, full_args): |
| return [dsym_out] |
| +def RunSaveUnstripped(unstripped_path_prefix, full_args): |
| + """Linker driver action for -Wcrl,unstripped,<unstripped_path_prefix>. Copies |
| + the linker output to |unstripped_path_prefix| before stripping. |
| + |
| + Args: |
| + unstripped_path_prefix: string, The path at which the unstripped output |
| + should be located. |
| + full_args: list of string, Full argument list for the linker driver. |
| + |
| + Returns: |
| + list of string, Build step outputs. |
| + """ |
| + if not len(unstripped_path_prefix): |
| + raise ValueError('Unspecified unstripped output file') |
| + |
| + linker_out = _FindLinkerOutput(full_args) |
| + (head, tail) = os.path.split(linker_out) |
| + unstripped_out = os.path.join(unstripped_path_prefix, tail + '.unstripped') |
|
Mark Mentovai
2016/07/15 19:24:17
I like x.unstripped. Easier to find than unstrippe
Robert Sesek
2016/07/15 20:50:22
Acknowledged.
|
| + |
| + shutil.copy(linker_out, unstripped_out) |
|
Mark Mentovai
2016/07/15 19:24:17
Maybe copyfile to drop the x bits. No need to enco
Robert Sesek
2016/07/15 20:50:22
Yeah that'll make tab-complete nicer too.
|
| + return [unstripped_out] |
| + |
| + |
| def RunStrip(strip_args_string, full_args): |
| """Linker driver action for -Wcrl,strip,<strip_arguments>. |
| @@ -178,6 +205,7 @@ argument's -Wcrl,<sub_argument> and the second is the function to invoke. |
| """ |
| _LINKER_DRIVER_ACTIONS = [ |
| ('dsym,', RunDsymUtil), |
| + ('unstripped,', RunSaveUnstripped), |
| ('strip,', RunStrip), |
| ] |