• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//arkcompiler/ets_runtime/js_runtime_config.gni")
15
16declare_args() {
17  skip_gen_stub = false
18}
19
20_timeout_ = 14400
21
22config("include_maple") {
23  include_dirs = [
24    "${MAPLEALL_ROOT}/maple_be/include/cg",
25    "${MAPLEALL_ROOT}/maple_be/include/litecg",
26    "${MAPLEALL_ROOT}/maple_be/cg/aarch64",
27    "${MAPLEALL_ROOT}/maple_be/include/ad",
28    "${MAPLEALL_ROOT}/maple_be/include/ad/target",
29    "${MAPLEALL_ROOT}/maple_be/include/be/aarch64",
30    "${MAPLEALL_ROOT}/maple_be/include/be",
31    "${MAPLEALL_ROOT}/maple_driver/include",
32    "${MAPLEALL_ROOT}/maple_driver/defs",
33    "${MAPLEALL_ROOT}/maple_driver/defs/default",
34    "${MAPLEALL_ROOT}/maple_util/include",
35    "${MAPLEALL_ROOT}/mpl2mpl/include",
36    "${MAPLEALL_ROOT}/mempool/include",
37    "${MAPLEALL_ROOT}/maple_phase/include",
38    "${MAPLEALL_ROOT}/maple_ir/include",
39    "${MAPLEALL_ROOT}/maple_me/include",
40  ]
41  cflags_cc = [ "-Wno-gnu-zero-variadic-macro-arguments" ]
42}
43
44libark_jsoptimizer_sources = [
45  "access_object_stub_builder.cpp",
46  "aot_compilation_env.cpp",
47  "aot_compiler_preprocessor.cpp",
48  "aot_compiler_stats.cpp",
49  "argument_accessor.cpp",
50  "array_bounds_check_elimination.cpp",
51  "assembler/aarch64/assembler_aarch64.cpp",
52  "assembler/aarch64/extend_assembler.cpp",
53  "assembler/aarch64/macro_assembler_aarch64.cpp",
54  "assembler/x64/assembler_x64.cpp",
55  "assembler/x64/extended_assembler_x64.cpp",
56  "assembler/x64/macro_assembler_x64.cpp",
57  "assembler_module.cpp",
58  "async_function_lowering.cpp",
59  "barrier_stub_builder.cpp",
60  "base/depend_chain_helper.cpp",
61  "baseline/baseline_assembler.cpp",
62  "baseline/baseline_call_signature.cpp",
63  "baseline/baseline_compiler.cpp",
64  "baseline/baseline_stubs.cpp",
65  "bc_call_signature.cpp",
66  "builtins/builtins_array_indexof_stub_builder.cpp",
67  "builtins/builtins_array_stub_builder.cpp",
68  "builtins/builtins_array_stub_builder_next_optimization.cpp",
69  "builtins/builtins_call_signature.cpp",
70  "builtins/builtins_collator_stub_builder.cpp",
71  "builtins/builtins_collection_iterator_stub_builder.cpp",
72  "builtins/builtins_collection_stub_builder.cpp",
73  "builtins/builtins_dataview_stub_builder.cpp",
74  "builtins/builtins_function_stub_builder.cpp",
75  "builtins/builtins_number_stub_builder.cpp",
76  "builtins/builtins_object_stub_builder.cpp",
77  "builtins/builtins_proxy_stub_builder.cpp",
78  "builtins/builtins_reflect_stub_builder.cpp",
79  "builtins/builtins_regexp_stub_builder.cpp",
80  "builtins/builtins_string_stub_builder.cpp",
81  "builtins/builtins_stubs.cpp",
82  "builtins/builtins_typedarray_stub_builder.cpp",
83  "builtins/containers_arraylist_stub_builder.cpp",
84  "builtins/containers_deque_stub_builder.cpp",
85  "builtins/containers_hashmap_stub_builder.cpp",
86  "builtins/containers_hashset_stub_builder.cpp",
87  "builtins/containers_lightweightmap_stub_builder.cpp",
88  "builtins/containers_lightweightset_stub_builder.cpp",
89  "builtins/containers_linkedlist_stub_builder.cpp",
90  "builtins/containers_list_stub_builder.cpp",
91  "builtins/containers_plainarray_stub_builder.cpp",
92  "builtins/containers_queue_stub_builder.cpp",
93  "builtins/containers_stack_stub_builder.cpp",
94  "builtins/containers_stub_builder.cpp",
95  "builtins/containers_vector_stub_builder.cpp",
96  "builtins/linked_hashtable_stub_builder.cpp",
97  "builtins_lowering.cpp",
98  "bytecode_circuit_builder.cpp",
99  "bytecode_info_collector.cpp",
100  "bytecodes.cpp",
101  "call_signature.cpp",
102  "call_stub_builder.cpp",
103  "circuit.cpp",
104  "circuit_builder.cpp",
105  "circuit_builder_helper.cpp",
106  "codegen/llvm/aarch64/aarch64_builder.cpp",
107  "codegen/llvm/llvm_codegen.cpp",
108  "codegen/llvm/llvm_ir_builder.cpp",
109  "codegen/llvm/x64/x64_builder.cpp",
110  "combined_pass_visitor.cpp",
111  "common_stubs.cpp",
112  "compilation_driver.cpp",
113  "compilation_env.cpp",
114  "compiler_log.cpp",
115  "constant_folding.cpp",
116  "dead_code_elimination.cpp",
117  "debug_info.cpp",
118  "early_elimination.cpp",
119  "escape_analysis.cpp",
120  "escape_analysis_editor.cpp",
121  "file_generators.cpp",
122  "frame_states.cpp",
123  "gate.cpp",
124  "gate_accessor.cpp",
125  "graph_editor.cpp",
126  "graph_linearizer.cpp",
127  "hash_stub_builder.cpp",
128  "hcr_circuit_builder.cpp",
129  "hcr_gate_meta_data.cpp",
130  "ic_stub_builder.cpp",
131  "induction_variable_analysis.cpp",
132  "instruction_combine.cpp",
133  "interpreter_stub.cpp",
134  "ir_builder.cpp",
135  "ir_module.cpp",
136  "jit_compilation_env.cpp",
137  "jit_compiler.cpp",
138  "later_elimination.cpp",
139  "lcr_circuit_builder.cpp",
140  "lcr_gate_meta_data.cpp",
141  "lexical_env_specialization_pass.cpp",
142  "loop_analysis.cpp",
143  "loop_peeling.cpp",
144  "mcr_circuit_builder.cpp",
145  "mcr_gate_meta_data.cpp",
146  "mcr_lowering.cpp",
147  "native_inline_lowering.cpp",
148  "new_object_stub_builder.cpp",
149  "ntype_bytecode_lowering.cpp",
150  "ntype_hcr_lowering.cpp",
151  "number_speculative_lowering.cpp",
152  "number_speculative_retype.cpp",
153  "number_speculative_runner.cpp",
154  "object_operator_stub_builder.cpp",
155  "operations_stub_builder.cpp",
156  "pass_manager.cpp",
157  "post_schedule.cpp",
158  "precompile_checker.cpp",
159  "profiler_stub_builder.cpp",
160  "range_analysis.cpp",
161  "range_guard.cpp",
162  "rt_call_signature.cpp",
163  "scheduler.cpp",
164  "share_gate_meta_data.cpp",
165  "slowpath_lowering.cpp",
166  "state_split_linearizer.cpp",
167  "string_builder_optimizer.cpp",
168  "stub.cpp",
169  "stub_builder.cpp",
170  "trampoline/aarch64/asm_interpreter_call.cpp",
171  "trampoline/aarch64/baseline_call.cpp",
172  "trampoline/aarch64/common_call.cpp",
173  "trampoline/aarch64/optimized_call.cpp",
174  "trampoline/aarch64/optimized_fast_call.cpp",
175  "trampoline/x64/asm_interpreter_call.cpp",
176  "trampoline/x64/baseline_call.cpp",
177  "trampoline/x64/common_call.cpp",
178  "trampoline/x64/optimized_call.cpp",
179  "trampoline/x64/optimized_fast_call.cpp",
180  "ts_hcr_opt_pass.cpp",
181  "ts_inline_lowering.cpp",
182  "type.cpp",
183  "type_inference/pgo_type_infer.cpp",
184  "type_info_accessors.cpp",
185  "typed_bytecode_lowering.cpp",
186  "typed_hcr_lowering.cpp",
187  "typed_native_inline_lowering.cpp",
188  "useless_gate_elimination.cpp",
189  "value_numbering.cpp",
190  "verifier.cpp",
191]
192
193config("libark_jsoptimizer_set_config") {
194  # Setting up IS_RELEASE_VERSION if compiling as release version
195  if (build_variant == "user") {
196    cflags_c = [ "-DIS_RELEASE_VERSION" ]
197    cflags_cc = [ "-DIS_RELEASE_VERSION" ]
198  }
199  libs = []
200  if (is_mingw) {
201    libs += [
202      "kernel32",
203      "shell32",
204      "uuid",
205      "advapi32",
206      "msvcrt",
207      "msvcrt-os",
208      "windowsapp",
209    ]
210  }
211}
212
213ohos_source_set("libark_jsoptimizer_set") {
214  stack_protector_ret = false
215  sources = libark_jsoptimizer_sources
216  if (enable_local_code_sign) {
217    sources += [ "$js_root/ecmascript/platform/unix/ohos/code_sign.cpp" ]
218  } else if (is_mingw) {
219    sources += [ "$js_root/ecmascript/platform/windows/code_sign.cpp" ]
220  } else {
221    sources += [ "$js_root/ecmascript/platform/unix/code_sign.cpp" ]
222  }
223  public_configs = [
224    "$js_root:include_llvm",
225    "$js_root:ark_jsruntime_compiler_config",
226    "$js_root:ark_jsruntime_public_config",
227    ":libark_jsoptimizer_set_config",
228  ]
229
230  external_deps = [ "zlib:libz" ]
231  deps = []
232  if (!is_arkui_x) {
233    external_deps += [ "runtime_core:arkfile_header_deps" ]
234  } else {
235    deps += [ "$ark_root/libpandafile:arkfile_header_deps" ]
236  }
237  deps += [ "${LLVM_LIB_ROOT}:libark_llvmcodegen_set" ]
238
239  # hiviewdfx libraries
240  external_deps += hiviewdfx_ext_deps
241  deps += hiviewdfx_deps
242  if (defined(ohos_indep_compiler_enable) && ohos_indep_compiler_enable) {
243    external_deps += [
244      "icu:shared_icuuc",
245      sdk_libc_secshared_dep,
246    ]
247  }
248  part_name = "ets_runtime"
249  subsystem_name = "arkcompiler"
250}
251
252config("enable_maple_config") {
253  cflags_cc = [ "-DCOMPILE_MAPLE" ]
254  cflags_c = [ "-DCOMPILE_MAPLE" ]
255}
256
257ohos_source_set("libark_jsoptimizer_set_with_maple") {
258  stack_protector_ret = false
259  if (enable_sanitize) {
260    sanitize = {
261      cfi = true
262      cfi_cross_dso = true
263      debug = false
264    }
265    branch_protector_ret = "pac_ret"
266  }
267  cflags_cc = [ "-fvisibility=hidden" ]
268  sources = libark_jsoptimizer_sources
269  if (enable_local_code_sign) {
270    sources += [ "$js_root/ecmascript/platform/unix/ohos/code_sign.cpp" ]
271  } else if (is_mingw) {
272    sources += [ "$js_root/ecmascript/platform/windows/code_sign.cpp" ]
273  } else {
274    sources += [ "$js_root/ecmascript/platform/unix/code_sign.cpp" ]
275  }
276  if (enable_jit_code_sign) {
277    sources += [ "$js_root/ecmascript/compiler/jit_signcode.cpp" ]
278  }
279  sources += [
280    "codegen/maple/litecg_codegen.cpp",
281    "codegen/maple/litecg_ir_builder.cpp",
282  ]
283  public_configs = [
284    "$js_root:include_llvm",
285    ":include_maple",
286    "$js_root:ark_jsruntime_compiler_config",
287    "$js_root:ark_jsruntime_public_config",
288    ":libark_jsoptimizer_set_config",
289    ":enable_maple_config",
290  ]
291
292  defines = []
293  external_deps = [ "zlib:libz" ]
294
295  if (enable_jit_code_sign) {
296    defines += [ "JIT_ENABLE_CODE_SIGN" ]
297    external_deps += [ "code_signature:libjit_code_sign" ]
298    if (disable_fort_switch) {
299      defines += [ "JIT_FORT_DISABLE" ]
300    }
301  }
302
303  if (enable_litecg_emit) {
304    defines += [ "ARK_LITECG_DEBUG" ]
305  }
306
307  deps = []
308  if (is_ohos) {
309    deps += [ "${LLVM_LIB_ROOT}:libark_llvmcodegen" ]
310  } else {
311    deps += [ "${LLVM_LIB_ROOT}:libark_llvmcodegen_set" ]
312  }
313  if (!is_arkui_x) {
314    external_deps += [ "runtime_core:arkfile_header_deps" ]
315  } else {
316    deps += [ "$ark_root/libpandafile:arkfile_header_deps" ]
317  }
318
319  # hiviewdfx libraries
320  external_deps += hiviewdfx_ext_deps
321  if (defined(ohos_indep_compiler_enable) && ohos_indep_compiler_enable) {
322    external_deps += [
323      "icu:shared_icuuc",
324      sdk_libc_secshared_dep,
325    ]
326  }
327  part_name = "ets_runtime"
328  subsystem_name = "arkcompiler"
329}
330
331ohos_source_set("libark_stub_set") {
332  stack_protector_ret = false
333  if (enable_sanitize) {
334    sanitize = {
335      ubsan = true
336    }
337  }
338
339  deps = [ ":build_stub_to_cpp" ]
340  sources = [ "$root_gen_dir/arkcompiler/ets_runtime/stub_an.cpp" ]
341
342  public_configs = [
343    "$js_root:ark_jsruntime_common_config",
344    "$js_root:ark_jsruntime_public_config",
345  ]
346
347  part_name = "ets_runtime"
348  subsystem_name = "arkcompiler"
349}
350
351ohos_source_set("libark_mock_stub_set") {
352  stack_protector_ret = false
353  sources = [ "mock/mock_stub_an.cpp" ]
354
355  public_configs = [
356    "$js_root:ark_jsruntime_common_config",
357    "$js_root:ark_jsruntime_public_config",
358  ]
359}
360
361ohos_shared_library("libark_jsoptimizer") {
362  stack_protector_ret = false
363  if (enable_sanitize) {
364    sanitize = {
365      cfi = true
366      cfi_cross_dso = true
367      debug = false
368      ubsan = true
369    }
370    branch_protector_ret = "pac_ret"
371  }
372  deps = [
373    ":libark_jsoptimizer_set_with_maple",
374    "$js_root:libark_jsruntime",
375    "${MAPLEALL_ROOT}/maple_be:libcg",
376  ]
377
378  external_deps = [ "bounds_checking_function:libsec_shared" ]
379  if (!is_arkui_x) {
380    external_deps += [ "runtime_core:libarkfile_static" ]
381  } else {
382    deps += [ "$ark_root/libpandafile:libarkfile_static" ]
383  }
384
385  defines = []
386  if (run_with_asan) {
387    defines = [ "RUN_WITH_ASAN" ]
388  }
389  if (enable_jit_code_sign) {
390    defines += [ "JIT_ENABLE_CODE_SIGN" ]
391  }
392
393  if (enable_hilog) {
394    external_deps += [ "hilog:libhilog" ]
395  }
396
397  install_enable = true
398
399  if (!is_mingw && !is_mac) {
400    output_extension = "so"
401  }
402  part_name = "ets_runtime"
403  subsystem_name = "arkcompiler"
404}
405
406ohos_executable("ark_stub_compiler") {
407  sources = [ "stub_compiler.cpp" ]
408  include_dirs = [ "$target_gen_dir" ]
409
410  configs = [
411    "$js_root:include_llvm",
412    "$js_root:ark_jsruntime_compiler_config",
413    "$js_root:ark_jsruntime_public_config",
414  ]
415
416  deps = [
417    ":libark_jsoptimizer_set",
418    ":libark_mock_stub_set",
419    "$js_root:libark_js_intl_set",
420    "$js_root:libark_jsruntime_set",
421    "$js_root:libcommon_components_set",
422  ]
423
424  deps += [ "$js_root:libcommon_components_set" ]
425  if (ets_runtime_enable_cmc_gc) {
426    if (ark_hybrid) {
427      deps += [ "$ark_root/static_core/runtime:libarkruntime_set_static" ]
428    }
429  }
430
431  external_deps = [ "zlib:libz" ]
432  external_deps += hiviewdfx_ext_deps
433  if (!is_arkui_x) {
434    external_deps += [ "runtime_core:libarkfile_static" ]
435  } else {
436    deps += [ "$ark_root/libpandafile:libarkfile_static" ]
437  }
438
439  if (!ark_standalone_build && host_os != "mac") {
440    ldflags = [ "-Wl,--lto-O0" ]
441  }
442
443  if (run_with_asan) {
444    defines = [ "RUN_WITH_ASAN" ]
445  }
446
447  if (defined(is_arkui_x) && is_arkui_x) {
448    deps += [
449      "$ark_third_party_root/icu/icu4c:static_icui18n",
450      "$ark_third_party_root/icu/icu4c:static_icuuc",
451    ]
452  } else {
453    external_deps += [
454      "icu:shared_icui18n",
455      "icu:shared_icuuc",
456    ]
457  }
458
459  if (defined(ohos_indep_compiler_enable) && ohos_indep_compiler_enable) {
460    external_deps += [
461      "runtime_core:libarkbase_static",
462      "runtime_core:libarkziparchive_static",
463      sdk_libc_secshared_dep,
464    ]
465  }
466
467  install_enable = false
468  part_name = "ets_runtime"
469  subsystem_name = "arkcompiler"
470}
471
472ohos_executable("ark_aot_compiler") {
473  if (enable_sanitize) {
474    sanitize = {
475      ubsan = true
476    }
477  }
478  sources = [ "aot_compiler.cpp" ]
479  configs = [
480    "$js_root:include_llvm",
481    ":include_maple",
482    "$js_root:ark_jsruntime_compiler_config",
483    "$js_root:ark_jsruntime_public_config",
484  ]
485
486  deps = [ ":libark_mock_stub_set" ]
487
488  if (is_ohos) {
489    deps += [
490      ":libark_jsoptimizer",
491      "$js_root:libark_jsruntime",
492    ]
493  } else {
494    deps += [
495      ":libark_jsoptimizer_set_with_maple",
496      "$js_root:libark_js_intl_set",
497      "$js_root:libark_jsruntime_set",
498      "$js_root:libcommon_components_set",
499      "${MAPLEALL_ROOT}/maple_be:libcg",
500    ]
501  }
502
503  if (ets_runtime_enable_cmc_gc) {
504    if (ark_hybrid) {
505      deps += [ "$ark_root/static_core/runtime:libarkruntime_set_static" ]
506    }
507  }
508
509  external_deps = [ "zlib:libz" ]
510  if (!is_arkui_x) {
511    external_deps += [
512      "runtime_core:arkfile_header_deps",
513      "runtime_core:libarkbase_static",
514      "runtime_core:libarkfile_static",
515    ]
516  } else {
517    deps += [
518      "$ark_root/libpandabase:libarkbase_static",
519      "$ark_root/libpandafile:arkfile_header_deps",
520      "$ark_root/libpandafile:libarkfile_static",
521    ]
522  }
523
524  if (defined(is_arkui_x) && is_arkui_x) {
525    deps += [
526      "$ark_third_party_root/icu/icu4c:static_icui18n",
527      "$ark_third_party_root/icu/icu4c:static_icuuc",
528    ]
529  } else {
530    external_deps += [
531      "icu:shared_icui18n",
532      "icu:shared_icuuc",
533    ]
534  }
535
536  if (ark_js_hybrid) {
537    if (!is_arkui_x) {
538      external_deps += [ "runtime_core:libarkplatform" ]
539    } else {
540      deps += [ "$arkplatform_root:libarkplatform" ]
541    }
542  }
543
544  # hiviewdfx libraries
545  external_deps += hiviewdfx_ext_deps
546  deps += hiviewdfx_deps
547
548  install_enable = true
549  if (defined(ohos_indep_compiler_enable) && ohos_indep_compiler_enable) {
550    external_deps += [
551      "runtime_core:libarkziparchive_static",
552      sdk_libc_secshared_dep,
553    ]
554  }
555  part_name = "ets_runtime"
556  subsystem_name = "arkcompiler"
557}
558
559action("gen_stub_file") {
560  script = "$js_root/script/run_ark_executable.py"
561
562  deps = [ "$js_root/ecmascript/compiler:ark_stub_compiler(${host_toolchain})" ]
563
564  stub_file_gen_dir = "$root_gen_dir/arkcompiler/ets_runtime"
565  root_out_dir_with_host_toolchain =
566      get_label_info(":ark_stub_compiler(${host_toolchain})", "root_out_dir")
567
568  if (current_os == "linux" && current_cpu == "arm64") {
569    stub_option =
570        " --stub-file=" + rebase_path(stub_file_gen_dir) + "/stub.an" +
571        " --compiler-target-triple=aarch64-unknown-linux-gnu" +
572        " --compiler-log=allasm" + " --log-level=info"
573  } else if (current_toolchain == host_toolchain) {
574    stub_option = " --stub-file=" + rebase_path(stub_file_gen_dir) + "/stub.an"
575  } else if (current_cpu == "x86_64") {
576    stub_option =
577        " --stub-file=" + rebase_path(stub_file_gen_dir) + "/stub.an" +
578        " --compiler-target-triple=x86_64-unknown-linux-gnu"
579  } else {
580    stub_option =
581        " --stub-file=" + rebase_path(stub_file_gen_dir) + "/stub.an" +
582        " --compiler-target-triple=aarch64-unknown-linux-gnu" +
583        " --compiler-log=allasm" + " --log-level=info"
584  }
585  stub_option += " --enable-force-gc=false"
586
587  if (host_cpu == "arm64") {
588    llvm_lib_dir = "//prebuilts/clang/ohos/linux-aarch64/llvm/lib/"
589  } else {
590    llvm_lib_dir = "//prebuilts/clang/ohos/linux-x86_64/llvm/lib/"
591  }
592
593  args = [
594    "--script-file",
595    rebase_path(root_out_dir_with_host_toolchain) +
596        "/arkcompiler/ets_runtime/ark_stub_compiler",
597    "--script-options",
598    stub_option,
599    "--expect-output",
600    "0",
601    "--timeout-limit",
602    "${_timeout_}",
603  ]
604  if (defined(ohos_indep_compiler_enable) && ohos_indep_compiler_enable) {
605    args += [
606      "--env-path",
607      rebase_path("//binarys/arkcompiler/runtime_core/") + ":" +
608          rebase_path("//binarys/arkcompiler/ets_frontend/") + ":" +
609          rebase_path("//binarys/arkcompiler/ets_runtime/") + ":" + rebase_path(
610              "//binarys/arkcompiler/runtime_core/innerapis/libarkziparchive_static/clang_x64/libs") + ":" + rebase_path(
611              "//binarys/third_party/icu/innerapis/shared_icuuc/clang_x64/libs") + ":" + rebase_path(
612              "//binarys/third_party/icu/innerapis/shared_icui18n/clang_x64/libs") + ":" + rebase_path(
613              "//binarys/third_party/zlib/innerapis/shared_libz/clang_x64/libs") + ":" + rebase_path(
614              "//binarys/third_party/bounds_checking_function/innerapis/libsec_shared/clang_x64/libs"),
615    ]
616    not_needed([ "llvm_lib_dir" ])
617  } else {
618    args += [
619      "--env-path",
620      rebase_path(root_out_dir_with_host_toolchain) +
621          "/arkcompiler/ets_runtime:" +
622          rebase_path(root_out_dir_with_host_toolchain) +
623          "/${icu_subsystem_name}/${icu_part_name}:" +
624          rebase_path(root_out_dir_with_host_toolchain) + "/thirdparty/zlib:" +
625          rebase_path(root_out_dir_with_host_toolchain) +
626          "/resourceschedule/frame_aware_sched:" +
627          rebase_path(root_out_dir_with_host_toolchain) + "/hiviewdfx/hilog:" +
628          rebase_path(root_out_dir_with_host_toolchain) +
629          "/thirdparty/bounds_checking_function:" + rebase_path(llvm_lib_dir),
630    ]
631  }
632
633  # Use with caution. It can only be used when the IR(stub.an) logic is not modified.
634  if (skip_gen_stub) {
635    args += [
636      "--skip",
637      "true",
638    ]
639  }
640
641  outputs = [ "$stub_file_gen_dir/stub.an" ]
642  if (is_ohos) {
643    outputs += [ "$stub_file_gen_dir/stub_code_comment.zip" ]
644  }
645}
646
647ohos_prebuilt_shared_library("stub.an") {
648  deps = [ ":gen_stub_file" ]
649  source = "$root_gen_dir/arkcompiler/ets_runtime/stub.an"
650
651  relative_install_dir = arkcompiler_relative_lib_path
652  part_name = "ets_runtime"
653  subsystem_name = "arkcompiler"
654}
655
656action("build_stub_to_cpp") {
657  sources = [ "$root_gen_dir/arkcompiler/ets_runtime/stub.an" ]
658
659  script = "$js_root/script/build_resource_to_cpp.py"
660
661  deps = [ ":gen_stub_file" ]
662
663  args = [
664    "--input",
665    rebase_path("$root_gen_dir/arkcompiler/ets_runtime/stub.an"),
666    "--output",
667    rebase_path("$root_gen_dir/arkcompiler/ets_runtime/stub_an.cpp"),
668  ]
669
670  outputs = [ "$root_gen_dir/arkcompiler/ets_runtime/stub_an.cpp" ]
671}
672