Skip to content

Commit a0115cd

Browse files
committed
[bazel] Switch lowRISC toolchain from CRT to local version
This removes the dependency on CRT and registers the new rules-based toolchain instead. Since `guards` is now enabled by default and `pedantic` is now disabled by default, we can remove those configurations from `.bazelrc`. The configuration to disable `guards` is still present. Without CRT, we also don't need to manually load the following repos into the airgapped environment: * `@python3_toolchains` * `@ninja_1.11.0_linux` * `@cmake-3.23.2-linux-x86_64` Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
1 parent b3ab518 commit a0115cd

File tree

5 files changed

+3
-25
lines changed

5 files changed

+3
-25
lines changed

.bazelrc

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,6 @@ build --conlyopt='-std=gnu11'
1414
# disassemblies when compilation mode is fastbuild.
1515
build --strip='never'
1616

17-
# Override default enablement of flags from @crt//common to control C compiler
18-
# warnings.
19-
build --features=-pedantic_warnings
20-
build --host_features=-pedantic_warnings
21-
22-
# Enable toolchain hardening features.
23-
# `guards` adds `unimp` guard instructions after unconditional jumps.
24-
build --features=guards
25-
build --host_features=guards
26-
2717
# Use --config=disable_hardening to disable hardening to measure the
2818
# impact of the hardened sequences on code size.
2919
build:disable_hardening --features=-guards --copt=-DOT_DISABLE_HARDENING=1

MODULE.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,5 @@ use_repo(
143143
)
144144

145145
register_toolchains("//rules/opentitan:localtools")
146+
147+
register_toolchains("//third_party/lowrisc:cc_toolchain_opentitan")

WORKSPACE.bzlmod

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,3 @@
66
# //third_party/README.md first.
77

88
workspace(name = "lowrisc_opentitan")
9-
10-
# CRT is the Compiler Repository Toolkit. It contains the configuration for
11-
# the windows compiler.
12-
load("//third_party/crt:repos.bzl", "crt_repos")
13-
crt_repos()
14-
load("@crt//:repos.bzl", "crt_repos")
15-
crt_repos()
16-
load("@crt//:deps.bzl", "crt_deps")
17-
crt_deps()
18-
load("@crt//config:registration.bzl", "crt_register_toolchains")
19-
crt_register_toolchains(riscv32 = True)

rules/rv.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"""Helpers for transitioning to the RISC-V target."""
66

77
OPENTITAN_CPU = "@platforms//cpu:riscv32"
8-
OPENTITAN_PLATFORM = "@crt//platforms/riscv32:opentitan"
8+
OPENTITAN_PLATFORM = "//third_party/lowrisc:opentitan_platform"
99

1010
# This constant holds a dictionary of per-device dependencies which are used to
1111
# generate slightly different binaries for each hardware target, including two

util/prep-bazel-airgapped-build.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,8 @@ if [[ ${AIRGAPPED_DIR_CONTENTS} == "ALL" || \
143143
//... \
144144
@lowrisc_toolchain//... \
145145
@local_config_platform//... \
146-
@python3_toolchains//... \
147146
@riscv-compliance//... \
148147
@rules_foreign_cc//toolchains/... \
149-
@ninja_1.11.0_linux//... \
150-
@cmake-3.23.2-linux-x86_64//... \
151148
# We don't need all bitstreams in the cache, we just need the latest one so
152149
# that the cache is "initialized" and "offline" mode will work correctly.
153150
mkdir -p ${BAZEL_AIRGAPPED_DIR}/${BAZEL_BITSTREAMS_CACHEDIR}

0 commit comments

Comments
 (0)