summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux/rseq/BUILD
blob: 5cfe4e56f25d368a98bec943856a311a75755383 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# This package contains a standalone rseq test binary. This binary must not
# depend on libc, which might use rseq itself.

load("@bazel_tools//tools/cpp:cc_flags_supplier.bzl", "cc_flags_supplier")
load("@rules_cc//cc:defs.bzl", "cc_library")

package(licenses = ["notice"])

genrule(
    name = "rseq_binary",
    srcs = [
        "critical.h",
        "critical.S",
        "rseq.cc",
        "syscalls.h",
        "start.S",
        "test.h",
        "types.h",
        "uapi.h",
    ],
    outs = ["rseq"],
    cmd = " ".join([
        "$(CC)",
        "$(CC_FLAGS) ",
        "-I.",
        "-Wall",
        "-Werror",
        "-O2",
        "-std=c++17",
        "-static",
        "-nostdlib",
        "-ffreestanding",
        "-o",
        "$(location rseq)",
        "$(location critical.S)",
        "$(location rseq.cc)",
        "$(location start.S)",
    ]),
    toolchains = [
        ":no_pie_cc_flags",
        "@bazel_tools//tools/cpp:current_cc_toolchain",
    ],
    visibility = ["//:sandbox"],
)

cc_flags_supplier(
    name = "no_pie_cc_flags",
    features = ["-pie"],
)

cc_library(
    name = "lib",
    testonly = 1,
    hdrs = [
        "test.h",
        "uapi.h",
    ],
    visibility = ["//:sandbox"],
)