Skip to content

Commit 3fc9afb

Browse files
committed
qemu: default to enabling riscv{32,64}xcheri targets if they exist
See CTSRD-CHERI/qemu#272
1 parent 2bfa20c commit 3fc9afb

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

pycheribuild/projects/build_qemu.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2828
# SUCH DAMAGE.
2929
#
30+
import inspect
3031
import os
3132
import re
3233
import shutil
@@ -51,6 +52,7 @@
5152
)
5253
from .simple_project import BoolConfigOption, SimpleProject, _cached_get_homebrew_prefix
5354
from ..config.compilation_targets import BaremetalFreestandingTargetInfo, CompilationTargets
55+
from ..config.config_loader_base import ConfigOptionHandle
5456
from ..processutils import get_program_version
5557
from ..utils import OSInfo
5658

@@ -298,10 +300,8 @@ def setup(self):
298300
"If you really don't need QEMU host shares you can disable the samba dependency "
299301
"by setting --" + self.target + "/no-use-smbd",
300302
)
301-
302303
self.configure_args.extend(
303304
[
304-
"--target-list=" + self.qemu_targets,
305305
"--disable-xen",
306306
"--disable-docs",
307307
"--disable-rdma",
@@ -338,6 +338,17 @@ def configure(self, **kwargs):
338338
self.configure_args.append("--enable-slirp")
339339
else:
340340
self.configure_args.append("--enable-slirp=git")
341+
342+
chosen_targets = self.qemu_targets
343+
qemu_targets_option = typing.cast(ConfigOptionHandle, inspect.getattr_static(self, "qemu_targets"))
344+
if qemu_targets_option.is_default_value:
345+
if (self.source_dir / "configs/targets/riscv32cheristd-softmmu.mak").exists():
346+
chosen_targets += ",riscv32cheristd-softmmu,riscv64cheristd-softmmu"
347+
# Use the new xcheri targets if available:
348+
if (self.source_dir / "configs/targets/riscv32xcheri-softmmu.mak").exists():
349+
chosen_targets = chosen_targets.replace("riscv32cheri-softmmu", "riscv32xcheri-softmmu")
350+
chosen_targets = chosen_targets.replace("riscv64cheri-softmmu", "riscv64xcheri-softmmu")
351+
self.configure_args.append("--target-list=" + chosen_targets)
341352
super().configure(**kwargs)
342353

343354
def run_tests(self):

0 commit comments

Comments
 (0)