| # 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/config/clang/clang_cpu.gni") |
| |
| group("musl_internal") { |
| visibility = [ |
| "./*", |
| "//zircon/system/ulib/c/*", |
| "//zircon/third_party/scudo/*", |
| ] |
| public_deps = [ |
| "//zircon/system/public", |
| "//zircon/system/ulib/c/include:headers", |
| "//zircon/system/ulib/runtime:headers", |
| "//zircon/system/ulib/zircon-internal:headers", |
| ] |
| public_configs = [ ":musl_internal.config" ] |
| } |
| |
| group("musl_internal_testing") { |
| testonly = true |
| visibility = [ |
| "./*", |
| "//zircon/system/ulib/c/*", |
| "//zircon/system/utest/libc:*", |
| ] |
| public_deps = [ ":musl_internal" ] |
| } |
| |
| config("musl_internal.config") { |
| visibility = [ ":musl_internal" ] |
| |
| include_dirs = [ |
| "src/internal", |
| "arch/${clang_cpu}", |
| ] |
| |
| defines = [ "_XOPEN_SOURCE=700" ] |
| |
| # TODO(kulakowski): Clean up the junkier -Wno flags below. |
| cflags = [ |
| "-Wno-sign-compare", |
| "-Wno-implicit-fallthrough", |
| ] |
| cflags_c = [ "-Werror=incompatible-pointer-types" ] |
| |
| if (is_gcc) { |
| cflags += [ |
| # Some dubious but working musl code elicits GCC's pointer usage warnings. |
| "-Wno-dangling-pointer", |
| |
| # Some of the math code gets false-positive warnings. |
| "-Wno-maybe-uninitialized", |
| ] |
| } |
| |
| if (!is_gcc) { |
| # Some of this code runs before the TLS area for the canary is set up. |
| # TODO(mcgrathr): Isolate this to exactly what code needs it. |
| cflags += [ "-fno-stack-protector" ] |
| } |
| |
| # libfuzzer also uses libc internally, by removing the fuzzing |
| # instrumentation we avoid it adding noise to the fuzzing coverage. |
| # TODO(25073): Once a cleaner solution is found, remove this. |
| configs = [ "//build/config/zircon:no_fuzzer" ] |
| } |
| |
| if (toolchain_variant.base == "//zircon/system/ulib/c:user.libc_$target_cpu") { |
| group("legacy-impl") { |
| visibility = [ "//zircon/system/ulib/c:*" ] |
| deps = [ |
| ":common-impl", |
| "ldso", |
| ] |
| } |
| |
| group("common-impl") { |
| visibility = [ |
| ":*", |
| "//zircon/system/ulib/c:*", |
| ] |
| deps = [ |
| "pthread", |
| "src/complex", |
| "src/conf", |
| "src/ctype", |
| "src/dirent", |
| "src/env", |
| "src/errno", |
| "src/exit", |
| "src/fcntl", |
| "src/internal", |
| "src/ipc", |
| "src/ldso", |
| "src/legacy", |
| "src/linux", |
| "src/locale", |
| "src/math", |
| "src/misc", |
| "src/mman", |
| "src/multibyte", |
| "src/network", |
| "src/passwd", |
| "src/prng", |
| "src/process", |
| "src/regex", |
| "src/sched", |
| "src/signal", |
| "src/stat", |
| "src/stdio", |
| "src/stdlib", |
| "src/string", |
| "src/temp", |
| "src/termios", |
| "src/thread", |
| "src/time", |
| "src/unistd", |
| "third_party/tre", |
| ] |
| } |
| |
| group("new-impl") { |
| visibility = [ "//zircon/system/ulib/c:*" ] |
| deps = [ ":common-impl" ] |
| } |
| } |
| |
| # We share just this internal header with fdio so it can implement |
| # getifaddrs re-using this address manipulation code. |
| source_set("getifaddrs-internal") { |
| visibility = [ |
| "src/network:*", |
| "//sdk/lib/fdio:*", |
| "//sdk/lib/fdio:fdio_sdk_manifest", |
| "//sdk/lib/fdio:fdio_sdk_manifest_meta_copy", |
| ] |
| sources = [ "src/network/getifaddrs.h" ] |
| public_configs = [ ":getifaddrs_include_dirs" ] |
| |
| # TODO(https://fxbug.dev/42136089): delete the below and fix compiler warnings |
| configs += [ "//build/config:Wno-conversion" ] |
| } |
| |
| config("getifaddrs_include_dirs") { |
| visibility = [ ":*" ] |
| include_dirs = [ "." ] |
| } |