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