[Bug target/95637] Read-only data assigned to `.sdata' rather than `.rodata'
wilson at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jun 11 21:06:31 GMT 2020
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.
More information about the Gcc-bugs
mailing list