mirror of
https://github.com/hanzoai/visor.git
synced 2026-09-24 17:04:14 +00:00
Specifically, build using bazel WORKSPACE. Bazel modules is still not used and requires further migration. This updates some dependencies to make them compatible with Bazel 8, which in turn requires explicitly adding some new dependencies to support new versions. In some cases existing patches no longer applied and had to be updated. A new patch was added to remove windows toolchains from coral-crosstools, because that functionality requires lots of bazel intrinsics that are no longer defined. At least on my machine, when //vdso:vdso was a dependency (not targetted explicitly), the Gold linker specified in `vdso_linker_option` failed to be found (bazel build //vdso worked); however this led me to discover that the Gold linker is deprecated, hence using it is removed entirely. To make the repo compatible with bazelisk out of the box, a bazelversion file has been added.
82 lines
2.1 KiB
Python
82 lines
2.1 KiB
Python
# Description:
|
|
# This VDSO is a shared library that provides the same interfaces as the
|
|
# normal system VDSO (time, gettimeofday, clock_gettimeofday) but which uses
|
|
# timekeeping parameters managed by the sandbox kernel.
|
|
|
|
# Placeholder: load py_test
|
|
load("//tools:arch.bzl", "select_arch")
|
|
load("//tools:defs.bzl", "cc_flags_supplier", "cc_toolchain")
|
|
|
|
package(
|
|
default_applicable_licenses = ["//:license"],
|
|
licenses = ["notice"],
|
|
)
|
|
|
|
exports_files(["check_vdso.py"])
|
|
|
|
genrule(
|
|
name = "vdso",
|
|
srcs = [
|
|
"barrier.h",
|
|
"compiler.h",
|
|
"cycle_clock.h",
|
|
"seqlock.h",
|
|
"syscalls.h",
|
|
"vdso.cc",
|
|
"vdso_amd64.lds",
|
|
"vdso_arm64.lds",
|
|
"vdso_time.h",
|
|
"vdso_time.cc",
|
|
],
|
|
outs = [
|
|
"vdso.so",
|
|
],
|
|
cmd = "$(CC) $(CC_FLAGS) " +
|
|
"-I. " +
|
|
"-O2 " +
|
|
"-std=c++11 " +
|
|
"-fPIC " +
|
|
"-fno-sanitize=all " +
|
|
# Some toolchains enable stack protector by default. Disable it, the
|
|
# VDSO has no hooks to handle failures.
|
|
"-fno-stack-protector " +
|
|
"-shared " +
|
|
"-nostdlib " +
|
|
"-Wl,-soname=linux-vdso.so.1 " +
|
|
"-Wl,--hash-style=sysv " +
|
|
"-Wl,--no-undefined " +
|
|
"-Wl,-Bsymbolic " +
|
|
"-Wl,-z,max-page-size=4096 " +
|
|
"-Wl,-z,common-page-size=4096 " +
|
|
select_arch(
|
|
amd64 = "-Wl,-T$(location vdso_amd64.lds) ",
|
|
arm64 = "-Wl,-T$(location vdso_arm64.lds) ",
|
|
no_match_error = "unsupported architecture",
|
|
) +
|
|
"-o $(location vdso.so) " +
|
|
"$(location vdso.cc) " +
|
|
"$(location vdso_time.cc)",
|
|
features = ["-pie"],
|
|
toolchains = [
|
|
cc_toolchain,
|
|
":no_pie_cc_flags",
|
|
],
|
|
visibility = ["//:sandbox"],
|
|
)
|
|
|
|
cc_flags_supplier(
|
|
name = "no_pie_cc_flags",
|
|
features = ["-pie"],
|
|
)
|
|
|
|
py_test(
|
|
name = "vdso_test",
|
|
srcs = ["check_vdso.py"],
|
|
args = [
|
|
"--check-data",
|
|
"--vdso=$(location :vdso)",
|
|
],
|
|
data = [":vdso"],
|
|
main = "check_vdso.py",
|
|
)
|