Index: build/toolchain/mac/linker_driver.py |
diff --git a/build/toolchain/mac/linker_driver.py b/build/toolchain/mac/linker_driver.py |
index 9aa4b414ef150f4d6137e013e347bd2b7e132766..40676f6427dfb882840d2b9418ba21143633b5d5 100755 |
--- a/build/toolchain/mac/linker_driver.py |
+++ b/build/toolchain/mac/linker_driver.py |
@@ -185,7 +185,15 @@ def _FindLinkerOutput(full_args): |
argument list. As this is a required linker argument, raises an error if it |
cannot be found. |
""" |
- return full_args[full_args.index('-o') + 1] |
+ # The linker_driver.py script may be used to wrap either the compiler linker |
+ # (uses -o to configure the output) or lipo (uses -output to configure the |
+ # output). Since wrapping the compiler linker is the most likely possibility |
+ # use try/except and fallback to checking for -output if -o is not found. |
+ try: |
+ output_flag_index = full_args.index('-o') |
+ except ValueError: |
+ output_flag_index = full_args.index('-output') |
+ return full_args[output_flag_index + 1] |
def _RemovePath(path): |