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

Unified Diff: build/toolchain/mac/linker_driver.py

Issue 2157573002: [Mac/GN] Add a new linker_driver.py option to save unstripped linker output. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compiler config Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/toolchain/mac/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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),
]
« no previous file with comments | « build/toolchain/mac/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698