Skip to content

Commit

Permalink
Pass compiler/linker flags to CMake for -native-hybrid (#386)
Browse files Browse the repository at this point in the history
morello-llvm-native on CheriBSD/Morello requires -mabi=aapcs in CFLAGS.
Otherwise, it would be compiled with -mabi=purecap that cc uses by
default on CheriBSD with purecap world.
  • Loading branch information
kwitaszczyk authored Feb 19, 2024
1 parent f58f117 commit 38a0bc6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pycheribuild/config/target_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,9 @@ def is_native(self) -> bool:
assert self.target_info_cls is not None
return self.target_info_cls.is_native()

def is_native_hybrid(self) -> bool:
return self.is_native() and self._is_cheri_hybrid

def _check_arch(self, arch: CPUArchitecture, include_purecap: "Optional[bool]") -> bool:
if self.cpu_architecture is not arch:
return False
Expand Down
2 changes: 1 addition & 1 deletion pycheribuild/projects/cmake_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def setup_late(self):
CMAKE_CXX_COMPILER=self.CXX,
CMAKE_ASM_COMPILER=self.CC, # Compile assembly files with the default compiler
)
if not self.compiling_for_host():
if not self.compiling_for_host() or self.compiling_for_host_hybrid():
# Add compiler/linker flags (for cross-compilation these are defined in the toolchain file).
# Note: All of these should be commandlines not CMake lists.
self.add_cmake_options(
Expand Down
3 changes: 3 additions & 0 deletions pycheribuild/projects/simple_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,9 @@ def compiling_for_cheri_hybrid(self, valid_cpu_archs: "Optional[list[CPUArchitec
def compiling_for_host(self) -> bool:
return self.crosscompile_target.is_native()

def compiling_for_host_hybrid(self) -> bool:
return self.crosscompile_target.is_native_hybrid()

def compiling_for_riscv(self, include_purecap: bool) -> bool:
return self.crosscompile_target.is_riscv(include_purecap=include_purecap)

Expand Down

0 comments on commit 38a0bc6

Please sign in to comment.