[Bug c/93180] const function pointers placed in a custom section are causing that custom section to become writable

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jan 6 22:57:00 GMT 2020


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It is not about function pointer but rather a pointer in general.  This section
needs runtime relocations (because you are compiling as PIE) so it needs to be
writable.

Your gcc is defaulting to generating PIE programs while your clang is NOT.
You will get the same behavior if you generate the same kind of programs for
both.  Either -fno-PIE for GCC or add -fPIE for clang.


More information about the Gcc-bugs mailing list