https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71934
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So, what is exactly the reason why we disallow PCH for PIEs? Is it that we support in GC managed memory pointers into .rodata/.data/.text sections of the compiler (function pointers, data pointers, vtable pointers)? If yes, are those at least marked as pointers in the GTY stuff? Perhaps the compiler when writing PCH could just record the extents of those sections (or say PT_LOAD segments, on Linux e.g. using dl_iterate_phdr) if it detects the binary is position independent, and when loading the PCH also detect those extents and for GC pointers that fall into those extents adjust them for the new locations?