summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/loader/vdsodata/BUILD
diff options
context:
space:
mode:
authorAdin Scannell <ascannell@google.com>2021-01-11 22:31:16 -0800
committergVisor bot <gvisor-bot@google.com>2021-01-11 22:33:36 -0800
commita20da708291e2e5bdece5176dce61c1b4b10b7d9 (patch)
tree1546859b6436ee1ad7dffa6b67849c67d2182ccf /pkg/sentry/loader/vdsodata/BUILD
parente06c2b1264f5800730b93eff5c9913fd870025b9 (diff)
Fix Go branch for arm64.
This requires several changes: * Templates must preserve relevant tags. * Pagetables templates are split into two targets, each preserving tags. * The binary VDSO is similarly split into two targets, with some juggling. * The top level tools/go_branch.sh now does a crossbuild of ARM64 as well, and checks and merges the results of the two branches together. Fixes #5178 PiperOrigin-RevId: 351304330
Diffstat (limited to 'pkg/sentry/loader/vdsodata/BUILD')
-rw-r--r--pkg/sentry/loader/vdsodata/BUILD38
1 files changed, 38 insertions, 0 deletions
diff --git a/pkg/sentry/loader/vdsodata/BUILD b/pkg/sentry/loader/vdsodata/BUILD
new file mode 100644
index 000000000..119199f97
--- /dev/null
+++ b/pkg/sentry/loader/vdsodata/BUILD
@@ -0,0 +1,38 @@
+load("//tools:defs.bzl", "go_add_tags", "go_embed_data", "go_library")
+
+package(licenses = ["notice"])
+
+go_embed_data(
+ name = "vdso_bin",
+ src = "//vdso:vdso.so",
+ package = "vdsodata",
+ var = "Binary",
+)
+
+[
+ # Generate multiple tagged files. Note that the contents of all files
+ # will be the same (i.e. vdso_arm64.go will contain the amd64 vdso), but
+ # the build tags will ensure only one is selected. When we generate the
+ # "Go" branch, we select all archiecture files from the relevant build.
+ # This is a hack around some limitations for "out" being a configurable
+ # attribute and selects for srcs. See also tools/go_branch.sh.
+ go_add_tags(
+ name = "vdso_%s" % arch,
+ src = ":vdso_bin",
+ out = "vdso_%s.go" % arch,
+ go_tags = [arch],
+ )
+ for arch in ("amd64", "arm64")
+]
+
+go_library(
+ name = "vdsodata",
+ srcs = [
+ "vdsodata.go",
+ ":vdso_amd64",
+ ":vdso_arm64",
+ ],
+ marshal = False,
+ stateify = False,
+ visibility = ["//pkg/sentry:internal"],
+)