public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Prelinking in Gentoo and interactions with portage
@ 2002-11-17 13:50 Stefan Jones
  2002-11-17 23:39 ` [gentoo-dev] Re: [gentoo-core] " Daniel Robbins
  2002-11-18 14:53 ` [gentoo-dev] " Felipe Ghellar
  0 siblings, 2 replies; 10+ messages in thread
From: Stefan Jones @ 2002-11-17 13:50 UTC (permalink / raw
  To: gentoo-core, gentoo-dev


DISCLAIMER: Prelink is experimental and ^may^ break EVERYTHING
( having said this I have suffered no serious breakages, but others
have)

Recently I have started working on prelinking in gentoo.

When a shared executable is run all the references to functions in
shared libraries have to be cross referenced and offsets applied to the
function pointers. Prelink modifies the executables so that this work is
done before the binary is run. This speeds start up times by a large
factor (up to 50% for some applications like mozilla and KDE).

To use prelink you need a prelink enabled glibc (2.3.1 satisfies this),
and a new version of binutils (2.13.90.0.10 will do).

I have put a masked prelink ebuild into portage, this provides the tool
that modifies the binaries. Emerge it and read "man prelink" for more
details.

Now the portage details:

Prelink needs to be rerun on shared librarys and executables every time
their dependant librarys get modified. So when you upgrade a library
prelink needs to be rerun on the executables. This means the md5sum of a
binary will change from the portage digest.

There is a work around for that, prelink has the ability to spool out
the original binary's contents to stdout. This can be harnessed by
portage. The details how to do so follow:

On Install:
1) The MD5sun is first calculated for the CONTENTS file
2) The files are merged (installed) into the filesystem
3) prelink is run on all the installed binaries and libraries

On Uninstall:
* If the file is an executable / library pipe it though prelink when
calculating the MD5sum.

All the above would be ifdefed out if some PRELINK_ENABLE variable was
not set somewhere (eg. make.global), so there will be no slowdown for
ppl not using prelink.

Note: the prelink command cannot be put in
/usr/lib/portage/bin/prepallstrip as prelink may have to be rerun on the
file causing the MD5sum to change again.

Also some small bash script needs to be made to allow the user to
re-prelink files after a library upgrade. Prelinking doesn't take long,
prelinking from scratch /usr/bin only takes a few minutes. This could be
in a cron-job or manually run by the user though a new portage command.

Note: re-prelinking a file is very quick, so it may be feasible to
prelink all dependants in emerge after the library install. But this
would require reverse dependency checking.

Once the details are fixed, I will happing code this up and submit the
patches.

Food for thought,

	Stefan

-- 
Stefan Jones <cretin@gentoo.org>
Gentoo Linux


--
gentoo-dev@gentoo.org mailing list


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2002-11-20  9:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-17 13:50 [gentoo-dev] Prelinking in Gentoo and interactions with portage Stefan Jones
2002-11-17 23:39 ` [gentoo-dev] Re: [gentoo-core] " Daniel Robbins
2002-11-18  0:19   ` Alexander Futasz
2002-11-18 12:21     ` david mattatall
2002-11-20  9:31       ` [gentoo-dev] " Javier Marcet
2002-11-18 14:53 ` [gentoo-dev] " Felipe Ghellar
2002-11-18 17:41   ` David Olsen
2002-11-18 20:31     ` Stefan Jones
2002-11-18 22:39       ` Stefan Jones
2002-11-19 20:49         ` [gentoo-dev] " Stefan Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox