Skip to content

Commit

Permalink
[CHERI CSA] Enable CSA for BuildCheriBSD project
Browse files Browse the repository at this point in the history
  • Loading branch information
eupharina committed Jun 24, 2024
1 parent c714664 commit e73c43c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
17 changes: 15 additions & 2 deletions pycheribuild/projects/cross/cheribsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,8 +1005,8 @@ def _setup_cross_toolchain_config(self) -> None:
if not xccinfo.is_clang:
self.ask_for_confirmation("Cross compiler is not clang, are you sure you want to continue?")
self.cross_toolchain_config.set_env(
XCC=self.CC,
XCXX=self.CXX,
XCC=self.cc_wrapper,
XCXX=self.cxx_wrapper,
XCPP=self.CPP,
X_COMPILER_TYPE=xccinfo.compiler, # This is needed otherwise the build assumes it should build with $CC
)
Expand Down Expand Up @@ -1196,9 +1196,14 @@ def _buildkernel(
# Don't build a compiler if we are using and external toolchain (only build config, etc)
if not self.use_bootstrapped_toolchain:
kernel_toolchain_opts.set_with_options(LLD_BOOTSTRAP=False, CLANG=False, CLANG_BOOTSTRAP=False)
kernel_toolchain_opts.exclude_from_csa = True
self.run_make("kernel-toolchain", options=kernel_toolchain_opts)
self.kernel_toolchain_exists = True
self.info("Building kernels for configs:", " ".join(kernconfs))

if self.use_csa:
kernel_make_args.set(BUILD_WITH_STRICT_TMPPATH=False) # Look for perl in PATH

self.run_make(
"buildkernel",
options=kernel_make_args,
Expand Down Expand Up @@ -1523,6 +1528,10 @@ def add_cross_build_options(self) -> None:
# links from /usr/bin/mail to /usr/bin/Mail won't work on case-insensitve fs
self.make_args.set_with_options(MAIL=False)

if self.use_csa:
ccinfo = self.get_compiler_info(self.host_CC)
self.make_args.set_env(COMPILER_TYPE=ccinfo.compiler)

def libcompat_name(self) -> str:
if self.crosscompile_target.is_cheri_purecap():
return "lib64"
Expand Down Expand Up @@ -1917,6 +1926,10 @@ def setup_config_options(cls, kernel_only_target=False, install_directory_help=N
"build the libraries and skip all binaries",
)

@classmethod
def can_build_with_csa(cls) -> bool:
return True

def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.extra_kernels_with_mfs: "list[str]" = []
Expand Down
1 change: 1 addition & 0 deletions tests/test_argument_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,7 @@ def test_mfs_root_kernel_config_options():
"mfs_root_image",
"skip_update",
"use_ccache",
"use_csa",
"use_lto",
"with_clean",
"with_debug_files",
Expand Down

0 comments on commit e73c43c

Please sign in to comment.