github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/test/syscalls/linux/rseq/BUILD (about)

     1  # This package contains a standalone rseq test binary. This binary must not
     2  # depend on libc, which might use rseq itself.
     3  
     4  load("//tools:defs.bzl", "cc_flags_supplier", "cc_library", "cc_toolchain", "select_arch")
     5  
     6  package(licenses = ["notice"])
     7  
     8  genrule(
     9      name = "rseq_binary",
    10      srcs = [
    11          "critical.h",
    12          "critical_amd64.S",
    13          "critical_arm64.S",
    14          "rseq.cc",
    15          "syscalls.h",
    16          "start_amd64.S",
    17          "start_arm64.S",
    18          "test.h",
    19          "types.h",
    20          "uapi.h",
    21      ],
    22      outs = ["rseq"],
    23      cmd = "$(CC) " +
    24            "$(CC_FLAGS) " +
    25            "-I. " +
    26            "-Wall " +
    27            "-Werror " +
    28            "-O2 " +
    29            "-std=c++17 " +
    30            "-static " +
    31            "-nostdlib " +
    32            "-ffreestanding " +
    33            "-o " +
    34            "$(location rseq) " +
    35            select_arch(
    36                amd64 = "$(location critical_amd64.S) $(location start_amd64.S) ",
    37                arm64 = "$(location critical_arm64.S) $(location start_arm64.S) ",
    38                no_match_error = "unsupported architecture",
    39            ) +
    40            "$(location rseq.cc)",
    41      toolchains = [
    42          cc_toolchain,
    43          ":no_pie_cc_flags",
    44      ],
    45      visibility = ["//:sandbox"],
    46  )
    47  
    48  cc_flags_supplier(
    49      name = "no_pie_cc_flags",
    50      features = ["-pie"],
    51  )
    52  
    53  cc_library(
    54      name = "lib",
    55      testonly = 1,
    56      hdrs = [
    57          "test.h",
    58          "uapi.h",
    59      ],
    60      visibility = ["//:sandbox"],
    61  )