From 1e6c94bec1a56a88ea3df518de0d073d26596580 Mon Sep 17 00:00:00 2001 From: Afonso Bordado Date: Sat, 18 Feb 2023 12:23:24 +0000 Subject: [PATCH] cranelift-object: Make sections read only by default (#5619) This changes the default section type to be `ReadOnlyDataWithRel` instead of `Data`. On COFF types the CRT initializers do not run unless their section is read only. The new SectionKind makes these sections read only for COFF and MachO, but leaves it as Writable as required by ELF. --- cranelift/object/src/backend.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cranelift/object/src/backend.rs b/cranelift/object/src/backend.rs index 13240db1c7..b0f12198e9 100644 --- a/cranelift/object/src/backend.rs +++ b/cranelift/object/src/backend.rs @@ -457,7 +457,7 @@ impl Module for ObjectModule { } else if relocs.is_empty() { SectionKind::ReadOnlyData } else { - SectionKind::Data + SectionKind::ReadOnlyDataWithRel }, ) };