[Bug c/93180] New: const function pointers placed in a custom section are causing that custom section to become writable
pskocik at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Jan 6 22:41:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93180
Bug ID: 93180
Summary: const function pointers placed in a custom section are
causing that custom section to become writable
Product: gcc
Version: 7.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: pskocik at gmail dot com
Target Milestone: ---
__attribute((__section__("mysection"))) int const cx = -42;
(or with multiple const data variables in the `mysection` section) results in
assembly output containing
.section mysection,"a",@progbits
Adding a const function pointer as in
#include <stdio.h>
__attribute((__section__("mysection"))) int (* const p)(char const*) = &puts;
causes the section to be mapped to a writable segment
.section mysection,"aw",@progbits
Since the pointer is const, I think the section ought to remain read-only (on
clang it does).
More information about the Gcc-bugs
mailing list