If address space randomization is enabled echo 1 > /proc/sys/kernel/randomize_va_space pch isn't used - warning: had text segment at different address
Which host is this on?
x86_64-pc-linux-gnu
It should work, we use fixed mappings for this.
It is possible that this bug is related to PaX, which I'm using http://bugs.gentoo.org/show_bug.cgi?id=301299#c31 I tried to disable PaX with "paxctl -pemrxs cc1plus", but warning disappear only if randomize_va_space is 0
We can't simply use MAP_FIXED, as that will discard existing overlapping mappings. MAP_FIXED Don't interpret addr as a hint: place the mapping at exactly that address. addr must be a multiple of the page size. If the memory region specified by addr and len overlaps pages of any existing mapping(s), then the overlapped part of the existing mapping(s) will be discarded. If the specified address cannot be used, mmap() will fail. Because requiring a fixed address for a mapping is less portable, the use of this option is dis- couraged. So we'd need to portably check for existing mappings in the range we want to request. I don't think that is desirable (if only from a performance perspective). The only way to do this that I can think of is parsing /proc or installing a SIGSEGV/SIGBUS handler and poking every page ...
I can see warning also when PaX is disabled with kernel 2.6.37.2 randomize_va_space is 1 by default.
Parsing /proc doesn't have to work with PaX kernel. PaX removes some info from e.g. maps file.
I have tested GCC 4.5.4 and 4.7.1. It seems to be fixed.