mirror of
https://github.com/urbit/vere.git
synced 2024-09-11 03:45:31 +03:00
Build with bazel
on linux-arm64
(#16)
This commit is contained in:
parent
b339b5067a
commit
5f838386fb
5
.bazelrc
5
.bazelrc
@ -9,5 +9,10 @@ build --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
|
||||
# https://github.com/bazelbuild/bazel/issues/7260.
|
||||
build --incompatible_enable_cc_toolchain_resolution
|
||||
|
||||
# Add aliases for compiler version build settings.
|
||||
build --flag_alias=aarch64_linux_gnu_gcc_version=//:aarch64_linux_gnu_gcc_version
|
||||
build --flag_alias=clang_version=//:clang_version
|
||||
build --flag_alias=gcc_version=//:gcc_version
|
||||
|
||||
# Any personal configuration should go in .user.bazelrc.
|
||||
try-import %workspace%/.user.bazelrc
|
||||
|
80
BUILD.bazel
80
BUILD.bazel
@ -1,9 +1,11 @@
|
||||
load("//bazel:common_settings.bzl", "string_flag")
|
||||
|
||||
#
|
||||
# OS-CPU CONFIG SETTINGS
|
||||
#
|
||||
|
||||
config_setting(
|
||||
name = "linux-arm64",
|
||||
name = "linux_arm64",
|
||||
constraint_values = [
|
||||
"@platforms//os:linux",
|
||||
"@platforms//cpu:arm64",
|
||||
@ -11,7 +13,7 @@ config_setting(
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "linux-x86_64",
|
||||
name = "linux_x86_64",
|
||||
constraint_values = [
|
||||
"@platforms//os:linux",
|
||||
"@platforms//cpu:x86_64",
|
||||
@ -19,7 +21,7 @@ config_setting(
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "macos-arm64",
|
||||
name = "macos_arm64",
|
||||
constraint_values = [
|
||||
"@platforms//os:macos",
|
||||
"@platforms//cpu:arm64",
|
||||
@ -27,7 +29,7 @@ config_setting(
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "macos-x86_64",
|
||||
name = "macos_x86_64",
|
||||
constraint_values = [
|
||||
"@platforms//os:macos",
|
||||
"@platforms//cpu:x86_64",
|
||||
@ -35,7 +37,7 @@ config_setting(
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "openbsd-x86_64",
|
||||
name = "openbsd_x86_64",
|
||||
constraint_values = [
|
||||
"@platforms//os:openbsd",
|
||||
"@platforms//cpu:x86_64",
|
||||
@ -43,7 +45,7 @@ config_setting(
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "windows-x86_64",
|
||||
name = "windows_x86_64",
|
||||
constraint_values = [
|
||||
"@platforms//os:windows",
|
||||
"@platforms//cpu:x86_64",
|
||||
@ -51,27 +53,90 @@ config_setting(
|
||||
)
|
||||
|
||||
#
|
||||
# COMPILER CONSTRAINT SETTINGS
|
||||
# COMPILERS
|
||||
#
|
||||
|
||||
constraint_setting(name = "compiler")
|
||||
|
||||
# Cross compiler from x86_64 to arm64.
|
||||
constraint_value(
|
||||
name = "aarch64_linux_gnu_gcc",
|
||||
constraint_setting = ":compiler",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Compiler for x86_64.
|
||||
constraint_value(
|
||||
name = "clang",
|
||||
constraint_setting = ":compiler",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Compiler for x86_64.
|
||||
constraint_value(
|
||||
name = "gcc",
|
||||
constraint_setting = ":compiler",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Version flag for aarch64-linux-gnu-gcc.
|
||||
string_flag(
|
||||
name = "aarch64_linux_gnu_gcc_version",
|
||||
build_setting_default = "12.2.0",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Version flag for clang.
|
||||
string_flag(
|
||||
name = "clang_version",
|
||||
build_setting_default = "14.0.6",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Version flag for gcc.
|
||||
string_flag(
|
||||
name = "gcc_version",
|
||||
build_setting_default = "12.2.0",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
#
|
||||
# PLATFORMS
|
||||
#
|
||||
|
||||
# A platform takes one of two formats: `<compiler>-<os>-<cpu>` or `<os>-<cpu>`
|
||||
# if the compiler is unspecified.
|
||||
|
||||
# Linux arm64 platform with unspecified compiler.
|
||||
platform(
|
||||
name = "linux-arm64",
|
||||
constraint_values = [
|
||||
"@platforms//os:linux",
|
||||
"@platforms//cpu:arm64",
|
||||
],
|
||||
)
|
||||
|
||||
# Linux x86_64 platform with unspecified compiler.
|
||||
platform(
|
||||
name = "linux-x86_64",
|
||||
constraint_values = [
|
||||
"@platforms//os:linux",
|
||||
"@platforms//cpu:x86_64",
|
||||
],
|
||||
)
|
||||
|
||||
# Linux x86_64 platform with aarch64-linux-gnu-gcc.
|
||||
platform(
|
||||
name = "aarch64_linux_gnu_gcc-linux-x86_64",
|
||||
constraint_values = [
|
||||
":aarch64_linux_gnu_gcc",
|
||||
"@platforms//os:linux",
|
||||
"@platforms//cpu:x86_64",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Linux x86_64 platform with clang.
|
||||
platform(
|
||||
name = "clang-linux-x86_64",
|
||||
constraint_values = [
|
||||
@ -82,6 +147,7 @@ platform(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Linux x86_64 platform with gcc.
|
||||
platform(
|
||||
name = "gcc-linux-x86_64",
|
||||
constraint_values = [
|
||||
|
68
README.md
68
README.md
@ -31,31 +31,63 @@ defined in its own package:
|
||||
|
||||
## Build
|
||||
|
||||
We use [`bazel`][bazel] to build Urbit's runtime. We support the following
|
||||
platforms:
|
||||
We use [`bazel`][bazel] to build Urbit's runtime, which is packaged as a single
|
||||
binary, `urbit`. We support the following `(host, target)` pairs, where the host
|
||||
platform is where [`bazel`][bazel] runs and the target platform is where `urbit`
|
||||
will run:
|
||||
|
||||
- `darwin-arm64` (macOS running Apple Silicon)
|
||||
- `darwin-x86_64` (macOS running Intel silicon)
|
||||
- `linux-arm64`
|
||||
- `linux-x86_64`
|
||||
- `openbsd-x86_64`
|
||||
- `mingw-x86_64`
|
||||
--------------------------------------------------------------------------------
|
||||
Host Platform | Target Platform | Required Toolchain
|
||||
--------------------------------------------------------------------------------
|
||||
`aarch64_linux_gnu_gcc-linux-x86_64` | `linux-arm64` | `aarch64-linux_gnu_gcc`
|
||||
`gcc-linux-x86_64` | `linux-x86_64` | `gcc`
|
||||
`clang-linux-x86_64` | `linux-x86_64` | `clang`
|
||||
|
||||
To build the `urbit` binary, the primary artifact of this repository, ensure
|
||||
that you're on a supported platform and that you have an up-to-date version of
|
||||
[`bazel`][bazel], and then run:
|
||||
Once you've identified your `(host, target)` pair, determine the version of the
|
||||
pair's required toolchain and ensure you have an up-to-date version of
|
||||
[`bazel`][bazel]. Then, run:
|
||||
|
||||
```console
|
||||
$ bazel build :urbit
|
||||
$ bazel build --<toolchain>_version="<toolchain_version>" \
|
||||
--host_platform=//:<host_platform> \
|
||||
--platforms=//:<target_platform> :urbit
|
||||
```
|
||||
|
||||
The build will take a while since `bazel` has to download and build from source
|
||||
all of `urbit`'s third-party dependencies.
|
||||
For example, to build a `linux-x86_64` `urbit` binary on a `linux-x86_64`
|
||||
machine using version `14.0.6` of the `clang` toolchain, run:
|
||||
|
||||
```console
|
||||
$ bazel build --clang_version="14.0.6" \
|
||||
--host_platform=//:gcc-linux-x86_64 \
|
||||
--platforms=//:linux-x86_64
|
||||
```
|
||||
|
||||
And to build a `linux-arm64` `urbit` binary on a `linux-x86_64` machine using
|
||||
version `12.2.0` of the `aarch64-linux-gnu-gcc` toolchain (which you'll have to
|
||||
install), run:
|
||||
|
||||
```console
|
||||
$ bazel build --aarch64_linux_gnu_gcc_version="12.2.0" \
|
||||
--host_platform=//:aarch64_linux_gnu_gcc-linux-x86_64 \
|
||||
--platforms=//:linux-arm64
|
||||
```
|
||||
|
||||
Specifying `--<toolchain>_version`, `--host_platform`, and `--platforms` for
|
||||
each build is tedious and can be avoided by writing to `.user.bazelrc`:
|
||||
|
||||
```console
|
||||
$ echo 'build --aarch64_linux_gnu_gcc_version="12.2.0"' >> .user.bazelrc
|
||||
$ echo 'build --clang_version="14.0.6"' >> .user.bazelrc
|
||||
$ echo 'build --gcc_version="12.2.0"' >> .user.bazelrc
|
||||
$ echo 'build --host_platform=//:<host_platform>' >> .user.bazelrc
|
||||
$ echo 'build --platforms=//:<target_platform>' >> .user.bazelrc
|
||||
$ bazel build :urbit
|
||||
```
|
||||
|
||||
To run the just-built `urbit` binary, run:
|
||||
|
||||
```console
|
||||
$ bazel-bin/pkg/vere/urbit ...
|
||||
$ bazel-bin/pkg/vere/urbit <snip>
|
||||
```
|
||||
|
||||
Or, to save yourself a few keystrokes, create a symlink to the `urbit` binary in
|
||||
@ -63,9 +95,13 @@ the root of the repository:
|
||||
|
||||
```console
|
||||
$ ln -s bazel-bin/pkg/vere/urbit urbit
|
||||
$ ./urbit ...
|
||||
$ ./urbit <snip>
|
||||
```
|
||||
|
||||
The remaining commands in this section assume that `.user.bazlerc` specifies
|
||||
`--host_platform` and `--platforms`. If not, `--host_platform` and `--platforms`
|
||||
must be provided at the command line as in the build commands above.
|
||||
|
||||
To run all runtime tests, run:
|
||||
|
||||
```console
|
||||
|
@ -73,13 +73,20 @@ versioned_http_archive(
|
||||
|
||||
# Use the toolchains we've configured.
|
||||
register_toolchains(
|
||||
"//bazel/toolchain:aarch64_linux_gnu_gcc-linux-x86_64-toolchain",
|
||||
"//bazel/toolchain:clang-linux-x86_64-toolchain",
|
||||
"//bazel/toolchain:gcc-linux-x86_64-toolchain",
|
||||
)
|
||||
|
||||
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
|
||||
|
||||
rules_foreign_cc_dependencies()
|
||||
# See
|
||||
# https://bazelbuild.github.io/rules_foreign_cc/0.9.0/flatten.html#rules_foreign_cc_dependencies.
|
||||
rules_foreign_cc_dependencies(
|
||||
register_built_tools = False,
|
||||
register_default_tools = False,
|
||||
register_preinstalled_tools = True,
|
||||
)
|
||||
|
||||
#
|
||||
# THIRD PARTY DEPENDENCIES
|
||||
@ -141,6 +148,8 @@ versioned_http_archive(
|
||||
versioned_http_archive(
|
||||
name = "h2o",
|
||||
build_file = "//bazel/third_party/h2o:h2o.BUILD",
|
||||
patch_args = ["-p1"],
|
||||
patches = ["//bazel/third_party/h2o:{version}.patch"],
|
||||
sha256 = "f8cbc1b530d85ff098f6efc2c3fdbc5e29baffb30614caac59d5c710f7bda201",
|
||||
strip_prefix = "h2o-{version}",
|
||||
url = "https://github.com/h2o/h2o/archive/refs/tags/v{version}.tar.gz",
|
||||
@ -244,6 +253,15 @@ versioned_http_archive(
|
||||
version = "5c06db33fc1e2130f67c045327b0ec949032df1d",
|
||||
)
|
||||
|
||||
versioned_http_archive(
|
||||
name = "sse2neon",
|
||||
build_file = "//bazel/third_party/sse2neon:sse2neon.BUILD",
|
||||
sha256 = "4001e2dfb14fcf3831211581ed83bcc83cf6a3a69f638dcbaa899044a351bb2a",
|
||||
strip_prefix = "sse2neon-{version}",
|
||||
url = "https://github.com/DLTcollab/sse2neon/archive/refs/tags/v{version}.tar.gz",
|
||||
version = "1.5.1",
|
||||
)
|
||||
|
||||
versioned_http_archive(
|
||||
name = "uv",
|
||||
build_file = "//bazel/third_party/uv:uv.BUILD",
|
||||
|
12
bazel/common_settings.bzl
Normal file
12
bazel/common_settings.bzl
Normal file
@ -0,0 +1,12 @@
|
||||
# For more, see https://bazel.build/extending/config and
|
||||
# https://github.com/bazelbuild/bazel-skylib/blob/main/rules/common_settings.bzl.
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
|
||||
|
||||
def _impl(ctx):
|
||||
return BuildSettingInfo(value = ctx.build_setting_value)
|
||||
|
||||
string_flag = rule(
|
||||
implementation = _impl,
|
||||
build_setting = config.string(flag = True),
|
||||
doc = "A string-typed build setting that can be set on the command line",
|
||||
)
|
9
bazel/third_party/curl/curl.BUILD
vendored
9
bazel/third_party/curl/curl.BUILD
vendored
@ -47,12 +47,15 @@ configure_make(
|
||||
"--without-librtmp",
|
||||
"--without-nghttp2",
|
||||
"--without-ngtcp2",
|
||||
"--without-ssl",
|
||||
"--without-zlib",
|
||||
"--without-zstd",
|
||||
],
|
||||
] + select({
|
||||
# Native compilation on linux-arm64 isn't supported.
|
||||
"@//:linux_arm64": ["--host=aarch64-linux-gnu"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
env = {
|
||||
"URBIT_RUNTIME_OPENSSL": "$(GENDIR)/external/openssl/openssl",
|
||||
"URBIT_RUNTIME_OPENSSL": "$$PWD/$(GENDIR)/external/openssl/openssl",
|
||||
},
|
||||
lib_source = ":all",
|
||||
out_static_libs = ["libcurl.a"],
|
||||
|
8
bazel/third_party/gmp/gmp.BUILD
vendored
8
bazel/third_party/gmp/gmp.BUILD
vendored
@ -9,7 +9,13 @@ filegroup(
|
||||
configure_make(
|
||||
name = "gmp",
|
||||
args = ["--jobs=`nproc`"],
|
||||
configure_options = ["--disable-shared"],
|
||||
configure_options = [
|
||||
"--disable-shared",
|
||||
] + select({
|
||||
# Native compilation on linux-arm64 isn't supported.
|
||||
"@//:linux_arm64": ["--host=aarch64-linux-gnu"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
lib_source = ":all",
|
||||
out_static_libs = ["libgmp.a"],
|
||||
visibility = ["//visibility:public"],
|
||||
|
47
bazel/third_party/h2o/2.2.6.patch
vendored
Normal file
47
bazel/third_party/h2o/2.2.6.patch
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
diff --git a/deps/klib/ksw.c b/deps/klib/ksw.c
|
||||
index 742fec90b..9a11a21bd 100644
|
||||
--- a/deps/klib/ksw.c
|
||||
+++ b/deps/klib/ksw.c
|
||||
@@ -25,7 +25,11 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
+#if defined(URBIT_RUNTIME_ARCH_ARM64)
|
||||
+#include "sse2neon.h"
|
||||
+#else
|
||||
#include <emmintrin.h>
|
||||
+#endif
|
||||
#include "ksw.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
diff --git a/deps/klib/test/kbit_test.c b/deps/klib/test/kbit_test.c
|
||||
index 3ae3bd309..7db05a186 100644
|
||||
--- a/deps/klib/test/kbit_test.c
|
||||
+++ b/deps/klib/test/kbit_test.c
|
||||
@@ -1,7 +1,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
+#if defined(URBIT_RUNTIME_ARCH_ARM64)
|
||||
+#include "sse2neon.h"
|
||||
+#else
|
||||
#include <emmintrin.h>
|
||||
+#endif
|
||||
#include "kbit.h"
|
||||
|
||||
// from bowtie-0.9.8.1
|
||||
diff --git a/deps/picohttpparser/picohttpparser.c b/deps/picohttpparser/picohttpparser.c
|
||||
index a707070d1..714850f64 100644
|
||||
--- a/deps/picohttpparser/picohttpparser.c
|
||||
+++ b/deps/picohttpparser/picohttpparser.c
|
||||
@@ -28,7 +28,9 @@
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#ifdef __SSE4_2__
|
||||
-#ifdef _MSC_VER
|
||||
+#if defined(URBIT_RUNTIME_ARCH_ARM64)
|
||||
+#include "sse2neon.h"
|
||||
+#elif defined(_MSC_VER)
|
||||
#include <nmmintrin.h>
|
||||
#else
|
||||
#include <x86intrin.h>
|
19
bazel/third_party/h2o/h2o.BUILD
vendored
19
bazel/third_party/h2o/h2o.BUILD
vendored
@ -42,8 +42,18 @@ cc_library(
|
||||
hdrs = glob(["deps/klib/*.h"]),
|
||||
includes = ["deps/klib"],
|
||||
linkstatic = True,
|
||||
local_defines = select({
|
||||
"@platforms//cpu:arm64": ["URBIT_RUNTIME_ARCH_ARM64"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:private"],
|
||||
deps = ["@curl"],
|
||||
deps = [
|
||||
"@curl",
|
||||
"@zlib",
|
||||
] + select({
|
||||
"@platforms//cpu:arm64": ["@sse2neon"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)
|
||||
|
||||
# See `deps/libgkc` in the `h2o` repo.
|
||||
@ -132,9 +142,7 @@ cc_library(
|
||||
# See `deps/yoml` in the `h2o` repo.
|
||||
cc_library(
|
||||
name = "yoml",
|
||||
hdrs = glob(
|
||||
["deps/yoml/*.h"],
|
||||
),
|
||||
hdrs = glob(["deps/yoml/*.h"]),
|
||||
includes = ["deps/yoml"],
|
||||
linkstatic = True,
|
||||
visibility = ["//visibility:private"],
|
||||
@ -305,9 +313,8 @@ cc_library(
|
||||
hdrs = ["include/h2o.h"] + glob(
|
||||
[
|
||||
"include/h2o/*.h",
|
||||
"include/h2o/socket/*.h",
|
||||
],
|
||||
) + glob(
|
||||
["include/h2o/socket/*.h"],
|
||||
),
|
||||
copts = [
|
||||
"-std=c99",
|
||||
|
10
bazel/third_party/openssl/openssl.BUILD
vendored
10
bazel/third_party/openssl/openssl.BUILD
vendored
@ -11,12 +11,22 @@ configure_make(
|
||||
args = ["--jobs=`nproc`"],
|
||||
configure_command = select({
|
||||
"@platforms//os:windows": "Configure",
|
||||
"@//:linux_arm64": "Configure",
|
||||
"//conditions:default": "config",
|
||||
}),
|
||||
configure_options = [
|
||||
"no-shared",
|
||||
] + select({
|
||||
"@platforms//os:windows": ["mingw64"],
|
||||
"@//:linux_arm64": [
|
||||
"linux-aarch64",
|
||||
# Native compilation on linux-arm64 isn't supported. The prefix is
|
||||
# empty because the configure script detects an absolute path to the
|
||||
# aarch64-linux-gnu-gcc instead of just the binary name. This is
|
||||
# presumably because of the Bazel toolchain configuration but is not
|
||||
# an issue.
|
||||
"--cross-compile-prefix=",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
configure_prefix = select({
|
||||
|
6
bazel/third_party/secp256k1/secp256k1.BUILD
vendored
6
bazel/third_party/secp256k1/secp256k1.BUILD
vendored
@ -15,7 +15,11 @@ configure_make(
|
||||
"--enable-module-recovery",
|
||||
"--enable-module-schnorrsig",
|
||||
"--enable-static",
|
||||
],
|
||||
] + select({
|
||||
# Native compilation on linux-arm64 isn't supported.
|
||||
"@//:linux_arm64": ["--host=aarch64-linux-gnu"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
lib_source = ":all",
|
||||
out_static_libs = ["libsecp256k1.a"],
|
||||
visibility = ["//visibility:public"],
|
||||
|
4
bazel/third_party/sigsegv/sigsegv.BUILD
vendored
4
bazel/third_party/sigsegv/sigsegv.BUILD
vendored
@ -16,6 +16,10 @@ configure_make(
|
||||
# slowdowns.
|
||||
"@platforms//os:linux": ["--disable-stackvma"],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
# Native compilation on linux-arm64 isn't supported.
|
||||
"@//:linux_arm64": ["--host=aarch64-linux-gnu"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
lib_source = ":all",
|
||||
out_static_libs = ["libsigsegv.a"],
|
||||
|
277
bazel/third_party/softfloat/softfloat.BUILD
vendored
277
bazel/third_party/softfloat/softfloat.BUILD
vendored
@ -7,6 +7,280 @@ load("@rules_foreign_cc//foreign_cc:defs.bzl", "make")
|
||||
# repo, was useful in deriving this build file:
|
||||
# http://www.jhauser.us/arithmetic/SoftFloat-3/doc/SoftFloat-source.html
|
||||
|
||||
cc_library(
|
||||
name = "softfloat_linux_arm64",
|
||||
srcs = [
|
||||
# See `OBJS_PRIMITIVES` in `build/Linux-ARM-VFPv2-GCC/Makefile` in the
|
||||
# `softfloat` repo.
|
||||
"source/s_compare96M.c",
|
||||
"source/s_compare128M.c",
|
||||
"source/s_shortShiftLeft64To96M.c",
|
||||
"source/s_shortShiftLeftM.c",
|
||||
"source/s_shiftLeftM.c",
|
||||
"source/s_shortShiftRightM.c",
|
||||
"source/s_shortShiftRightJam64.c",
|
||||
"source/s_shortShiftRightJamM.c",
|
||||
"source/s_shiftRightJam32.c",
|
||||
"source/s_shiftRightJam64.c",
|
||||
"source/s_shiftRightJamM.c",
|
||||
"source/s_shiftRightM.c",
|
||||
"source/s_countLeadingZeros8.c",
|
||||
"source/s_countLeadingZeros16.c",
|
||||
"source/s_countLeadingZeros32.c",
|
||||
"source/s_countLeadingZeros64.c",
|
||||
"source/s_addM.c",
|
||||
"source/s_addCarryM.c",
|
||||
"source/s_addComplCarryM.c",
|
||||
"source/s_negXM.c",
|
||||
"source/s_sub1XM.c",
|
||||
"source/s_subM.c",
|
||||
"source/s_mul64To128M.c",
|
||||
"source/s_mul128MTo256M.c",
|
||||
"source/s_approxRecip_1Ks.c",
|
||||
"source/s_approxRecip32_1.c",
|
||||
"source/s_approxRecipSqrt_1Ks.c",
|
||||
"source/s_approxRecipSqrt32_1.c",
|
||||
"source/s_remStepMBy32.c",
|
||||
# See `OBJS_SPECIALIZE` in `build/Linux-ARM-VFPv2-GCC/Makefile` in the
|
||||
# `softfloat` repo.
|
||||
"source/ARM-VFPv2/softfloat_raiseFlags.c",
|
||||
"source/ARM-VFPv2/s_f16UIToCommonNaN.c",
|
||||
"source/ARM-VFPv2/s_commonNaNToF16UI.c",
|
||||
"source/ARM-VFPv2/s_propagateNaNF16UI.c",
|
||||
"source/ARM-VFPv2/s_f32UIToCommonNaN.c",
|
||||
"source/ARM-VFPv2/s_commonNaNToF32UI.c",
|
||||
"source/ARM-VFPv2/s_propagateNaNF32UI.c",
|
||||
"source/ARM-VFPv2/s_f64UIToCommonNaN.c",
|
||||
"source/ARM-VFPv2/s_commonNaNToF64UI.c",
|
||||
"source/ARM-VFPv2/s_propagateNaNF64UI.c",
|
||||
"source/ARM-VFPv2/extF80M_isSignalingNaN.c",
|
||||
"source/ARM-VFPv2/s_extF80MToCommonNaN.c",
|
||||
"source/ARM-VFPv2/s_commonNaNToExtF80M.c",
|
||||
"source/ARM-VFPv2/s_propagateNaNExtF80M.c",
|
||||
"source/ARM-VFPv2/f128M_isSignalingNaN.c",
|
||||
"source/ARM-VFPv2/s_f128MToCommonNaN.c",
|
||||
"source/ARM-VFPv2/s_commonNaNToF128M.c",
|
||||
"source/ARM-VFPv2/s_propagateNaNF128M.c",
|
||||
# See `OBJS_OTHERS` in `build/Linux-ARM-VFPv2-GCC/Makefile` in the
|
||||
# `softfloat` repo.
|
||||
"source/s_roundToUI32.c",
|
||||
"source/s_roundMToUI64.c",
|
||||
"source/s_roundToI32.c",
|
||||
"source/s_roundMToI64.c",
|
||||
"source/s_normSubnormalF16Sig.c",
|
||||
"source/s_roundPackToF16.c",
|
||||
"source/s_normRoundPackToF16.c",
|
||||
"source/s_addMagsF16.c",
|
||||
"source/s_subMagsF16.c",
|
||||
"source/s_mulAddF16.c",
|
||||
"source/s_normSubnormalF32Sig.c",
|
||||
"source/s_roundPackToF32.c",
|
||||
"source/s_normRoundPackToF32.c",
|
||||
"source/s_addMagsF32.c",
|
||||
"source/s_subMagsF32.c",
|
||||
"source/s_mulAddF32.c",
|
||||
"source/s_normSubnormalF64Sig.c",
|
||||
"source/s_roundPackToF64.c",
|
||||
"source/s_normRoundPackToF64.c",
|
||||
"source/s_addMagsF64.c",
|
||||
"source/s_subMagsF64.c",
|
||||
"source/s_mulAddF64.c",
|
||||
"source/s_tryPropagateNaNExtF80M.c",
|
||||
"source/s_invalidExtF80M.c",
|
||||
"source/s_normExtF80SigM.c",
|
||||
"source/s_roundPackMToExtF80M.c",
|
||||
"source/s_normRoundPackMToExtF80M.c",
|
||||
"source/s_addExtF80M.c",
|
||||
"source/s_compareNonnormExtF80M.c",
|
||||
"source/s_isNaNF128M.c",
|
||||
"source/s_tryPropagateNaNF128M.c",
|
||||
"source/s_invalidF128M.c",
|
||||
"source/s_shiftNormSigF128M.c",
|
||||
"source/s_roundPackMToF128M.c",
|
||||
"source/s_normRoundPackMToF128M.c",
|
||||
"source/s_addF128M.c",
|
||||
"source/s_mulAddF128M.c",
|
||||
"source/softfloat_state.c",
|
||||
"source/ui32_to_f16.c",
|
||||
"source/ui32_to_f32.c",
|
||||
"source/ui32_to_f64.c",
|
||||
"source/ui32_to_extF80M.c",
|
||||
"source/ui32_to_f128M.c",
|
||||
"source/ui64_to_f16.c",
|
||||
"source/ui64_to_f32.c",
|
||||
"source/ui64_to_f64.c",
|
||||
"source/ui64_to_extF80M.c",
|
||||
"source/ui64_to_f128M.c",
|
||||
"source/i32_to_f16.c",
|
||||
"source/i32_to_f32.c",
|
||||
"source/i32_to_f64.c",
|
||||
"source/i32_to_extF80M.c",
|
||||
"source/i32_to_f128M.c",
|
||||
"source/i64_to_f16.c",
|
||||
"source/i64_to_f32.c",
|
||||
"source/i64_to_f64.c",
|
||||
"source/i64_to_extF80M.c",
|
||||
"source/i64_to_f128M.c",
|
||||
"source/f16_to_ui32.c",
|
||||
"source/f16_to_ui64.c",
|
||||
"source/f16_to_i32.c",
|
||||
"source/f16_to_i64.c",
|
||||
"source/f16_to_ui32_r_minMag.c",
|
||||
"source/f16_to_ui64_r_minMag.c",
|
||||
"source/f16_to_i32_r_minMag.c",
|
||||
"source/f16_to_i64_r_minMag.c",
|
||||
"source/f16_to_f32.c",
|
||||
"source/f16_to_f64.c",
|
||||
"source/f16_to_extF80M.c",
|
||||
"source/f16_to_f128M.c",
|
||||
"source/f16_roundToInt.c",
|
||||
"source/f16_add.c",
|
||||
"source/f16_sub.c",
|
||||
"source/f16_mul.c",
|
||||
"source/f16_mulAdd.c",
|
||||
"source/f16_div.c",
|
||||
"source/f16_rem.c",
|
||||
"source/f16_sqrt.c",
|
||||
"source/f16_eq.c",
|
||||
"source/f16_le.c",
|
||||
"source/f16_lt.c",
|
||||
"source/f16_eq_signaling.c",
|
||||
"source/f16_le_quiet.c",
|
||||
"source/f16_lt_quiet.c",
|
||||
"source/f16_isSignalingNaN.c",
|
||||
"source/f32_to_ui32.c",
|
||||
"source/f32_to_ui64.c",
|
||||
"source/f32_to_i32.c",
|
||||
"source/f32_to_i64.c",
|
||||
"source/f32_to_ui32_r_minMag.c",
|
||||
"source/f32_to_ui64_r_minMag.c",
|
||||
"source/f32_to_i32_r_minMag.c",
|
||||
"source/f32_to_i64_r_minMag.c",
|
||||
"source/f32_to_f16.c",
|
||||
"source/f32_to_f64.c",
|
||||
"source/f32_to_extF80M.c",
|
||||
"source/f32_to_f128M.c",
|
||||
"source/f32_roundToInt.c",
|
||||
"source/f32_add.c",
|
||||
"source/f32_sub.c",
|
||||
"source/f32_mul.c",
|
||||
"source/f32_mulAdd.c",
|
||||
"source/f32_div.c",
|
||||
"source/f32_rem.c",
|
||||
"source/f32_sqrt.c",
|
||||
"source/f32_eq.c",
|
||||
"source/f32_le.c",
|
||||
"source/f32_lt.c",
|
||||
"source/f32_eq_signaling.c",
|
||||
"source/f32_le_quiet.c",
|
||||
"source/f32_lt_quiet.c",
|
||||
"source/f32_isSignalingNaN.c",
|
||||
"source/f64_to_ui32.c",
|
||||
"source/f64_to_ui64.c",
|
||||
"source/f64_to_i32.c",
|
||||
"source/f64_to_i64.c",
|
||||
"source/f64_to_ui32_r_minMag.c",
|
||||
"source/f64_to_ui64_r_minMag.c",
|
||||
"source/f64_to_i32_r_minMag.c",
|
||||
"source/f64_to_i64_r_minMag.c",
|
||||
"source/f64_to_f16.c",
|
||||
"source/f64_to_f32.c",
|
||||
"source/f64_to_extF80M.c",
|
||||
"source/f64_to_f128M.c",
|
||||
"source/f64_roundToInt.c",
|
||||
"source/f64_add.c",
|
||||
"source/f64_sub.c",
|
||||
"source/f64_mul.c",
|
||||
"source/f64_mulAdd.c",
|
||||
"source/f64_div.c",
|
||||
"source/f64_rem.c",
|
||||
"source/f64_sqrt.c",
|
||||
"source/f64_eq.c",
|
||||
"source/f64_le.c",
|
||||
"source/f64_lt.c",
|
||||
"source/f64_eq_signaling.c",
|
||||
"source/f64_le_quiet.c",
|
||||
"source/f64_lt_quiet.c",
|
||||
"source/f64_isSignalingNaN.c",
|
||||
"source/extF80M_to_ui32.c",
|
||||
"source/extF80M_to_ui64.c",
|
||||
"source/extF80M_to_i32.c",
|
||||
"source/extF80M_to_i64.c",
|
||||
"source/extF80M_to_ui32_r_minMag.c",
|
||||
"source/extF80M_to_ui64_r_minMag.c",
|
||||
"source/extF80M_to_i32_r_minMag.c",
|
||||
"source/extF80M_to_i64_r_minMag.c",
|
||||
"source/extF80M_to_f16.c",
|
||||
"source/extF80M_to_f32.c",
|
||||
"source/extF80M_to_f64.c",
|
||||
"source/extF80M_to_f128M.c",
|
||||
"source/extF80M_roundToInt.c",
|
||||
"source/extF80M_add.c",
|
||||
"source/extF80M_sub.c",
|
||||
"source/extF80M_mul.c",
|
||||
"source/extF80M_div.c",
|
||||
"source/extF80M_rem.c",
|
||||
"source/extF80M_sqrt.c",
|
||||
"source/extF80M_eq.c",
|
||||
"source/extF80M_le.c",
|
||||
"source/extF80M_lt.c",
|
||||
"source/extF80M_eq_signaling.c",
|
||||
"source/extF80M_le_quiet.c",
|
||||
"source/extF80M_lt_quiet.c",
|
||||
"source/f128M_to_ui32.c",
|
||||
"source/f128M_to_ui64.c",
|
||||
"source/f128M_to_i32.c",
|
||||
"source/f128M_to_i64.c",
|
||||
"source/f128M_to_ui32_r_minMag.c",
|
||||
"source/f128M_to_ui64_r_minMag.c",
|
||||
"source/f128M_to_i32_r_minMag.c",
|
||||
"source/f128M_to_i64_r_minMag.c",
|
||||
"source/f128M_to_f16.c",
|
||||
"source/f128M_to_f32.c",
|
||||
"source/f128M_to_f64.c",
|
||||
"source/f128M_to_extF80M.c",
|
||||
"source/f128M_roundToInt.c",
|
||||
"source/f128M_add.c",
|
||||
"source/f128M_sub.c",
|
||||
"source/f128M_mul.c",
|
||||
"source/f128M_mulAdd.c",
|
||||
"source/f128M_div.c",
|
||||
"source/f128M_rem.c",
|
||||
"source/f128M_sqrt.c",
|
||||
"source/f128M_eq.c",
|
||||
"source/f128M_le.c",
|
||||
"source/f128M_lt.c",
|
||||
"source/f128M_eq_signaling.c",
|
||||
"source/f128M_le_quiet.c",
|
||||
"source/f128M_lt_quiet.c",
|
||||
# See `$(OBJS_ALL)` target in `build/Linux-ARM-VFPv2-GCC/Makefile` in the
|
||||
# `softfloat` repo.
|
||||
"build/Linux-ARM-VFPv2-GCC/platform.h",
|
||||
"source/include/primitiveTypes.h",
|
||||
"source/include/primitives.h",
|
||||
# See `$(OBJS_SPECIALIZE) $(OBJS_OTHERS)` target in
|
||||
# `build/Linux-ARM-VFPv2-GCC/Makefile` in the `softfloat` repo.
|
||||
"source/include/softfloat_types.h",
|
||||
"source/include/internals.h",
|
||||
"source/ARM-VFPv2/specialize.h",
|
||||
# `platform.h` includes `opts-GCC.h`.
|
||||
"source/include/opts-GCC.h",
|
||||
],
|
||||
hdrs = ["source/include/softfloat.h"],
|
||||
copts = [
|
||||
"-Iexternal/softfloat/build/Linux-ARM-VFPv2-GCC",
|
||||
"-Iexternal/softfloat/source/ARM-VFPv2",
|
||||
"-Werror-implicit-function-declaration",
|
||||
"-O2",
|
||||
],
|
||||
includes = ["source/include"],
|
||||
local_defines = [
|
||||
"SOFTFLOAT_ROUND_ODD",
|
||||
"INLINE_LEVEL=5",
|
||||
],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "softfloat_linux_x86_64",
|
||||
srcs = [
|
||||
@ -358,6 +632,7 @@ cc_library(
|
||||
name = "softfloat",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = select({
|
||||
"@//:linux-x86_64": [":softfloat_linux_x86_64"],
|
||||
"@//:linux_arm64": [":softfloat_linux_arm64"],
|
||||
"@//:linux_x86_64": [":softfloat_linux_x86_64"],
|
||||
}),
|
||||
)
|
||||
|
0
bazel/third_party/sse2neon/BUILD.bazel
vendored
Normal file
0
bazel/third_party/sse2neon/BUILD.bazel
vendored
Normal file
6
bazel/third_party/sse2neon/sse2neon.BUILD
vendored
Normal file
6
bazel/third_party/sse2neon/sse2neon.BUILD
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
cc_library(
|
||||
name = "sse2neon",
|
||||
hdrs = ["sse2neon.h"],
|
||||
linkstatic = True,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
6
bazel/third_party/uv/uv.BUILD
vendored
6
bazel/third_party/uv/uv.BUILD
vendored
@ -13,7 +13,11 @@ configure_make(
|
||||
configure_in_place = True,
|
||||
configure_options = [
|
||||
"--disable-shared",
|
||||
],
|
||||
] + select({
|
||||
# Native compilation on linux-arm64 isn't supported.
|
||||
"@//:linux_arm64": ["--host=aarch64-linux-gnu"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
lib_source = ":all",
|
||||
out_static_libs = ["libuv.a"],
|
||||
targets = ["install"],
|
||||
|
@ -1,3 +1,30 @@
|
||||
# ADDING A NEW TOOLCHAIN
|
||||
#
|
||||
# The general process for adding a new toolchain is as follows:
|
||||
#
|
||||
# (1) Define a `cc_toolchaing_config()` rule target with a `name` attribute of
|
||||
# the form `<compiler>-<os>-<cpu>-config` and a `toolchain_identifier` of
|
||||
# the form `toolchain-<compiler>-<os>-<cpu>`. The `cc_toolchain_config()`
|
||||
# definition in `//bazel/toolchain:cfg.bzl` lists the mandatory attributes
|
||||
# for the `cc_toolchain_config()` rule. If any of the toolchain's include
|
||||
# paths require a compiler version number, simply replace the version number
|
||||
# with `{compiler_version}`, which is replaced with the value of the label
|
||||
# indicated by the `compiler_version` attribute when the rule is resolved.
|
||||
# (2) Define a `cc_toolchain()` rule target with a `name` attribute of the form
|
||||
# `<compiler>-<os>-<cpu>` and a `toolchain_config` attribute that references
|
||||
# the `cc_toolchain_config()` target from (1).
|
||||
# (3) Define a `toolchain()` rule target with a `name` attribute of the form
|
||||
# `<compiler>-<os>-<cpu>-toolchain` and specify the platform the toolchain
|
||||
# runs on via the `exec_compatible_with` attribute and the platform the
|
||||
# toolchain targets (i.e. compiles for) via the `target_compatible_with`
|
||||
# attribute. Use the `cc_toolchain()` target from (2) as the value of the
|
||||
# `toolchain` attribute and `:toolchain_type` for the `toolchain_type`
|
||||
# attribute.
|
||||
# (4) Register the new toolchain in `//:WORKSPACE.bazel` by adding the
|
||||
# toolchain's label (i.e.
|
||||
# `//bazel/toolchain:<compiler>-<os>-<cpu>-toolchain`) to the
|
||||
# `register_toolchains()` function.
|
||||
#
|
||||
# For more information on configuring toolchains, see
|
||||
# https://bazel.build/tutorials/ccp-toolchain-config
|
||||
# and https://bazel.build/extending/toolchains.
|
||||
@ -11,6 +38,56 @@ alias(
|
||||
actual = "@bazel_tools//tools/cpp:toolchain_type",
|
||||
)
|
||||
|
||||
#
|
||||
# aarch64_linux_gnu_gcc-linux-x86_64
|
||||
#
|
||||
|
||||
# Toolchain identifier.
|
||||
_aarch64_linux_gnu_gcc = "toolchain-aarch64_linux_gnu_gcc-linux-x86_64"
|
||||
|
||||
cc_toolchain_config(
|
||||
name = "aarch64_linux_gnu_gcc-linux-x86_64-config",
|
||||
ar = "/usr/bin/aarch64-linux-gnu-ar",
|
||||
cc = "/usr/bin/aarch64-linux-gnu-gcc",
|
||||
compiler = "aarch64-linux-gnu-gcc",
|
||||
compiler_version = "//:aarch64_linux_gnu_gcc_version",
|
||||
ld = "/usr/bin/aarch64-linux-gnu-ld",
|
||||
sys_includes = [
|
||||
"/usr/aarch64-linux-gnu/include",
|
||||
"/usr/lib/gcc/aarch64-linux-gnu/{compiler_version}/include",
|
||||
"/usr/lib/gcc/aarch64-linux-gnu/{compiler_version}/include-fixed",
|
||||
],
|
||||
target_cpu = "arm64",
|
||||
toolchain_identifier = _aarch64_linux_gnu_gcc,
|
||||
)
|
||||
|
||||
cc_toolchain(
|
||||
name = "aarch64_linux_gnu_gcc-linux-x86_64",
|
||||
all_files = ":empty",
|
||||
compiler_files = ":empty",
|
||||
dwp_files = ":empty",
|
||||
linker_files = ":empty",
|
||||
objcopy_files = ":empty",
|
||||
strip_files = ":empty",
|
||||
supports_param_files = 0,
|
||||
toolchain_config = ":aarch64_linux_gnu_gcc-linux-x86_64-config",
|
||||
toolchain_identifier = _aarch64_linux_gnu_gcc,
|
||||
)
|
||||
|
||||
toolchain(
|
||||
name = "aarch64_linux_gnu_gcc-linux-x86_64-toolchain",
|
||||
exec_compatible_with = [
|
||||
"@platforms//os:linux",
|
||||
"@platforms//cpu:x86_64",
|
||||
],
|
||||
target_compatible_with = [
|
||||
"@platforms//os:linux",
|
||||
"@platforms//cpu:arm64",
|
||||
],
|
||||
toolchain = ":aarch64_linux_gnu_gcc-linux-x86_64",
|
||||
toolchain_type = ":toolchain_type",
|
||||
)
|
||||
|
||||
#
|
||||
# clang-linux-x86_64
|
||||
#
|
||||
@ -23,9 +100,10 @@ cc_toolchain_config(
|
||||
ar = "/usr/bin/ar",
|
||||
cc = "/usr/bin/clang",
|
||||
compiler = "clang",
|
||||
compiler_version = "//:clang_version",
|
||||
ld = "/usr/bin/ld",
|
||||
sys_includes = [
|
||||
"/usr/lib/clang/14.0.6",
|
||||
"/usr/lib/clang/{compiler_version}",
|
||||
"/usr/include",
|
||||
],
|
||||
target_cpu = "x86_64",
|
||||
@ -48,7 +126,6 @@ cc_toolchain(
|
||||
toolchain(
|
||||
name = "clang-linux-x86_64-toolchain",
|
||||
exec_compatible_with = [
|
||||
"//:clang",
|
||||
"@platforms//os:linux",
|
||||
"@platforms//cpu:x86_64",
|
||||
],
|
||||
@ -72,11 +149,11 @@ cc_toolchain_config(
|
||||
ar = "/usr/bin/ar",
|
||||
cc = "/usr/bin/gcc",
|
||||
compiler = "gcc",
|
||||
compiler_version = "//:gcc_version",
|
||||
ld = "/usr/bin/ld",
|
||||
sys_includes = [
|
||||
# TODO: remove hard-coded version number.
|
||||
"/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/include",
|
||||
"/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/include-fixed",
|
||||
"/usr/lib/gcc/x86_64-pc-linux-gnu/{compiler_version}/include",
|
||||
"/usr/lib/gcc/x86_64-pc-linux-gnu/{compiler_version}/include-fixed",
|
||||
"/usr/include",
|
||||
],
|
||||
target_cpu = "x86_64",
|
||||
|
@ -1,3 +1,4 @@
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
|
||||
load("@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl", "tool_path")
|
||||
|
||||
def _cc_toolchain_config_impl(ctx):
|
||||
@ -7,7 +8,12 @@ def _cc_toolchain_config_impl(ctx):
|
||||
ctx = ctx,
|
||||
# See https://bazel.build/docs/cc-toolchain-config-reference#features.
|
||||
features = [],
|
||||
cxx_builtin_include_directories = ctx.attr.sys_includes,
|
||||
# Replace `{compiler_version}` in all include paths with the value of
|
||||
# the `compiler_version` label.
|
||||
cxx_builtin_include_directories = [
|
||||
path.format(compiler_version = ctx.attr.compiler_version[BuildSettingInfo].value)
|
||||
for path in ctx.attr.sys_includes
|
||||
],
|
||||
toolchain_identifier = ctx.attr.toolchain_identifier,
|
||||
target_system_name = ctx.attr.target_system_name,
|
||||
target_cpu = ctx.attr.target_cpu,
|
||||
@ -58,6 +64,7 @@ cc_toolchain_config = rule(
|
||||
"ar": attr.string(mandatory = True),
|
||||
"cc": attr.string(mandatory = True),
|
||||
"compiler": attr.string(mandatory = True),
|
||||
"compiler_version": attr.label(mandatory = True),
|
||||
"ld": attr.string(mandatory = True),
|
||||
"target_cpu": attr.string(mandatory = True),
|
||||
"toolchain_identifier": attr.string(mandatory = True),
|
||||
|
@ -180,14 +180,6 @@
|
||||
# endif
|
||||
|
||||
|
||||
/** External, OS-independent library dependencies.
|
||||
**/
|
||||
/* The GMP (GNU arbitrary-precision arithmetic) library.
|
||||
** (Tested with version 4.0.1.)
|
||||
*/
|
||||
# include <gmp.h>
|
||||
|
||||
|
||||
/** Private C "extensions."
|
||||
***
|
||||
*** Except for these and main(), any function, macro, or structure
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "allocate.h"
|
||||
#include "c3.h"
|
||||
#include "gmp.h"
|
||||
#include "types.h"
|
||||
|
||||
/** Structures.
|
||||
|
@ -4,6 +4,7 @@
|
||||
#define U3_RETRIEVE_H
|
||||
|
||||
#include "c3.h"
|
||||
#include "gmp.h"
|
||||
#include "types.h"
|
||||
|
||||
/** u3r_*: read without ever crashing.
|
||||
|
Loading…
Reference in New Issue
Block a user