| # Copyright 2022 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. |
| |
| # For environments where fdio is not suitable, such as kernel ZBI tests (e.g. core-tests) |
| # this library provides some minimal implementations for dealing with options and stdio. |
| # This implementation is meant for testing environments. |
| |
| import("//build/cpp/library_headers.gni") |
| |
| library_headers("headers") { |
| testonly = true |
| headers = [ "lib/standalone-test/standalone.h" ] |
| public_deps = [ "//zircon/system/ulib/zx" ] |
| } |
| |
| static_library("standalone-test") { |
| testonly = true |
| sources = [ |
| "standalone-io.cc", |
| "standalone-main.cc", |
| "standalone-options.cc", |
| "zxtest-main.cc", |
| ] |
| public_deps = [ |
| ":headers", |
| ":init", |
| ] |
| deps = [ |
| "//src/lib/zbitl", |
| "//zircon/kernel/lib/boot-options", |
| "//zircon/system/ulib/zx", |
| "//zircon/system/ulib/zxtest", |
| ] |
| } |
| |
| # This is a separate source-set that's forced into dependents' links via |
| # public_deps so that it's eagerly linked in. |
| source_set("init") { |
| visibility = [ ":*" ] |
| testonly = true |
| |
| sources = [ "standalone-init.cc" ] |
| deps = [ |
| ":headers", |
| "//zircon/system/ulib/lazy_init", |
| "//zircon/system/ulib/zx", |
| ] |
| |
| public_configs = [ ":init.config" ] |
| } |
| |
| # The __libc_extensions_init symbol is a weak undefined reference in libc.so. |
| # However, we link against an IFS stub that has elided undefined symbols. So |
| # the linker doesn't know that __libc_extensions_init is meaningful to export |
| # from the executable, even though it's marked for export. The switch tells |
| # it explicitly that this symbol must be exported. |
| config("init.config") { |
| visibility = [ ":*" ] |
| |
| ldflags = [ "-Wl,--export-dynamic-symbol=__libc_extensions_init" ] |
| } |