I may be misunderstanding the interface - but it looks to me like it lets the kernel chose an arbitrary mapping address for different compiler invocations but relies on the assumption that the returned address will be the same. If not, the compiler fails with a fatal_error when trying to read a precompiled header file ("had to relocate PCH").
I can not imagine a host system where this would work reliably (or even typically twice in a row).
Please tell me I misunderstood, or consider disabling PCH support for host platforms without host_hooks overriding this function.
Well, it doesn't _rely_ on it - it basically makes systems where that is the
case work out of the box (every system pre address-space-randomization area).
If you have a system that randomizes then you have to re-define the hook.
(In reply to Richard Biener from comment #1)
> If you have a system that randomizes then you have to re-define the hook.
Besides ASLR there are various things out of control of the compiler that do result in varying mapping adresses (like malloc using mmap instead of brk), so chances are low in any modern system.
I'm not opposed to create a hook for NetBSD, but I have a hard time seeing a possible sensible implementation. Look at the #ifdef cascade in config/host-openbsd.c for a disgusting example of code that should not be in a compiler (IMHO).
How hard is making the externalized format address neutral?