[build] Use .incbin to avoid horrible Clang assembler performance.

TEST=build
Change-Id: I46f8a5ef019d0afbf0de27533cd3f387ccdcbb54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205380
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
This commit is contained in:
Ryan Macnak 2021-06-30 21:23:04 +00:00 committed by commit-bot@chromium.org
parent 911fe966dc
commit e2da2e21ca
2 changed files with 12 additions and 2 deletions

View file

@ -527,7 +527,7 @@ template("bin_to_assembly") {
output = invoker.input + ".S"
args = [
"--input",
rebase_path(invoker.input),
rebase_path(invoker.input, root_build_dir),
"--output",
rebase_path(output),
"--symbol_name",
@ -546,6 +546,9 @@ template("bin_to_assembly") {
if (invoker.executable) {
args += [ "--executable" ]
}
if (current_os != "win") {
args += [ "--incbin" ]
}
inputs = [ invoker.input ]
outputs = [ output ]
}

View file

@ -26,6 +26,7 @@ def Main():
parser.add_option("--target_os", action="store", type="string")
parser.add_option("--size_symbol_name", action="store", type="string")
parser.add_option("--target_arch", action="store", type="string")
parser.add_option("--incbin", action="store_true", default=False)
(options, args) = parser.parse_args()
if not options.output:
@ -86,9 +87,15 @@ def Main():
output_file.write("byte %d\n" % (byte if isinstance(byte, int) else ord(byte)))
size += 1
else:
incbin = options.incbin
for byte in input_file.read():
output_file.write(".byte %d\n" % (byte if isinstance(byte, int) else ord(byte)))
size += 1
if not incbin:
output_file.write(
".byte %d\n" %
(byte if isinstance(byte, int) else ord(byte)))
if incbin:
output_file.write(".incbin \"%s\"\n" % options.input)
if options.target_os not in ["mac", "ios", "win"]:
output_file.write(".size {0}, .-{0}\n".format(options.symbol_name))