Address concerns in pullrequests.

This commit is contained in:
Carlo Kok
2020-06-15 20:46:04 +02:00
parent 38531b8f42
commit 0b613caad1
6 changed files with 21 additions and 15 deletions

View File

@@ -14,6 +14,7 @@ cranelift-module = { path = "../module", version = "0.64.0" }
cranelift-codegen = { path = "../codegen", version = "0.64.0", default-features = false, features = ["std"] }
object = { version = "0.18", default-features = false, features = ["write"] }
target-lexicon = "0.10"
anyhow = "1.0"
[badges]
maintenance = { status = "experimental" }

View File

@@ -234,7 +234,7 @@ impl Backend for ObjectBackend {
ref data_decls,
ref function_relocs,
ref data_relocs,
section: ref datasection,
ref custom_segment_section,
} = data_ctx.description();
let reloc_size = match self.isa.triple().pointer_width().unwrap() {
@@ -265,7 +265,7 @@ impl Backend for ObjectBackend {
}
let symbol = self.data_objects[data_id].unwrap();
let section = if datasection.is_none() {
let section = if custom_segment_section.is_none() {
let section_kind = if let Init::Zeros { .. } = *init {
if tls {
StandardSection::UninitializedTls
@@ -283,8 +283,10 @@ impl Backend for ObjectBackend {
};
self.object.section_id(section_kind)
} else {
assert!(!tls, "Tls data cannot be in named section");
let (seg, sec) = &datasection.as_ref().unwrap();
if tls {
return Err(cranelift_module::ModuleError::Backend(anyhow::anyhow!("Custom section not supported for TLS")));
}
let (seg, sec) = &custom_segment_section.as_ref().unwrap();
self.object.add_section(
seg.clone().into_bytes(),
sec.clone().into_bytes(),