This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PCH support on Solaris


> A solution might be to do an anonymous mmap to find the address
>
> #ifndef MAP_NORESERVE
> #define MAP_NORESERVE 0
> #endif
>
> guess = mmap (mmi.preferred_base, mmi.size,
>     PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON,
>     -1, 0);
>
> addr = mmap (guess, mmi.size, PROT_READ, MAP_FIXED|MAP_SHARED,
>     fd, mmi.offset);

Which address are you talking about? According to my experiments, the value 
of addr returned by

 addr = mmap (mmi.preferred_base, mmi.size, PROT_READ, MAP_PRIVATE
 	fd, mmi.offset);

is perfectly predictable on Solaris: it's 

 addr = mmi.preferred_base + mmi.offset


The problem is that the heuristics expects mmi.preferred_base, so we need 
either to change the heuristics or to force the address with MAP_FIXED.

-- 
Eric Botcazou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]