aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gn/BUILD.gn13
-rw-r--r--gn/ar.py14
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}}",
]
diff --git a/gn/ar.py b/gn/ar.py
index dc3ae8d948..c7ffb04f67 100644
--- a/gn/ar.py
+++ b/gn/ar.py
@@ -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)