1# Copyright 2017 The Chromium Authors 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import("//build/config/clang/clang.gni") 6import("//build/config/fuchsia/generate_runner_scripts.gni") 7import("//build/config/fuchsia/gn_configs.gni") 8 9assert(is_fuchsia) 10assert(!is_posix, "Fuchsia is not POSIX.") 11 12config("compiler") { 13 configs = [ "//third_party/fuchsia-gn-sdk/src/config:compiler" ] 14 15 # TODO(crbug.com/40513182): The stack defaults to 256k on Fuchsia (see 16 # https://fuchsia.googlesource.com/zircon/+/master/system/private/zircon/stack.h#9), 17 # but on other platforms it's much higher, so a variety of code assumes more 18 # will be available. Raise to 8M which matches e.g. macOS. 19 ldflags = [ 20 "-Wl,-z,stack-size=0x800000", 21 "-fexperimental-relative-c++-abi-vtables", 22 ] 23 cflags_cc = [ "-fexperimental-relative-c++-abi-vtables" ] 24} 25 26# Files required to run on Fuchsia on isolated swarming clients. 27group("deployment_resources") { 28 data = [ 29 "//build/fuchsia/", 30 "//build/util/lib/", 31 "//third_party/fuchsia-sdk/sdk/.build-id/", 32 "//third_party/fuchsia-sdk/sdk/meta/manifest.json", 33 "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/ffx", 34 "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/ffx-meta.json", 35 36 # The following folder contains standalone binaries running as ffx plugins. 37 "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/ffx_tools/", 38 "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/fvm", 39 "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/fvm-meta.json", 40 "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/merkleroot", 41 "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/merkleroot-meta.json", 42 "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/pm", 43 "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/pm-meta.json", 44 "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/symbolizer", 45 "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/symbolizer-meta.json", 46 "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/zbi", 47 "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/zbi-meta.json", 48 ] 49 50 if (fuchsia_additional_boot_images == []) { 51 data += [ "${boot_image_root}" ] 52 } 53 54 foreach(fuchsia_additional_boot_image, fuchsia_additional_boot_images) { 55 data += [ "${fuchsia_additional_boot_image}/" ] 56 } 57 58 if (test_isolate_uses_emulator) { 59 if (test_host_cpu == "x64") { 60 data += [ 61 "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/aemu_internal", 62 "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/aemu_internal-meta.json", 63 "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/qemu_internal", 64 "//third_party/fuchsia-sdk/sdk/tools/${test_host_cpu}/qemu_internal-meta.json", 65 ] 66 } else if (test_host_cpu == "arm64") { 67 data += [ 68 "//third_party/qemu-${host_os}-${test_host_cpu}/", 69 70 # TODO(crbug.com/42050489): remove when ffx has native support 71 # for starting emulator on arm64 host. 72 "//third_party/fuchsia-sdk/sdk/tools/x64/qemu_internal-meta.json", 73 ] 74 } 75 } 76} 77 78# Copy the loader to place it at the expected path in the final package. 79copy("sysroot_asan_libs") { 80 sources = [ "${fuchsia_arch_root}/sysroot/dist/lib/asan/ld.so.1" ] 81 outputs = [ "${root_out_dir}/lib/asan/{{source_file_part}}" ] 82} 83 84# Copy the loader to place it at the expected path in the final package. 85copy("sysroot_asan_runtime_libs") { 86 sources = [ "$clang_base_path/lib/clang/$clang_version/lib/x86_64-unknown-fuchsia/libclang_rt.asan.so" ] 87 outputs = [ "${root_out_dir}/lib/{{source_file_part}}" ] 88} 89 90# This adds the runtime deps for Fuchsia ASAN builds. 91group("asan_runtime_library") { 92 data_deps = [ 93 ":sysroot_asan_libs", 94 ":sysroot_asan_runtime_libs", 95 ] 96} 97 98# rustc gives the linker (clang++) "-pie" directives. clang++ complains on 99# Fuchsia that these don't make any sense. On Fuchsia alone, for Rust-linked 100# targets only, disable these warnings. 101config("rustc_no_pie_warning") { 102 ldflags = [ "-Wno-unused-command-line-argument" ] 103} 104