mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
pass the whole config to C compiler construction
This commit is contained in:
@@ -90,9 +90,9 @@ checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.29"
|
||||
version = "1.2.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c1599538de2394445747c8cf7935946e3cc27e9625f889d979bfb2aaf569362"
|
||||
checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7"
|
||||
dependencies = [
|
||||
"shlex",
|
||||
]
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
use crate::common::cli::ProcessedCli;
|
||||
use crate::common::compile_c::CompilationCommandBuilder;
|
||||
use crate::common::gen_c::compile_c_programs;
|
||||
|
||||
pub fn compile_c_arm(
|
||||
intrinsics_name_list: &[String],
|
||||
compiler: &str,
|
||||
target: &str,
|
||||
cxx_toolchain_dir: Option<&str>,
|
||||
) -> bool {
|
||||
pub fn compile_c_arm(config: &ProcessedCli, intrinsics_name_list: &[String]) -> bool {
|
||||
let Some(ref cpp_compiler) = config.cpp_compiler else {
|
||||
return true;
|
||||
};
|
||||
|
||||
// -ffp-contract=off emulates Rust's approach of not fusing separate mul-add operations
|
||||
let mut command = CompilationCommandBuilder::new()
|
||||
.add_arch_flags(vec!["armv8.6-a", "crypto", "crc", "dotprod", "fp16"])
|
||||
.set_compiler(compiler)
|
||||
.set_target(target)
|
||||
.set_compiler(cpp_compiler)
|
||||
.set_target(&config.target)
|
||||
.set_opt_level("2")
|
||||
.set_cxx_toolchain_dir(cxx_toolchain_dir)
|
||||
.set_cxx_toolchain_dir(config.cxx_toolchain_dir.as_deref())
|
||||
.set_project_root("c_programs")
|
||||
.add_extra_flags(vec!["-ffp-contract=off", "-Wno-narrowing"]);
|
||||
|
||||
if !target.contains("v7") {
|
||||
if !config.target.contains("v7") {
|
||||
command = command.add_arch_flags(vec!["faminmax", "lut", "sha3"]);
|
||||
}
|
||||
|
||||
@@ -30,22 +30,33 @@ pub fn compile_c_arm(
|
||||
* does not work as it gets caught up with `#include_next <stdlib.h>`
|
||||
* not existing...
|
||||
*/
|
||||
if target.contains("aarch64_be") {
|
||||
command = command
|
||||
.set_linker(
|
||||
cxx_toolchain_dir.unwrap_or("").to_string() + "/bin/aarch64_be-none-linux-gnu-g++",
|
||||
if config.target.contains("aarch64_be") {
|
||||
let Some(ref cxx_toolchain_dir) = config.cxx_toolchain_dir else {
|
||||
panic!(
|
||||
"target `{}` must specify `cxx_toolchain_dir`",
|
||||
config.target
|
||||
)
|
||||
.set_include_paths(vec![
|
||||
};
|
||||
|
||||
let linker = if let Some(ref linker) = config.linker {
|
||||
linker.to_owned()
|
||||
} else {
|
||||
format!("{cxx_toolchain_dir}/bin/aarch64_be-none-linux-gnu-g++")
|
||||
};
|
||||
|
||||
trace!("using linker: {linker}");
|
||||
|
||||
command = command.set_linker(linker).set_include_paths(vec![
|
||||
"/include",
|
||||
"/aarch64_be-none-linux-gnu/include",
|
||||
"/aarch64_be-none-linux-gnu/include/c++/14.3.1",
|
||||
"/aarch64_be-none-linux-gnu/include/c++/14.3.1/aarch64_be-none-linux-gnu",
|
||||
"/aarch64_be-none-linux-gnu/include/c++/14.3.1/backward",
|
||||
"/aarch64_be-none-linux-gnu/libc/usr/include",
|
||||
]);
|
||||
]);
|
||||
}
|
||||
|
||||
if !compiler.contains("clang") {
|
||||
if !cpp_compiler.contains("clang") {
|
||||
command = command.add_extra_flag("-flax-vector-conversions");
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
use crate::common::intrinsic::{Intrinsic, IntrinsicDefinition};
|
||||
use crate::common::intrinsic_helpers::TypeKind;
|
||||
use crate::common::write_file::{write_c_testfiles, write_rust_testfiles};
|
||||
use compile::compile_c_arm;
|
||||
use config::{AARCH_CONFIGURATIONS, F16_FORMATTING_DEF, POLY128_OSTREAM_DEF, build_notices};
|
||||
use intrinsic::ArmIntrinsicType;
|
||||
use json_parser::get_neon_intrinsics;
|
||||
@@ -51,9 +50,7 @@ fn create(cli_options: ProcessedCli) -> Box<Self> {
|
||||
}
|
||||
|
||||
fn build_c_file(&self) -> bool {
|
||||
let compiler = self.cli_options.cpp_compiler.as_deref();
|
||||
let target = &self.cli_options.target;
|
||||
let cxx_toolchain_dir = self.cli_options.cxx_toolchain_dir.as_deref();
|
||||
let c_target = "aarch64";
|
||||
|
||||
let intrinsics_name_list = write_c_testfiles(
|
||||
@@ -69,15 +66,7 @@ fn build_c_file(&self) -> bool {
|
||||
&[POLY128_OSTREAM_DEF],
|
||||
);
|
||||
|
||||
match compiler {
|
||||
None => true,
|
||||
Some(compiler) => compile_c_arm(
|
||||
intrinsics_name_list.as_slice(),
|
||||
compiler,
|
||||
target,
|
||||
cxx_toolchain_dir,
|
||||
),
|
||||
}
|
||||
compile::compile_c_arm(&self.cli_options, intrinsics_name_list.as_slice())
|
||||
}
|
||||
|
||||
fn build_rust_file(&self) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user