Lennart Sorensen wrote:
> On Wed, Apr 21, 2010 at 11:34:35AM -0400, Jeff Bacon wrote:
> > I was under the impression that for NOMMU, binary Text segments could
> > NOT be shared. How are you getting the kernel to share the text areas?
> > For me, every copy of BB is taking up a new 256kB chunk.  I am running
> > on an ARM7TDMI, you?
> 
> Coldfire.  binflat fileformat (that's what the coldfire uses).
> The binflat loader certainly does support sharing text segment.
> Of course this is using a new enough gcc (4.3.3) to use a GOT so that
> the actual text is never touched to perform reloacations.  Only the GOT
> (global offset table) is modified, and each instance has their own copy
> of that table.  I believe with older gcc versions that wasn't done,
> and in that case you probably can't share the text segment.
> This may very well be coldfire specific.  No idea how arm does things.

Maybe on Coldfire.  On ARM7-ish (ARMv4T), the venerable GCC 2.95.3 is
able to make XIP binaries which I've not had problems with.

> Certainly older gcc versions had serious limits on the size of
> programs and could easily run out of fixup table entries or chunks
> of code to far apart to handle.

I haven't encounted those problems in C programs on ARM - only an
occasional Internal Compiler Error due to 16 registers not being
enough or something ;-)

> That seems to no longer be a problem.  Certainly we ran into
> programs we could not compile before going to gcc 4.3 for the
> coldfire.  We have never seen any problems since going to 4.3
> though.

I'm still resisting because of need to link with proprietary libraries
that were built with GCC 2.95.3 and the old ARM ABI.  Maybe it's fine,
but I'm cautious after getting burnt with GCC 3.4.3 threaded programs
crashing due to incompatibility with an older uClibc.  To a small
extent uClibc depends on GCC from the same time era, so a big jump in
GCC version means putting faith in a jump in uClibc version - with the
ABI compatility problem with preexiting binary libraries that causes.
(pthread structure sizes have changed.)

Of course I do use GCC 4 for other things :-)

> I run from an initramfs ramdisk, so technically it should be able to
> use execute in place for the text from the ramdisk, but for some reason
> that doesn't currently work.  So the first instance is copied to another
> place in ram, but that copy is then shared for all other instances.

I use an XIP-in-RAM driver that I wrote, which allows specific
executables to be preloaded and even lets them start out using the
compressed bFLT format.  It's for an ancient platform (though it's
still being shipped in new products); I'm under the impression the
driver is not required on current kernels, as multiple read-only mmaps
of the same file should share automatically.

-- Jamie
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to