https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95637
Jim Wilson <wilson at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wilson at gcc dot gnu.org --- Comment #1 from Jim Wilson <wilson at gcc dot gnu.org> --- The RISC-V backend puts small read-only data in the srodata section. RISC-V is not the only target that supports srodata. I agree that this might be surprising for targets with memory protection that are expecting writes to read-only data to trap but I don't think that standards require traps here. And for targets without memory protection this is a useful code size and performance optimization. We could perhaps disable srodata support for the riscv linux and freebsd targets. I think those are the only ones with memory protection that we support. Maybe make this controlled by an option so people can choose between getting traps and getting smaller faster code.