https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71934
--- Comment #16 from Jakub Jelinek <jakub at gcc dot gnu.org> --- And if doing it at restore time would be too hard, there is always an option to precompute a "relocation" table during PCH saving and store it at the very end of the PCH file, so that normally when successfully loading PCH at the expected address we don't need to touch that area, but if we map it elsewhere, we can read it and relocate. Such relocation table could either contain all the addresses in the global GTY roots that need += bias (relative to say gt_ggc_rtab or something similar) and all the addresses in the mapped blob that need += bias (relative to the start of the mapped blob), ideally sorted during PCH saving by increasing address. If that would be too large, another option would be try to make it more compact, e.g. after that sorting of addresses represent it as unsigned short delta from the last address, unless that ushort is 0, which then would be followed by full sizeof(void*) address relative to gt_ggc_rtab or the map base; perhaps even ushort 0 followed by address relative to gt_ggc_rtab and ushort 1 followed by address relative to map base.