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..9aa4b414ef150f4d6137e013e347bd2b7e132766 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') |
+ |
+ shutil.copyfile(linker_out, unstripped_out) |
+ 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), |
] |