Sync third_party/yasm build files with Chromium's.
Merge in relevant changes from:
- https://crrev.com/555026
- https://crrev.com/584456
- https://crrev.com/640841
BUG=chromium:948150
TBR=thakis@chromium.org
Change-Id: I3066cb25af9230909eb77657bdc09306f184b72a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/52734
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/third_party/yasm/BUILD.gn b/third_party/yasm/BUILD.gn
index 35a85b1..6e245fe 100644
--- a/third_party/yasm/BUILD.gn
+++ b/third_party/yasm/BUILD.gn
@@ -55,6 +55,12 @@
# highbd_sad4d_sse2.asm on Windows this saves about 15 s.
configs_to_delete += [ "//build/config/win:default_crt" ]
configs_to_add += [ "//build/config/win:release_crt" ]
+
+ # Without no_default_deps, an implicit dependency on libc++ is added.
+ # libc++ may have been built referencing the debug CRT, but since we're
+ # explicitly using the release CRT, this would result in undefined symbol
+ # errors when linking, so we need to remove the implicit libc++ dependency.
+ no_default_deps = true
}
}
diff --git a/third_party/yasm/run_yasm.py b/third_party/yasm/run_yasm.py
index cbd79cc..a257295 100644
--- a/third_party/yasm/run_yasm.py
+++ b/third_party/yasm/run_yasm.py
@@ -18,6 +18,7 @@
"""
import argparse
+import os
import sys
import subprocess
@@ -30,6 +31,15 @@
objfile = options.objfile
depfile = objfile + '.d'
+# Set up environment for yasm.
+# Setting YASM_TEST_SUITE makes yasm output deterministic:
+# - the PE/COFF timestamp field is always 0 (this breaks link.exe /incremental,
+# but we no longer user link.exe)
+# - in debug info, yasm identifies itself as "yasm HEAD" instead of e.g.
+# "yasm 1.3.0" (we don't care much about this effect)
+# - in debug info, file paths are no longer absolute but relative to '.'
+os.environ['YASM_TEST_SUITE'] = '1'
+
# Assemble.
result_code = subprocess.call(sys.argv[1:])
if result_code != 0:
diff --git a/third_party/yasm/yasm_assemble.gni b/third_party/yasm/yasm_assemble.gni
index 73d5548..f94fa6b 100644
--- a/third_party/yasm/yasm_assemble.gni
+++ b/third_party/yasm/yasm_assemble.gni
@@ -55,7 +55,7 @@
"amd64",
]
}
-} else if (is_posix) {
+} else if (is_posix || is_fuchsia) {
if (current_cpu == "x86") {
_yasm_flags = [
"-felf32",
@@ -189,6 +189,9 @@
sources = get_target_outputs(":$action_name")
+ # Do not publicize any header to remove build dependency.
+ public = []
+
deps = [
":$action_name",
]