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}/", 34 ] 35 36 if (fuchsia_additional_boot_images == []) { 37 data += [ "${boot_image_root}" ] 38 } else { 39 # We never need to use both qemu images and device images. 40 foreach(fuchsia_additional_boot_image, fuchsia_additional_boot_images) { 41 data += [ "${fuchsia_additional_boot_image}/" ] 42 } 43 } 44 45 if (test_isolate_uses_emulator) { 46 # This assumes we are testing on QEMU with (U)EFI emulation only 47 # if host_cpu == target_cpu, and also that these tests are executed 48 # on x64 and arm64 only. 49 if (test_host_cpu == "arm64") { 50 data += [ 51 "//third_party/fuchsia-sdk/sdk/tools/qemu_uefi_internal/arm64", 52 "//third_party/fuchsia-sdk/sdk/tools/qemu_uefi_internal/arm64-meta.json", 53 "//third_party/qemu-${host_os}-${test_host_cpu}/", 54 ] 55 } else { 56 data += [ 57 "//third_party/fuchsia-sdk/sdk/tools/qemu_uefi_internal/x64", 58 "//third_party/fuchsia-sdk/sdk/tools/qemu_uefi_internal/x64-meta.json", 59 ] 60 } 61 } 62} 63 64# Copy the loader to place it at the expected path in the final package. 65copy("sysroot_asan_libs") { 66 sources = [ "${fuchsia_arch_root}/sysroot/dist/lib/asan/ld.so.1" ] 67 outputs = [ "${root_out_dir}/lib/asan/{{source_file_part}}" ] 68} 69 70# Copy the loader to place it at the expected path in the final package. 71copy("sysroot_asan_runtime_libs") { 72 sources = [ "$clang_base_path/lib/clang/$clang_version/lib/x86_64-unknown-fuchsia/libclang_rt.asan.so" ] 73 outputs = [ "${root_out_dir}/lib/{{source_file_part}}" ] 74} 75 76# This adds the runtime deps for Fuchsia ASAN builds. 77group("asan_runtime_library") { 78 data_deps = [ 79 ":sysroot_asan_libs", 80 ":sysroot_asan_runtime_libs", 81 ] 82} 83 84# rustc gives the linker (clang++) "-pie" directives. clang++ complains on 85# Fuchsia that these don't make any sense. On Fuchsia alone, for Rust-linked 86# targets only, disable these warnings. 87config("rustc_no_pie_warning") { 88 ldflags = [ "-Wno-unused-command-line-argument" ] 89} 90