bytecodealliance / wasmtime

A fast and secure runtime for WebAssembly
https://wasmtime.dev/
Apache License 2.0
15.21k stars 1.28k forks source link

cranelift-module: Support marking data object as read-only C string #8901

Open bjorn3 opened 3 months ago

bjorn3 commented 3 months ago

Feature

See title

Benefit

This would allow the linker to deduplicate the strings. In addition some linker don't like mixing attributes between sections that get merged, so if the user of cg_clif specified that the data object needs to end up in __TEXT/__cstring, we will need to respect the cstring_literals section type likely specified by the user too.

Implementation

cranelift-jit can ignore this and cranelift-object can use SectionKind::ReadOnlyString.