Index: runtime/bin/BUILD.gn |
diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn |
index cde7664bd959f2fb159d3f1421e6a6371bff1fbc..4f30948dc15643e0f1ae14c7252faf25a859d2d0 100644 |
--- a/runtime/bin/BUILD.gn |
+++ b/runtime/bin/BUILD.gn |
@@ -489,43 +489,90 @@ action("generate_snapshot_bin") { |
] |
} |
-action("generate_snapshot_file") { |
+# Generates an assembly file defining a given symbol with the bytes from a |
+# binary file. Places the symbol in a text section if 'executable' is true, |
+# otherwise places the symbol in a read-only data section. |
+template("bin_to_assembly") { |
+ assert(defined(invoker.deps), "Must define deps") |
+ assert(defined(invoker.input), "Must define input binary file") |
+ assert(defined(invoker.output), "Must define output assembly file") |
+ assert(defined(invoker.symbol), "Must define symbol name") |
+ assert(defined(invoker.executable), "Must define boolean executable") |
+ |
+ action(target_name) { |
+ deps = invoker.deps |
+ script = "../tools/bin_to_assembly.py" |
+ args = [ |
+ "--input", |
+ rebase_path(invoker.input), |
+ "--output", |
+ rebase_path(invoker.output), |
+ "--symbol_name", |
+ invoker.symbol, |
+ "--target_os", |
+ target_os, |
+ ] |
+ if (invoker.executable) { |
+ args += [ "--executable" ] |
+ } |
+ inputs = [ |
+ script, |
+ invoker.input, |
+ ] |
+ outputs = [ |
+ invoker.output, |
+ ] |
+ } |
+} |
+ |
+bin_to_assembly("vm_snapshot_data_assembly") { |
deps = [ |
":generate_snapshot_bin", |
] |
+ input = "$target_gen_dir/vm_isolate_snapshot.bin" |
+ output = "$target_gen_dir/vm_snapshot_data.S" |
+ symbol = "kDartVmSnapshotData" |
+ executable = false |
+} |
- snapshot_in_cc_file = "snapshot_in.cc" |
- inputs = [ |
- "../tools/create_snapshot_file.py", |
- snapshot_in_cc_file, |
- "$target_gen_dir/vm_isolate_snapshot.bin", |
- "$target_gen_dir/isolate_snapshot.bin", |
- ] |
- output = "$root_gen_dir/dart_snapshot.cc" |
- outputs = [ |
- output, |
- ] |
+bin_to_assembly("vm_snapshot_instructions_assembly") { |
+ deps = [] |
+ input = "../tools/empty.bin" |
+ output = "$target_gen_dir/vm_snapshot_instructions.S" |
+ symbol = "kDartVmSnapshotInstructions" |
+ executable = true |
+} |
- script = "../tools/create_snapshot_file.py" |
- args = [ |
- "--vm_input_bin", |
- rebase_path("$target_gen_dir/vm_isolate_snapshot.bin"), |
- "--input_bin", |
- rebase_path("$target_gen_dir/isolate_snapshot.bin"), |
- "--input_cc", |
- rebase_path(snapshot_in_cc_file), |
- "--output", |
- rebase_path(output), |
+bin_to_assembly("isolate_snapshot_data_assembly") { |
+ deps = [ |
+ ":generate_snapshot_bin", |
] |
+ input = "$target_gen_dir/isolate_snapshot.bin" |
+ output = "$target_gen_dir/isolate_snapshot_data.S" |
+ symbol = "kDartCoreIsolateSnapshotData" |
+ executable = false |
} |
-source_set("dart_snapshot_cc") { |
- sources = [ |
- "$root_gen_dir/dart_snapshot.cc", |
- ] |
+bin_to_assembly("isolate_snapshot_instructions_assembly") { |
+ deps = [] |
+ input = "../tools/empty.bin" |
+ output = "$target_gen_dir/isolate_snapshot_instructions.S" |
+ symbol = "kDartCoreIsolateSnapshotInstructions" |
+ executable = true |
+} |
+source_set("dart_snapshot_cc") { |
deps = [ |
- ":generate_snapshot_file", |
+ ":isolate_snapshot_data_assembly", |
+ ":isolate_snapshot_instructions_assembly", |
+ ":vm_snapshot_data_assembly", |
+ ":vm_snapshot_instructions_assembly", |
+ ] |
+ sources = [ |
+ "$target_gen_dir/isolate_snapshot_data.S", |
+ "$target_gen_dir/isolate_snapshot_instructions.S", |
+ "$target_gen_dir/vm_snapshot_data.S", |
+ "$target_gen_dir/vm_snapshot_instructions.S", |
] |
} |