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.