Skip to content

Commit 5ac0c71

Browse files
fix: aarch64_be issues wthin compilation
1 parent 030ce32 commit 5ac0c71

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

crates/intrinsic-test/src/arm/functions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ fn compile_c_arm(
185185
* does not work as it gets caught up with `#include_next <stdlib.h>`
186186
* not existing...
187187
*/
188-
if target == "aarch64_be-unknown-linux-gnu" {
188+
if target.contains("aarch64_be") {
189189
command = command
190190
.set_linker(
191191
cxx_toolchain_dir.unwrap_or("").to_string() + "/bin/aarch64_be-none-linux-gnu-g++",

crates/intrinsic-test/src/common/compile_c.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ impl CompilationCommandBuilder {
8585

8686
pub fn set_linker(mut self, linker: String) -> Self {
8787
self.linker = Some(linker);
88-
self.output += ".o";
8988
self
9089
}
9190

@@ -106,12 +105,16 @@ impl CompilationCommandBuilder {
106105
let flags = std::env::var("CPPFLAGS").unwrap_or("".into());
107106
let project_root = self.project_root.unwrap_or(String::new());
108107
let project_root_str = project_root.as_str();
108+
let mut output = self.output.clone();
109+
if self.linker.is_some() {
110+
output += ".o"
111+
};
109112
let mut command = format!(
110113
"{} {flags} -march={arch_flags} \
111114
-O{} \
112115
-o {project_root}/{} \
113116
{project_root}/{}.cpp",
114-
self.compiler, self.optimization, self.output, self.input,
117+
self.compiler, self.optimization, output, self.input,
115118
);
116119

117120
command = command + " " + self.extra_flags.join(" ").as_str();
@@ -133,19 +136,19 @@ impl CompilationCommandBuilder {
133136
+ include_args.as_str()
134137
+ " && "
135138
+ linker
139+
+ " "
136140
+ project_root_str
137141
+ "/"
138-
+ self.output.as_str()
142+
+ &output
139143
+ " -o "
140144
+ project_root_str
141145
+ "/"
142-
+ self.output.strip_suffix(".o").unwrap()
146+
+ &self.output
143147
+ " && rm "
144148
+ project_root_str
145149
+ "/"
146-
+ self.output.as_str();
150+
+ &output;
147151
}
148-
149152
command
150153
}
151154
}

crates/intrinsic-test/src/common/intrinsic_helpers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ pub trait IntrinsicTypeDefinition: BaseIntrinsicTypeDefinition {
356356
#[macro_export]
357357
macro_rules! base_intrinsictype_trait_def_macro {
358358
($T:ident) => {
359-
use crate::common::intrinsic_types::IntrinsicType;
359+
use crate::common::intrinsic_helpers::IntrinsicType;
360360

361361
#[derive(Debug, Clone, PartialEq)]
362362
pub struct $T(pub IntrinsicType);

0 commit comments

Comments
 (0)