fix: aarch64_be issues wthin compilation

This commit is contained in:
Madhav Madhusoodanan 2025-05-04 23:15:35 +05:30 committed by Amanieu d'Antras
parent 9b4768921f
commit c01c6ceb87
3 changed files with 11 additions and 8 deletions

View file

@ -185,7 +185,7 @@ fn compile_c_arm(
* does not work as it gets caught up with `#include_next <stdlib.h>`
* not existing...
*/
if target == "aarch64_be-unknown-linux-gnu" {
if target.contains("aarch64_be") {
command = command
.set_linker(
cxx_toolchain_dir.unwrap_or("").to_string() + "/bin/aarch64_be-none-linux-gnu-g++",

View file

@ -85,7 +85,6 @@ impl CompilationCommandBuilder {
pub fn set_linker(mut self, linker: String) -> Self {
self.linker = Some(linker);
self.output += ".o";
self
}
@ -106,12 +105,16 @@ impl CompilationCommandBuilder {
let flags = std::env::var("CPPFLAGS").unwrap_or("".into());
let project_root = self.project_root.unwrap_or(String::new());
let project_root_str = project_root.as_str();
let mut output = self.output.clone();
if self.linker.is_some() {
output += ".o"
};
let mut command = format!(
"{} {flags} -march={arch_flags} \
-O{} \
-o {project_root}/{} \
{project_root}/{}.cpp",
self.compiler, self.optimization, self.output, self.input,
self.compiler, self.optimization, output, self.input,
);
command = command + " " + self.extra_flags.join(" ").as_str();
@ -133,19 +136,19 @@ impl CompilationCommandBuilder {
+ include_args.as_str()
+ " && "
+ linker
+ " "
+ project_root_str
+ "/"
+ self.output.as_str()
+ &output
+ " -o "
+ project_root_str
+ "/"
+ self.output.strip_suffix(".o").unwrap()
+ &self.output
+ " && rm "
+ project_root_str
+ "/"
+ self.output.as_str();
+ &output;
}
command
}
}

View file

@ -356,7 +356,7 @@ pub trait IntrinsicTypeDefinition: BaseIntrinsicTypeDefinition {
#[macro_export]
macro_rules! base_intrinsictype_trait_def_macro {
($T:ident) => {
use crate::common::intrinsic_types::IntrinsicType;
use crate::common::intrinsic_helpers::IntrinsicType;
#[derive(Debug, Clone, PartialEq)]
pub struct $T(pub IntrinsicType);