diff options
-rw-r--r-- | gn/BUILD.gn | 13 | ||||
-rw-r--r-- | gn/ar.py | 14 |
2 files changed, 17 insertions, 10 deletions
diff --git a/gn/BUILD.gn b/gn/BUILD.gn index 83d2733677..7e9008d2cf 100644 --- a/gn/BUILD.gn +++ b/gn/BUILD.gn @@ -582,15 +582,10 @@ toolchain("gcc_like") { } tool("alink") { - if (host_os == "win") { - rspfile = "{{output}}.rsp" - rspfile_content = "{{inputs}}" - ar_py = rebase_path("ar.py") - command = "$python $ar_py $ar {{output}} $rspfile" - } else { - # We'd use ar.py all the time, but Mac ar doesn't support @rspfile syntax. :( - command = "rm -f {{output}} && $ar rcs {{output}} {{inputs}}" - } + rspfile = "{{output}}.rsp" + rspfile_content = "{{inputs}}" + ar_py = rebase_path("ar.py") + command = "$python $ar_py $ar {{output}} $rspfile" outputs = [ "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", ] @@ -15,4 +15,16 @@ ar, output, rspfile = sys.argv[1:] if os.path.exists(output): os.remove(output) -sys.exit(subprocess.call([ar, "rcs", output, "@" + rspfile])) + +if sys.platform != 'darwin': + sys.exit(subprocess.call([ar, "rcs", output, "@" + rspfile])) + +# Mac ar doesn't support @rspfile syntax. +objects = open(rspfile).read().split() +# It also spams stderr with warnings about objects having no symbols. +pipe = subprocess.Popen([ar, "rcs", output] + objects, stderr=subprocess.PIPE) +_, err = pipe.communicate() +for line in err.splitlines(): + if 'has no symbols' not in line: + sys.stderr.write(line + '\n') +sys.exit(pipe.returncode) |