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.
This commit is contained in:
Afonso Bordado
2023-02-18 12:23:24 +00:00
committed by GitHub
parent 539c42e590
commit 1e6c94bec1

View File

@@ -457,7 +457,7 @@ impl Module for ObjectModule {
} else if relocs.is_empty() { } else if relocs.is_empty() {
SectionKind::ReadOnlyData SectionKind::ReadOnlyData
} else { } else {
SectionKind::Data SectionKind::ReadOnlyDataWithRel
}, },
) )
}; };