diff --git a/cranelift/object/src/backend.rs b/cranelift/object/src/backend.rs index 6521dd0c30..128571f6b8 100644 --- a/cranelift/object/src/backend.rs +++ b/cranelift/object/src/backend.rs @@ -335,8 +335,10 @@ impl Backend for ObjectBackend { sec.clone().into_bytes(), if writable { SectionKind::Data - } else { + } else if relocs.is_empty() { SectionKind::ReadOnlyData + } else { + SectionKind::Data }, ) };