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