Rust fmt fixes
This commit is contained in:
@@ -211,7 +211,7 @@ impl Backend for FaerieBackend {
|
|||||||
ref data_decls,
|
ref data_decls,
|
||||||
ref function_relocs,
|
ref function_relocs,
|
||||||
ref data_relocs,
|
ref data_relocs,
|
||||||
section: ref datasection
|
section: ref datasection,
|
||||||
} = data_ctx.description();
|
} = data_ctx.description();
|
||||||
|
|
||||||
assert!(datasection.is_none(), "Custom sections not supported");
|
assert!(datasection.is_none(), "Custom sections not supported");
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ pub struct DataDescription {
|
|||||||
/// Data addresses to write at specified offsets.
|
/// Data addresses to write at specified offsets.
|
||||||
pub data_relocs: Vec<(CodeOffset, ir::GlobalValue, Addend)>,
|
pub data_relocs: Vec<(CodeOffset, ir::GlobalValue, Addend)>,
|
||||||
/// Object file section
|
/// Object file section
|
||||||
pub section: Option<(std::string::String, std::string::String)>
|
pub section: Option<(std::string::String, std::string::String)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This is to data objects what cranelift_codegen::Context is to functions.
|
/// This is to data objects what cranelift_codegen::Context is to functions.
|
||||||
@@ -65,7 +65,7 @@ impl DataContext {
|
|||||||
data_decls: PrimaryMap::new(),
|
data_decls: PrimaryMap::new(),
|
||||||
function_relocs: vec![],
|
function_relocs: vec![],
|
||||||
data_relocs: vec![],
|
data_relocs: vec![],
|
||||||
section: None
|
section: None,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,10 @@ impl DataContext {
|
|||||||
|
|
||||||
/// Override the segment/section for data, only supported on Object backend
|
/// Override the segment/section for data, only supported on Object backend
|
||||||
pub fn set_section(&mut self, seg: &str, sec: &str) {
|
pub fn set_section(&mut self, seg: &str, sec: &str) {
|
||||||
self.description.section = Some((std::string::String::from(seg), std::string::String::from(sec)))
|
self.description.section = Some((
|
||||||
|
std::string::String::from(seg),
|
||||||
|
std::string::String::from(sec),
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Declare an external function import.
|
/// Declare an external function import.
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ impl Backend for ObjectBackend {
|
|||||||
ref data_decls,
|
ref data_decls,
|
||||||
ref function_relocs,
|
ref function_relocs,
|
||||||
ref data_relocs,
|
ref data_relocs,
|
||||||
section: ref datasection
|
section: ref datasection,
|
||||||
} = data_ctx.description();
|
} = data_ctx.description();
|
||||||
|
|
||||||
let reloc_size = match self.isa.triple().pointer_width().unwrap() {
|
let reloc_size = match self.isa.triple().pointer_width().unwrap() {
|
||||||
@@ -265,8 +265,7 @@ impl Backend for ObjectBackend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let symbol = self.data_objects[data_id].unwrap();
|
let symbol = self.data_objects[data_id].unwrap();
|
||||||
let section =
|
let section = if datasection.is_none() {
|
||||||
if datasection.is_none() {
|
|
||||||
let section_kind = if let Init::Zeros { .. } = *init {
|
let section_kind = if let Init::Zeros { .. } = *init {
|
||||||
if tls {
|
if tls {
|
||||||
StandardSection::UninitializedTls
|
StandardSection::UninitializedTls
|
||||||
@@ -286,8 +285,14 @@ impl Backend for ObjectBackend {
|
|||||||
} else {
|
} else {
|
||||||
assert!(!tls, "Tls data cannot be in named section");
|
assert!(!tls, "Tls data cannot be in named section");
|
||||||
let (seg, sec) = &datasection.as_ref().unwrap();
|
let (seg, sec) = &datasection.as_ref().unwrap();
|
||||||
self.object.add_section(seg.clone().into_bytes(), sec.clone().into_bytes(),
|
self.object.add_section(
|
||||||
if writable { SectionKind::Data } else { SectionKind::ReadOnlyData }
|
seg.clone().into_bytes(),
|
||||||
|
sec.clone().into_bytes(),
|
||||||
|
if writable {
|
||||||
|
SectionKind::Data
|
||||||
|
} else {
|
||||||
|
SectionKind::ReadOnlyData
|
||||||
|
},
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user