https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93180
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- For variables that should be read-only after relocation processing, but should be relocated, gcc normally uses .data.rel.ro and similar sections, those are writable, but placed in PT_GNU_RELRO part of the binary/shared library, so it is mprotected after relocation processing. You should probably arrange through linker script to put your section in that segment too.