gvisor.dev/gvisor@v0.0.0-20240520182842-f9d4d51c7e0f/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:arch.bzl", "select_arch")
     5  load("//tools:defs.bzl", "cc_flags_supplier", "cc_library", "cc_toolchain")
     6  
     7  package(
     8      default_applicable_licenses = ["//:license"],
     9      licenses = ["notice"],
    10  )
    11  
    12  genrule(
    13      name = "rseq_binary",
    14      srcs = [
    15          "critical.h",
    16          "critical_amd64.S",
    17          "critical_arm64.S",
    18          "rseq.cc",
    19          "syscalls.h",
    20          "start_amd64.S",
    21          "start_arm64.S",
    22          "test.h",
    23          "types.h",
    24          "uapi.h",
    25      ],
    26      outs = ["rseq"],
    27      cmd = "$(CC) " +
    28            "$(CC_FLAGS) " +
    29            "-I. " +
    30            "-Wall " +
    31            "-Werror " +
    32            "-O2 " +
    33            "-std=c++17 " +
    34            "-static " +
    35            "-nostdlib " +
    36            "-ffreestanding " +
    37            "-o " +
    38            "$(location rseq) " +
    39            select_arch(
    40                amd64 = "$(location critical_amd64.S) $(location start_amd64.S) ",
    41                arm64 = "$(location critical_arm64.S) $(location start_arm64.S) ",
    42                no_match_error = "unsupported architecture",
    43            ) +
    44            "$(location rseq.cc)",
    45      toolchains = [
    46          cc_toolchain,
    47          ":no_pie_cc_flags",
    48      ],
    49      visibility = ["//:sandbox"],
    50  )
    51  
    52  cc_flags_supplier(
    53      name = "no_pie_cc_flags",
    54      features = ["-pie"],
    55  )
    56  
    57  cc_library(
    58      name = "lib",
    59      testonly = 1,
    60      hdrs = [
    61          "test.h",
    62          "uapi.h",
    63      ],
    64      visibility = ["//:sandbox"],
    65  )