https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116887

--- Comment #18 from Florian Weimer <fw at gcc dot gnu.org> ---
(In reply to chenglulu from comment #17)
> I don't think it can be completely avoided. But I don't understand why the
> public code does not set the SECTION_RELRO flag when putting decl into
> ".data.rel.ro" via __attribute__.

I'm not aware of a way to set the RELRO flag directly. We want to write to
these variables during initialization, so we cannot make them const. I assume
we could move the definition into a separate TU and only have the section
attribute on a definition. This would then rely on more relaxed section merging
in the linker. The particular instance that triggered this bug report would be
fairly straightforward to fix, but doing this for e.g. _rtld_global_ro is more
difficult.

Reply via email to