# Copyright 2015 The Chromium Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import("//build/config/c++/c++.gni") import("//build/config/chromeos/ui_mode.gni") import("//build/config/compiler/compiler.gni") import("//build/config/nacl/config.gni") import("//components/nacl/features.gni") import("//components/nacl/toolchain.gni") import("//testing/test.gni") assert(enable_nacl) if (current_cpu != "arm64") { # This is separate so it can be used by ../broker:nacl64. source_set("minimal") { sources = [ "nacl_ipc_adapter.cc", "nacl_ipc_adapter.h", "nacl_listener.cc", "nacl_listener.h", "nacl_main.cc", "nacl_main_platform_delegate.h", "nacl_trusted_listener.cc", "nacl_trusted_listener.h", "nacl_validation_db.h", "nacl_validation_query.cc", "nacl_validation_query.h", ] deps = [ ":minimal_content_dummy", "//base", "//components/nacl/common:minimal", "//components/nacl/common:mojo_bindings", "//components/power_monitor", "//content/public/common:main_function_params", "//crypto", "//ipc", "//mojo/core/embedder", "//native_client/src/trusted/service_runtime:sel_main_chrome", "//ppapi/c", "//ppapi/proxy:ipc", "//sandbox", "//services/service_manager/public/cpp", ] if (is_linux || is_chromeos) { sources += [ "nacl_main_platform_delegate_linux.cc" ] } } # This exists just to make 'gn check' happy with :minimal and # :nacl_helper_win_64 (below). They can't depend on //content/public/common # or anything like that, because that would bring in lots more than counts # as "minimal" (stuff that should not be in the nacl64.exe build). source_set("minimal_content_dummy") { check_includes = false sources = [] if (is_linux || is_chromeos) { sources += [ "//content/public/common/zygote/sandbox_support_linux.h" ] } } source_set("loader") { public_deps = [ ":minimal" ] deps = [ "//components/nacl/common", "//ppapi/shared_impl", "//services/service_manager/public/cpp", ] data_deps = [ "//ppapi/native_client:irt", "//ppapi/native_client/src/untrusted/pnacl_support_extension", ] } test("nacl_loader_unittests") { sources = [ "nacl_ipc_adapter_unittest.cc", "nacl_validation_query_unittest.cc", "run_all_unittests.cc", ] deps = [ ":loader", "//base/test:test_support", "//ipc:test_support", "//ppapi/c", "//testing/gtest", ] } } if ((is_linux || is_chromeos) && current_cpu != "arm64") { executable("nacl_helper") { sources = [ "nacl_helper_linux.cc", "nacl_helper_linux.h", ] deps = [ ":loader", "//base", "//components/nacl/common:switches", "//components/nacl/loader/sandbox_linux", "//content/public/common:content_descriptors", "//content/public/common:main_function_params", "//content/public/common:sandbox_support_linux", "//crypto", "//ipc", "//mojo/core/embedder", "//sandbox/linux:sandbox_services", "//sandbox/policy", "//url/ipc:url_ipc", ] if (is_chromeos) { # NaCl is not working with compiler-rt in ChromeOS. # Force libgcc as a workaround. See https://crbug.com/761103 ldflags = [ "-rtlib=libgcc", "--unwindlib=libgcc", ] # nacl_helper needs to link with libgcc_s. We already have -lgcc_s in # the final link command line, but it was placed within "--as-needed" # with the result that the dependency gets dropped. Similarly, we need # to add this via "ldflags" and not "libs" because libraries added via # the latter are also placed within an "--as-needed"'. # See https://crbug.com/884017 ldflags += [ "-lgcc_s" ] } # The only symbols that nacl_helper needs to export are those specified by # its direct dependencies, so -rdynamic would only serve to unnecessarily # increase the binary size. if (!export_libcxxabi_from_executables) { configs -= [ "//build/config/compiler:export_dynamic" ] } data_deps = [ "//native_client/src/trusted/service_runtime/linux:bootstrap" ] # In order to build ARM32 nacl_helper for ARM64 Chrome OS, we need to # minimize the dependencies on system libraries, including indirect # dependencies through other parts of Chrome (see # https://crbug.com/1339021). assert_no_deps = [ "//content/public/common", "//media/audio", ] if (is_minimal_toolchain) { assert_no_deps += [ "//net", "//skia", ] } } # For setting up nacl_helper. source_set("nacl_helper_integration") { public = [ "nacl_helper_linux.h" ] data_deps = [ ":nacl_helper" ] } } # In ARM64 Chrome, use the ARM32 versions of nacl_helper and # nacl_helper_bootstrap. Copy them from the build directory for the # ARM32 toolchain. if ((is_linux || is_chromeos) && current_cpu == "arm64") { if (default_toolchain == "//build/toolchain/cros:target") { toolchain = "//build/toolchain/cros:nacl_helper_arm32" } else { toolchain = "//build/toolchain/linux:clang_arm" } copy("nacl_helper") { label = ":nacl_helper($toolchain)" out_dir = get_label_info(label, "root_out_dir") sources = [ "${out_dir}/nacl_helper" ] outputs = [ "${root_out_dir}/nacl_helper" ] deps = [ label ] data_deps = [ ":nacl_helper_bootstrap", "//ppapi/native_client/src/untrusted/pnacl_support_extension", ] } copy("nacl_helper_bootstrap") { label = "//native_client/src/trusted/service_runtime/linux:bootstrap($toolchain)" out_dir = get_label_info(label, "root_out_dir") sources = [ "${out_dir}/nacl_helper_bootstrap" ] outputs = [ "${root_out_dir}/nacl_helper_bootstrap" ] deps = [ label ] } }