Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions build/bin_to_obj.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE 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.symbol), "Must define symbol name")
assert(defined(invoker.executable), "Must define boolean executable")

action(target_name) {
deps = invoker.deps
script = "//third_party/dart/runtime/tools/bin_to_assembly.py"
output = "$target_gen_dir/${invoker.input}.S"
args = [
"--input",
rebase_path(invoker.input),
"--output",
rebase_path(output),
"--symbol_name",
invoker.symbol,
"--target_os",
current_os,
]
if (defined(invoker.size_symbol)) {
args += [
"--size_symbol_name",
invoker.size_symbol,
"--target_arch",
current_cpu,
]
}
if (invoker.executable) {
args += [ "--executable" ]
}
if (current_os != "win") {
args += [ "--incbin" ]
}
inputs = [
script,
invoker.input,
]
outputs = [ output ]
}
}

# Generates an object file defining a given symbol with the bytes from a
# binary file. Places the symbol in the read-only data section.
template("bin_to_coff") {
assert(defined(invoker.deps), "Must define deps")
assert(defined(invoker.input), "Must define input binary file")
assert(defined(invoker.symbol), "Must define symbol name")
assert(defined(invoker.executable), "Must define executable")

action(target_name) {
deps = invoker.deps
script = "//third_party/dart/runtime/tools/bin_to_coff.py"
output = "$target_gen_dir/${invoker.input}.o"
args = [
"--input",
rebase_path(invoker.input),
"--output",
rebase_path(output),
"--symbol_name",
invoker.symbol,
]

if (defined(invoker.size_symbol)) {
args += [
"--size_symbol_name",
invoker.size_symbol,
]
}

if (invoker.executable) {
args += [ "--executable" ]
}

args += [ "--arch=$current_cpu" ]
inputs = [ invoker.input ]
outputs = [ output ]
}
}

# Generates a linkable output file defining the specified symbol with the bytes
# from the binary file. Emits a COFF object file when targeting Windows,
# otherwise assembly.
template("bin_to_linkable") {
assert(defined(invoker.deps), "Must define deps")
assert(defined(invoker.input), "Must define input binary file")
assert(defined(invoker.symbol), "Must define symbol name")
target_type = "bin_to_assembly"
if (is_win) {
target_type = "bin_to_coff"
}

target(target_type, target_name) {
forward_variables_from(invoker, "*")
}
}
1 change: 0 additions & 1 deletion ci/licenses_golden/excluded_files
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,6 @@
../../../flutter/sky/tools/create_xcframework.py
../../../flutter/sky/tools/dist_dart_pkg.py
../../../flutter/sky/tools/install_framework_headers.py
../../../flutter/sky/tools/objcopy.py
../../../flutter/testing
../../../flutter/third_party/.clang-tidy
../../../flutter/third_party/.gitignore
Expand Down
98 changes: 1 addition & 97 deletions lib/snapshot/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import("//build/compiled_action.gni")
import("//build/fuchsia/sdk.gni")
import("//flutter/build/bin_to_obj.gni")
import("//flutter/common/config.gni")
import("//flutter/impeller/tools/impeller.gni")
import("//flutter/lib/ui/dart_ui.gni")
Expand Down Expand Up @@ -110,103 +111,6 @@ compiled_action("generate_snapshot_bin") {
}
}

# 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.symbol), "Must define symbol name")
assert(defined(invoker.executable), "Must define boolean executable")

action(target_name) {
deps = invoker.deps
script = "//third_party/dart/runtime/tools/bin_to_assembly.py"
output = invoker.input + ".S"
args = [
"--input",
rebase_path(invoker.input),
"--output",
rebase_path(output),
"--symbol_name",
invoker.symbol,
"--target_os",
current_os,
]
if (defined(invoker.size_symbol)) {
args += [
"--size_symbol_name",
invoker.size_symbol,
"--target_arch",
current_cpu,
]
}
if (invoker.executable) {
args += [ "--executable" ]
}
inputs = [
script,
invoker.input,
]
outputs = [ output ]
}
}

# Generates an object file defining a given symbol with the bytes from a
# binary file. Places the symbol in the read-only data section.
template("bin_to_coff") {
assert(defined(invoker.deps), "Must define deps")
assert(defined(invoker.input), "Must define input binary file")
assert(defined(invoker.symbol), "Must define symbol name")
assert(defined(invoker.executable), "Must define executable")

action(target_name) {
deps = invoker.deps
script = "//third_party/dart/runtime/tools/bin_to_coff.py"
output = invoker.input + ".o"
args = [
"--input",
rebase_path(invoker.input),
"--output",
rebase_path(output),
"--symbol_name",
invoker.symbol,
]

if (defined(invoker.size_symbol)) {
args += [
"--size_symbol_name",
invoker.size_symbol,
]
}

if (invoker.executable) {
args += [ "--executable" ]
}

args += [ "--arch=$current_cpu" ]
inputs = [ invoker.input ]
outputs = [ output ]
}
}

# Generates a linkable output file defining the specified symbol with the bytes
# from the binary file. Emits a COFF object file when targeting Windows,
# otherwise assembly.
template("bin_to_linkable") {
assert(defined(invoker.deps), "Must define deps")
assert(defined(invoker.input), "Must define input binary file")
assert(defined(invoker.symbol), "Must define symbol name")
target_type = "bin_to_assembly"
if (is_win) {
target_type = "bin_to_coff"
}

target(target_type, target_name) {
forward_variables_from(invoker, "*")
}
}

bin_to_linkable("vm_snapshot_data_linkable") {
deps = [ ":generate_snapshot_bin" ]
input = "$target_gen_dir/vm_isolate_snapshot.bin"
Expand Down
7 changes: 3 additions & 4 deletions shell/common/switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,11 @@ static const std::string kAllowedDartFlags[] = {
// of the engine's own symbols on some older versions of Android.
#if FML_OS_ANDROID
extern uint8_t _binary_icudtl_dat_start[];
extern uint8_t _binary_icudtl_dat_end[];
extern size_t _binary_icudtl_dat_size;

static std::unique_ptr<fml::Mapping> GetICUStaticMapping() {
return std::make_unique<fml::NonOwnedMapping>(
_binary_icudtl_dat_start,
_binary_icudtl_dat_end - _binary_icudtl_dat_start);
return std::make_unique<fml::NonOwnedMapping>(_binary_icudtl_dat_start,
_binary_icudtl_dat_size);
}
#endif

Expand Down
36 changes: 12 additions & 24 deletions shell/platform/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import("//build/config/android/config.gni")
import("//build/toolchain/clang.gni")
import("//flutter/build/bin_to_obj.gni")
import("//flutter/build/zip_bundle.gni")
import("//flutter/common/config.gni")
import("//flutter/impeller/tools/impeller.gni")
Expand Down Expand Up @@ -63,11 +64,18 @@ shared_library("flutter_shell_native") {
ldflags = [ "-Wl,--version-script=" + rebase_path("android_exports.lst") ]
}

bin_to_assembly("icudtl_asm") {
deps = []
input = "//third_party/icu/flutter/icudtl.dat"
symbol = "_binary_icudtl_dat_start"
size_symbol = "_binary_icudtl_dat_size"
executable = false
}

source_set("flutter_shell_native_src") {
visibility = [ ":*" ]

sources = [
"$root_build_dir/flutter_icu/icudtl.o",
"android_choreographer.cc",
"android_choreographer.h",
"android_context_gl_impeller.cc",
Expand Down Expand Up @@ -121,9 +129,11 @@ source_set("flutter_shell_native_src") {
"vsync_waiter_android.h",
]

sources += get_target_outputs(":icudtl_asm")

public_deps = [
":android_gpu_configuration",
":icudtl_object",
":icudtl_asm",
":image_generator",
"//flutter/assets",
"//flutter/common",
Expand Down Expand Up @@ -424,28 +434,6 @@ action("flutter_shell_java") {
]
}

action("icudtl_object") {
script = "//flutter/sky/tools/objcopy.py"

icudtl_input = "//third_party/icu/flutter/icudtl.dat"
icudtl_output = "$root_build_dir/flutter_icu/icudtl.o"

inputs = [ "$icudtl_input" ]

outputs = [ "$icudtl_output" ]

args = [
"--objcopy",
rebase_path(android_objcopy),
"--input",
rebase_path(icudtl_input),
"--output",
rebase_path(icudtl_output),
"--arch",
current_cpu,
]
}

action("android_jar") {
script = "//build/android/gyp/create_flutter_jar.py"

Expand Down
58 changes: 0 additions & 58 deletions sky/tools/objcopy.py

This file was deleted.

Loading