| # 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/fuzzing/fuzzer.gni") |
| import("//build/zircon/zx_library.gni") |
| |
| group("tests") { |
| testonly = true |
| deps = [ "tests" ] |
| } |
| |
| config("fdio_includes") { |
| include_dirs = [ "include" ] |
| } |
| |
| if (is_fuchsia) { |
| zx_library("fdio-spawn-actions") { |
| configs += [ "//build/config:all_source" ] |
| sdk = "source" |
| sdk_publishable = true |
| sdk_headers = [ "lib/fdio/spawn-actions.h" ] |
| |
| deps = [ |
| ":fdio", |
| "//zircon/system/ulib/zx", |
| ] |
| } |
| } |
| |
| # TODO(fxbug.dev/38226): This is a kludge to make "foosan-fuzzer" builds actually just use |
| # the plain "foosan" build of libfdio. This works around the problem that |
| # libfuzzer itself calls into libfdio and so its own calls pollute the data |
| # it's collecting about the code under test. We explicitly depend on the build |
| # that has the same foosan instrumentation to catch bugs but doesn't have the |
| # fuzzer (i.e. coverage tracking) instrumentation that influences libfuzzer's |
| # choices. |
| # |
| # In Fuchsia's GN, this requires a `select_variant` scope in args.gn must |
| # specify the "foosan" varaint for the toolchain variant to be available. |
| # `fx set`ensures this by adding a `select_variant` scope for libfdio.so itself |
| # with its "-fuzz-with" parameter. |
| if (toolchain_variant.configs + fuzzer_configs - fuzzer_configs != |
| toolchain_variant.configs) { |
| group("fdio") { |
| suffix = string_replace(toolchain_variant.suffix, "-fuzzer", "") |
| public_deps = [ ":fdio(${toolchain_variant.base}${suffix})" ] |
| public_configs = [ ":fdio_includes" ] |
| } |
| } else if (is_fuchsia) { |
| zx_library("fdio") { |
| configs += [ "//build/config:all_source" ] |
| sdk = "shared" |
| sdk_publishable = true |
| sdk_headers = [ |
| "lib/fdio/directory.h", |
| "lib/fdio/fd.h", |
| "lib/fdio/fdio.h", |
| "lib/fdio/io.h", |
| "lib/fdio/limits.h", |
| "lib/fdio/namespace.h", |
| "lib/fdio/private.h", |
| "lib/fdio/spawn.h", |
| "lib/fdio/unsafe.h", |
| "lib/fdio/vfs.h", |
| "lib/fdio/watcher.h", |
| ] |
| |
| sources = [ |
| "bsdsocket.cc", |
| "directory.cc", |
| "errno.cc", |
| "event.cc", |
| "fd.cc", |
| "fdio.cc", |
| "fdio_unistd.cc", |
| "inotify.cc", |
| "internal.h", |
| "io.cc", |
| "iovec.cc", |
| "mem.cc", |
| "namespace/local-connection.cc", |
| "namespace/local-filesystem.cc", |
| "namespace/local-vnode.cc", |
| "namespace/namespace.cc", |
| "null.cc", |
| "remoteio.cc", |
| "socket.cc", |
| "spawn.cc", |
| "stubs.cc", |
| "timer.cc", |
| "uname.cc", |
| "unistd.cc", |
| "unsafe.cc", |
| "waitable.cc", |
| "watcher.cc", |
| "zxio.cc", |
| ] |
| deps = [ |
| ":cleanpath", |
| "//sdk/fidl/fuchsia.device:fuchsia.device_llcpp", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_llcpp", |
| "//sdk/fidl/fuchsia.net:fuchsia.net_llcpp", |
| "//sdk/fidl/fuchsia.net.name:fuchsia.net.name_llcpp", |
| "//sdk/fidl/fuchsia.posix.socket:fuchsia.posix.socket_llcpp", |
| "//sdk/fidl/fuchsia.posix.socket.packet:fuchsia.posix.socket.packet_llcpp", |
| "//sdk/fidl/fuchsia.posix.socket.raw:fuchsia.posix.socket.raw_llcpp", |
| "//sdk/fidl/fuchsia.process:fuchsia.process_llcpp", |
| "//sdk/lib/fit", |
| "//sdk/lib/stdcompat", |
| "//sdk/lib/zxio", |
| "//sdk/lib/zxio:inception", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/fidl", |
| "//zircon/system/ulib/zircon-internal", |
| "//zircon/system/ulib/zx", |
| "//zircon/third_party/ulib/musl:getifaddrs-internal", |
| "//zircon/third_party/ulib/safemath", |
| ] |
| fdio_version_script = "fdio.ld" |
| symbols_api = "fdio.ifs" |
| inputs = [ fdio_version_script ] |
| ldflags = [ "-Wl,--version-script=" + |
| rebase_path(fdio_version_script, root_build_dir) ] |
| |
| # TODO(fxbug.dev/94768): This target uses mutable tables which are deprecated, |
| # rather than builders. |
| configs += [ "//build/cpp:fidl-wire-deprecated-mutable-tables" ] |
| } |
| } else { |
| source_set("fdio") { |
| public_configs = [ ":fdio_includes" ] |
| } |
| } |
| |
| source_set("cleanpath") { |
| visibility = [ |
| ":*", |
| "tests:*", |
| ] |
| sources = [ |
| "cleanpath.cc", |
| "cleanpath.h", |
| ] |
| deps = [ "//zircon/system/ulib/fbl" ] |
| } |