xref: /aosp_15_r20/external/sandboxed-api/sandboxed_api/sandbox2/util/BUILD.bazel (revision ec63e07ab9515d95e79c211197c445ef84cefa6a)
1# Copyright 2019 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15load("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts")
16
17_DEFAULT_VISIBILITY = [
18    "//sandboxed_api:__subpackages__",
19]
20
21package(default_visibility = _DEFAULT_VISIBILITY)
22
23package_group(
24    name = "minielf_users",
25    packages = [
26    ],
27)
28
29licenses(["notice"])
30
31cc_library(
32    name = "bpf_helper",
33    srcs = ["bpf_helper.c"],
34    hdrs = ["bpf_helper.h"],
35    visibility = ["//visibility:public"],
36)
37
38cc_library(
39    name = "minielf",
40    srcs = ["minielf.cc"],
41    hdrs = ["minielf.h"],
42    copts = sapi_platform_copts(),
43    visibility = _DEFAULT_VISIBILITY + [":minielf_users"],
44    deps = [
45        "//sandboxed_api:config",
46        "//sandboxed_api/sandbox2:util",
47        "//sandboxed_api/util:raw_logging",
48        "//sandboxed_api/util:status",
49        "@com_google_absl//absl/base:endian",
50        "@com_google_absl//absl/status",
51        "@com_google_absl//absl/status:statusor",
52        "@com_google_absl//absl/strings",
53    ],
54)
55
56cc_test(
57    name = "minielf_test",
58    srcs = ["minielf_test.cc"],
59    copts = sapi_platform_copts(),
60    data = [
61        ":testdata/chrome_grte_header",
62        ":testdata/hello_world",
63    ],
64    features = ["-dynamic_link_test_srcs"],  # see go/dynamic_link_test_srcs
65    deps = [
66        ":maps_parser",
67        ":minielf",
68        "//sandboxed_api:testing",
69        "//sandboxed_api/util:file_helpers",
70        "//sandboxed_api/util:status_matchers",
71        "@com_google_absl//absl/algorithm:container",
72        "@com_google_absl//absl/status:statusor",
73        "@com_google_googletest//:gtest_main",
74    ],
75)
76
77cc_library(
78    name = "syscall_trap",
79    srcs = ["syscall_trap.cc"],
80    hdrs = ["syscall_trap.h"],
81    copts = sapi_platform_copts(),
82    deps = [
83        "//sandboxed_api:config",
84        "@com_google_absl//absl/log:check",
85    ],
86)
87
88cc_library(
89    name = "maps_parser",
90    srcs = ["maps_parser.cc"],
91    hdrs = ["maps_parser.h"],
92    copts = sapi_platform_copts(),
93    deps = [
94        "@com_google_absl//absl/status",
95        "@com_google_absl//absl/status:statusor",
96        "@com_google_absl//absl/strings",
97    ],
98)
99
100cc_test(
101    name = "maps_parser_test",
102    srcs = ["maps_parser_test.cc"],
103    copts = sapi_platform_copts(),
104    deps = [
105        ":maps_parser",
106        "//sandboxed_api/util:status_matchers",
107        "@com_google_absl//absl/status:statusor",
108        "@com_google_googletest//:gtest_main",
109    ],
110)
111