summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/loader/vdsodata
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/loader/vdsodata')
-rw-r--r--pkg/sentry/loader/vdsodata/BUILD38
-rw-r--r--pkg/sentry/loader/vdsodata/vdsodata.go16
2 files changed, 54 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"],
+)
diff --git a/pkg/sentry/loader/vdsodata/vdsodata.go b/pkg/sentry/loader/vdsodata/vdsodata.go
new file mode 100644
index 000000000..a6dec3b48
--- /dev/null
+++ b/pkg/sentry/loader/vdsodata/vdsodata.go
@@ -0,0 +1,16 @@
+// Copyright 2020 The gVisor Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package vdsodata contains a compiled VDSO object.
+package vdsodata