Skip to content

Commit 7202c89

Browse files
committed
[CHERI CSA] Enable CSA for BuildCheriBSD project
1 parent cee93a0 commit 7202c89

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

pycheribuild/projects/cross/cheribsd.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,8 +1005,8 @@ def _setup_cross_toolchain_config(self) -> None:
10051005
if not xccinfo.is_clang:
10061006
self.ask_for_confirmation("Cross compiler is not clang, are you sure you want to continue?")
10071007
self.cross_toolchain_config.set_env(
1008-
XCC=self.CC,
1009-
XCXX=self.CXX,
1008+
XCC=self.cc_wrapper,
1009+
XCXX=self.cxx_wrapper,
10101010
XCPP=self.CPP,
10111011
X_COMPILER_TYPE=xccinfo.compiler, # This is needed otherwise the build assumes it should build with $CC
10121012
)
@@ -1196,9 +1196,14 @@ def _buildkernel(
11961196
# Don't build a compiler if we are using and external toolchain (only build config, etc)
11971197
if not self.use_bootstrapped_toolchain:
11981198
kernel_toolchain_opts.set_with_options(LLD_BOOTSTRAP=False, CLANG=False, CLANG_BOOTSTRAP=False)
1199+
kernel_toolchain_opts.exclude_from_csa = True
11991200
self.run_make("kernel-toolchain", options=kernel_toolchain_opts)
12001201
self.kernel_toolchain_exists = True
12011202
self.info("Building kernels for configs:", " ".join(kernconfs))
1203+
1204+
if self.use_csa:
1205+
kernel_make_args.set(BUILD_WITH_STRICT_TMPPATH=False) # Look for perl in PATH
1206+
12021207
self.run_make(
12031208
"buildkernel",
12041209
options=kernel_make_args,
@@ -1523,6 +1528,10 @@ def add_cross_build_options(self) -> None:
15231528
# links from /usr/bin/mail to /usr/bin/Mail won't work on case-insensitve fs
15241529
self.make_args.set_with_options(MAIL=False)
15251530

1531+
if self.use_csa:
1532+
ccinfo = self.get_compiler_info(self.host_CC)
1533+
self.make_args.set_env(COMPILER_TYPE=ccinfo.compiler)
1534+
15261535
def libcompat_name(self) -> str:
15271536
if self.crosscompile_target.is_cheri_purecap():
15281537
return "lib64"
@@ -1917,6 +1926,10 @@ def setup_config_options(cls, kernel_only_target=False, install_directory_help=N
19171926
"build the libraries and skip all binaries",
19181927
)
19191928

1929+
@classmethod
1930+
def can_build_with_csa(cls) -> bool:
1931+
return True
1932+
19201933
def __init__(self, *args, **kwargs) -> None:
19211934
super().__init__(*args, **kwargs)
19221935
self.extra_kernels_with_mfs: "list[str]" = []

tests/test_argument_parsing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,7 @@ def test_mfs_root_kernel_config_options():
12801280
"mfs_root_image",
12811281
"skip_update",
12821282
"use_ccache",
1283+
"use_csa",
12831284
"use_lto",
12841285
"with_clean",
12851286
"with_debug_files",

0 commit comments

Comments
 (0)