| # Copyright 2019 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/cpp/library_headers.gni") |
| import("//build/toolchain/toolchain_environment.gni") |
| import("//build/toolchain/zircon/user_basic_redirect.gni") |
| import("//build/zircon/embedded_blob.gni") |
| import("//build/zircon/hermetic_code_blob.gni") |
| |
| library_headers("headers") { |
| testonly = true |
| |
| headers = [ "mini-process/mini-process.h" ] |
| } |
| |
| shared_library("mini-process") { |
| testonly = true |
| |
| public_deps = [ ":headers" ] |
| |
| sources = [ "mini-process.cc" ] |
| deps = [ |
| ":subprocess.basic", |
| "//src/lib/elfldltl", |
| "//zircon/system/ulib/zx", |
| ] |
| } |
| |
| user_basic_redirect("subprocess.basic") { |
| visibility = [ ":*" ] |
| testonly = true |
| |
| public_deps = [ ":subprocess" ] |
| } |
| |
| embedded_blob("subprocess") { |
| visibility = [ ":*" ] |
| testonly = true |
| |
| sources = [ "$target_out_dir/subprocess.bin" ] |
| deps = [ ":subprocess.blob" ] |
| public_deps = [ ":subprocess.blob.public" ] |
| } |
| |
| hermetic_code_blob("subprocess.blob") { |
| visibility = [ ":*" ] |
| testonly = true |
| |
| output_name = "subprocess" |
| public = [ "subprocess.h" ] |
| public_deps = [ "//zircon/system/public" ] |
| |
| allow_rodata = true |
| |
| entrypoint = "minipr_thread_loop" |
| sources = [ "subprocess.cc" ] |
| deps = [ |
| ":headers", |
| "//src/lib/debug:backtrace-request", |
| "//src/zircon/lib/zircon:headers", |
| "//zircon/system/ulib/c/string:hermetic", |
| ] |
| |
| # This target is built without `//` in the default include dirs but |
| # backtrace-request is included using an absolute path. |
| include_dirs = [ "//" ] |
| |
| # TODO(https://fxbug.dev/42079915): LLD lets --no-pie trump the code generation |
| # switches, but this needs to be compiled as PIC though linked differently. |
| if (toolchain_variant.tags + [ "lto" ] - [ "lto" ] != |
| toolchain_variant.tags) { |
| ldflags = [ "-Wl,-mllvm,-relocation-model=pic" ] |
| } |
| } |