| # Copyright 2021 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/components.gni") |
| import("//build/zircon/migrated_targets.gni") |
| |
| is_elf = current_os != "mac" && current_os != "win" |
| |
| zx_library("elfldltl") { |
| sdk = "source" |
| sdk_headers = [ |
| "lib/elfldltl/compat-hash.h", |
| "lib/elfldltl/constants.h", |
| "lib/elfldltl/container.h", |
| "lib/elfldltl/diagnostics.h", |
| "lib/elfldltl/dynamic.h", |
| "lib/elfldltl/fd.h", |
| "lib/elfldltl/field.h", |
| "lib/elfldltl/file.h", |
| "lib/elfldltl/fuzzer.h", |
| "lib/elfldltl/gnu-hash.h", |
| "lib/elfldltl/init-fini.h", |
| "lib/elfldltl/internal/const-string.h", |
| "lib/elfldltl/internal/diagnostics-printf.h", |
| "lib/elfldltl/internal/dynamic-tag-error.h", |
| "lib/elfldltl/internal/load-segment-types.h", |
| "lib/elfldltl/internal/phdr-error.h", |
| "lib/elfldltl/layout.h", |
| "lib/elfldltl/link.h", |
| "lib/elfldltl/load.h", |
| "lib/elfldltl/machine.h", |
| "lib/elfldltl/mapped-fd-file.h", |
| "lib/elfldltl/mapped-vmo-file.h", |
| "lib/elfldltl/memory.h", |
| "lib/elfldltl/note.h", |
| "lib/elfldltl/phdr.h", |
| "lib/elfldltl/preallocated-vector.h", |
| "lib/elfldltl/relocation.h", |
| "lib/elfldltl/relro.h", |
| "lib/elfldltl/self.h", |
| "lib/elfldltl/static-pie-with-vdso.h", |
| "lib/elfldltl/static-pie.h", |
| "lib/elfldltl/static-vector.h", |
| "lib/elfldltl/symbol.h", |
| "lib/elfldltl/vmo.h", |
| ] |
| |
| sources = [] |
| if (is_elf) { |
| sources += [ "self.cc" ] |
| configs += [ "//build/config/sanitizers:no_sanitizers" ] |
| libs = [ "./self-base.ld" ] |
| } |
| |
| public_deps = [ "//sdk/lib/stdcompat" ] |
| if (!is_kernel) { |
| public_deps += [ |
| # <lib/elfldltl/mapped-fd-file.h> has #include <lib/fit/result.h>. |
| "//sdk/lib/fit:headers", |
| |
| # <lib/elfldltl/fd.h> has #include <fbl/unique_fd.h>. |
| "//zircon/system/ulib/fbl:headers", |
| ] |
| if (is_fuchsia) { |
| public_deps += [ |
| # <lib/elfldltl/mapped-vmo-file.h> has #include <lib/zx/status.h>. |
| "//zircon/system/ulib/zx:headers", |
| |
| # <lib/elfldltl/vmo.h> has #include <lib/zx/vmo.h>. |
| "//zircon/system/ulib/zx:headers", |
| ] |
| } |
| } |
| |
| deps = [] |
| if (is_kernel) { |
| deps += [ |
| "//zircon/kernel/lib/ktl", |
| "//zircon/kernel/lib/libc", |
| ] |
| } else { |
| sources += [ "mapped-fd-file.cc" ] |
| deps += [ |
| "//sdk/lib/fit", |
| "//zircon/system/ulib/fbl", |
| ] |
| if (is_fuchsia) { |
| sources += [ "mapped-vmo-file.cc" ] |
| deps += [ "//zircon/system/ulib/zx" ] |
| } |
| } |
| |
| if (current_os == "linux") { |
| configs -= [ "//build/config/linux:implicit-host-libs" ] |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| |
| deps = [ "test:tests" ] |
| } |