Merge commit '659243d85c7489412bd0faa1c068d904a6042941' into sync_cg_clif-2024-07-13
This commit is contained in:
@@ -395,7 +395,6 @@ pub(crate) fn codegen_terminator_call<'tcx>(
|
||||
crate::intrinsics::codegen_llvm_intrinsic_call(
|
||||
fx,
|
||||
&fx.tcx.symbol_name(instance).name,
|
||||
fn_args,
|
||||
args,
|
||||
ret_place,
|
||||
target,
|
||||
|
||||
@@ -14,12 +14,12 @@ impl ArchiveBuilderBuilder for ArArchiveBuilderBuilder {
|
||||
|
||||
fn create_dll_import_lib(
|
||||
&self,
|
||||
_sess: &Session,
|
||||
sess: &Session,
|
||||
_lib_name: &str,
|
||||
_dll_imports: &[rustc_session::cstore::DllImport],
|
||||
_tmpdir: &Path,
|
||||
_is_direct_dependency: bool,
|
||||
) -> PathBuf {
|
||||
unimplemented!("creating dll imports is not yet supported");
|
||||
sess.dcx().fatal("raw-dylib is not yet supported by rustc_codegen_cranelift");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,15 +385,43 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
|
||||
|
||||
if let Some(section_name) = section_name {
|
||||
let (segment_name, section_name) = if tcx.sess.target.is_like_osx {
|
||||
let section_name = section_name.as_str();
|
||||
if let Some(names) = section_name.split_once(',') {
|
||||
names
|
||||
} else {
|
||||
// See https://github.com/llvm/llvm-project/blob/main/llvm/lib/MC/MCSectionMachO.cpp
|
||||
let mut parts = section_name.as_str().split(',');
|
||||
let Some(segment_name) = parts.next() else {
|
||||
tcx.dcx().fatal(format!(
|
||||
"#[link_section = \"{}\"] is not valid for macos target: must be segment and section separated by comma",
|
||||
section_name
|
||||
));
|
||||
};
|
||||
let Some(section_name) = parts.next() else {
|
||||
tcx.dcx().fatal(format!(
|
||||
"#[link_section = \"{}\"] is not valid for macos target: must be segment and section separated by comma",
|
||||
section_name
|
||||
));
|
||||
};
|
||||
if section_name.len() > 16 {
|
||||
tcx.dcx().fatal(format!(
|
||||
"#[link_section = \"{}\"] is not valid for macos target: section name bigger than 16 bytes",
|
||||
section_name
|
||||
));
|
||||
}
|
||||
let section_type = parts.next().unwrap_or("regular");
|
||||
if section_type != "regular" && section_type != "cstring_literals" {
|
||||
tcx.dcx().fatal(format!(
|
||||
"#[link_section = \"{}\"] is not supported: unsupported section type {}",
|
||||
section_name, section_type,
|
||||
));
|
||||
}
|
||||
let _attrs = parts.next();
|
||||
if parts.next().is_some() {
|
||||
tcx.dcx().fatal(format!(
|
||||
"#[link_section = \"{}\"] is not valid for macos target: too many components",
|
||||
section_name
|
||||
));
|
||||
}
|
||||
// FIXME(bytecodealliance/wasmtime#8901) set S_CSTRING_LITERALS section type when
|
||||
// cstring_literals is specified
|
||||
(segment_name, section_name)
|
||||
} else {
|
||||
("", section_name.as_str())
|
||||
};
|
||||
|
||||
@@ -39,7 +39,13 @@ impl WriteDebugInfo for ObjectProduct {
|
||||
let section_id = self.object.add_section(
|
||||
segment,
|
||||
name,
|
||||
if id == SectionId::EhFrame { SectionKind::ReadOnlyData } else { SectionKind::Debug },
|
||||
if id == SectionId::DebugStr || id == SectionId::DebugLineStr {
|
||||
SectionKind::DebugString
|
||||
} else if id == SectionId::EhFrame {
|
||||
SectionKind::ReadOnlyData
|
||||
} else {
|
||||
SectionKind::Debug
|
||||
},
|
||||
);
|
||||
self.object
|
||||
.section_mut(section_id)
|
||||
|
||||
@@ -6,32 +6,16 @@ use crate::prelude::*;
|
||||
pub(crate) fn codegen_llvm_intrinsic_call<'tcx>(
|
||||
fx: &mut FunctionCx<'_, '_, 'tcx>,
|
||||
intrinsic: &str,
|
||||
generic_args: GenericArgsRef<'tcx>,
|
||||
args: &[Spanned<mir::Operand<'tcx>>],
|
||||
ret: CPlace<'tcx>,
|
||||
target: Option<BasicBlock>,
|
||||
span: Span,
|
||||
) {
|
||||
if intrinsic.starts_with("llvm.aarch64") {
|
||||
return llvm_aarch64::codegen_aarch64_llvm_intrinsic_call(
|
||||
fx,
|
||||
intrinsic,
|
||||
generic_args,
|
||||
args,
|
||||
ret,
|
||||
target,
|
||||
);
|
||||
return llvm_aarch64::codegen_aarch64_llvm_intrinsic_call(fx, intrinsic, args, ret, target);
|
||||
}
|
||||
if intrinsic.starts_with("llvm.x86") {
|
||||
return llvm_x86::codegen_x86_llvm_intrinsic_call(
|
||||
fx,
|
||||
intrinsic,
|
||||
generic_args,
|
||||
args,
|
||||
ret,
|
||||
target,
|
||||
span,
|
||||
);
|
||||
return llvm_x86::codegen_x86_llvm_intrinsic_call(fx, intrinsic, args, ret, target, span);
|
||||
}
|
||||
|
||||
match intrinsic {
|
||||
|
||||
@@ -6,7 +6,6 @@ use crate::prelude::*;
|
||||
pub(crate) fn codegen_aarch64_llvm_intrinsic_call<'tcx>(
|
||||
fx: &mut FunctionCx<'_, '_, 'tcx>,
|
||||
intrinsic: &str,
|
||||
_args: GenericArgsRef<'tcx>,
|
||||
args: &[Spanned<mir::Operand<'tcx>>],
|
||||
ret: CPlace<'tcx>,
|
||||
target: Option<BasicBlock>,
|
||||
|
||||
@@ -10,7 +10,6 @@ use crate::prelude::*;
|
||||
pub(crate) fn codegen_x86_llvm_intrinsic_call<'tcx>(
|
||||
fx: &mut FunctionCx<'_, '_, 'tcx>,
|
||||
intrinsic: &str,
|
||||
_args: GenericArgsRef<'tcx>,
|
||||
args: &[Spanned<mir::Operand<'tcx>>],
|
||||
ret: CPlace<'tcx>,
|
||||
target: Option<BasicBlock>,
|
||||
|
||||
Reference in New Issue
Block a user