github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/pkg/sentry/loader/vdsodata/BUILD (about)

     1  load("//tools:defs.bzl", "go_add_tags", "go_embed_data", "go_library")
     2  
     3  package(licenses = ["notice"])
     4  
     5  go_embed_data(
     6      name = "vdso_bin",
     7      src = "//vdso:vdso.so",
     8      package = "vdsodata",
     9      var = "Binary",
    10  )
    11  
    12  [
    13      # Generate multiple tagged files. Note that the contents of all files
    14      # will be the same (i.e. vdso_arm64.go will contain the amd64 vdso), but
    15      # the build tags will ensure only one is selected. When we generate the
    16      # "Go" branch, we select all archiecture files from the relevant build.
    17      # This is a hack around some limitations for "out" being a configurable
    18      # attribute and selects for srcs. See also tools/go_branch.sh.
    19      go_add_tags(
    20          name = "vdso_%s" % arch,
    21          src = ":vdso_bin",
    22          out = "vdso_%s.go" % arch,
    23          go_tags = [arch],
    24      )
    25      for arch in ("amd64", "arm64")
    26  ]
    27  
    28  go_library(
    29      name = "vdsodata",
    30      srcs = [
    31          "vdsodata.go",
    32          ":vdso_amd64",
    33          ":vdso_arm64",
    34      ],
    35      marshal = False,
    36      stateify = False,
    37      visibility = ["//pkg/sentry:internal"],
    38  )