From deb20c129a7d36bd5b53f3727a5acf9231c7337e Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Mon, 21 Sep 2020 13:38:42 +0200 Subject: [PATCH] Fix relocated readonly data in custom sections Lld doesn't allow relocations in readonly sections --- cranelift/object/src/backend.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 }, ) };