Index: build/toolchain/mac/BUILD.gn |
diff --git a/build/toolchain/mac/BUILD.gn b/build/toolchain/mac/BUILD.gn |
index 82eacab28eba0fb0596b1ec649ae3dc20ee422c0..befb234ba5c3049c88654d712a4b1c33ca756d72 100644 |
--- a/build/toolchain/mac/BUILD.gn |
+++ b/build/toolchain/mac/BUILD.gn |
@@ -46,6 +46,9 @@ template("mac_toolchain") { |
cxx = invoker.cxx |
ld = invoker.ld |
+ linker_driver = |
+ rebase_path("//build/toolchain/mac/linker_driver.py", root_build_dir) |
+ |
# Make these apply to all tools below. |
lib_switch = "-l" |
lib_dir_switch = "-L" |
@@ -138,7 +141,7 @@ template("mac_toolchain") { |
does_reexport_command = "[ ! -e \"$dylib\" -o ! -e \"$tocname\" ] || otool -l \"$dylib\" | grep -q LC_REEXPORT_DYLIB" |
- link_command = "$ld -shared " |
+ link_command = "$linker_driver $ld -shared " |
if (is_component_build) { |
link_command += " -Wl,-install_name,@rpath/\"{{target_output_name}}{{output_extension}}\" " |
} |
@@ -180,8 +183,7 @@ template("mac_toolchain") { |
sofile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # eg "./libfoo.so" |
rspfile = sofile + ".rsp" |
- link_command = |
- "$ld -bundle {{ldflags}} -o \"$sofile\" -Wl,-filelist,\"$rspfile\"" |
+ link_command = "$linker_driver $ld -bundle {{ldflags}} -o \"$sofile\" -Wl,-filelist,\"$rspfile\"" |
if (is_component_build) { |
link_command += " -Wl,-install_name,@rpath/{{target_output_name}}{{output_extension}}" |
} |
@@ -215,7 +217,7 @@ template("mac_toolchain") { |
# do for command-line arguments. Thus any source names with spaces, or |
# label names with spaces (which GN bases the output paths on) will be |
# corrupted by this process. Don't use spaces for source files or labels. |
- command = "$ld {{ldflags}} -o \"$outfile\" -Wl,-filelist,\"$rspfile\" {{solibs}} {{libs}}" |
+ command = "$linker_driver $ld {{ldflags}} -o \"$outfile\" -Wl,-filelist,\"$rspfile\" {{solibs}} {{libs}}" |
description = "LINK $outfile" |
rspfile_content = "{{inputs_newline}}" |
outputs = [ |