This is the mail archive of the gcc@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: precompiled header support


<tm_gccmail@kloo.net> writes:

> On 11 May 2004, Ian Lance Taylor wrote:
> 
> > Gunther Nikl <gni@gecko.de> writes:
> > 
> > >   What is "fixed for a particular instance of cc1"? That the address is
> > >   always the same for a specific cc1 but might be different with another
> > >   cc1? However, that doesn't really matter in this case.
> > 
> > Yes, that is what I mean: the address is always the same for a
> > specific cc1.
> > 
> > >   Both approaches don't work with "my" host since the OS always loads
> > >   executables to random addresses. This is by design to not require a MMU.
> > >   An executable might have an relocation table if necessary to allow the
> > >   loader to adapt the program for the real address in memory.
> > 
> > That's a tough one.  Are the addresses truly random across the whole
> > memory space?  Is there any area of memory which you can reasonably
> > expect will not contain any code?  If not, then I don't think PCH will
> > work for you.  Tell Geoff Keating--he has argued that every system has
> > some address available.

Actually, my assertion was that at that time, every system had turned
out to have a suitable address space available, not that this applies
to all systems anyone will ever invent.

It does sound like AmigaOS is going to be the first system where this
approach won't work.  Fortunately, I considered this when designing
PCH, and came up with a solution (you can see the easy part of the
solution in the current code, right before it calls sorry()); it just
never got implemented because it wasn't needed.  If anyone is interested
in implementing it, let me know and I'll write up the design.

> For AmigaOS, the addresses are random in the RAm area space.
> 
> Imagine an OS that doesn't use an MMU. Basically, all the processes wind
> up sharing the single physical address space. Therefore, when a program
> needs to be loaded, the OS finds a free chunk of physical RAM and loads it
> there, then updates the relocations so the program will run correctly at
> that address.
> 
> The free chunk of physical RAM is dependent on what other programs are
> currently running at the moment, and the state of the global heap.
> So therefore, the load address is random within the physical RAM space.
> 
> Geoff's assertion does not apply to the AmigaOS case.
> 
> I believe ucLinux (MMUless Linux) also does the same thing, so PCH
> probably will not work there either.
> 
> Toshi
> 
> 
> 

-- 
- Geoffrey Keating <geoffk@geoffk.org>


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