public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Stefan Jones <cretin@gentoo.org>
To: gentoo-core <gentoo-core@gentoo.org>, gentoo-dev <gentoo-dev@gentoo.org>
Subject: [gentoo-dev] Prelinking in Gentoo and interactions with portage
Date: 17 Nov 2002 13:50:53 +0000	[thread overview]
Message-ID: <1037541053.25487.58.camel@localhost> (raw)


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


             reply	other threads:[~2002-11-17 13:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-17 13:50 Stefan Jones [this message]
2002-11-17 23:39 ` [gentoo-dev] Re: [gentoo-core] Prelinking in Gentoo and interactions with portage 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1037541053.25487.58.camel@localhost \
    --to=cretin@gentoo.org \
    --cc=gentoo-core@gentoo.org \
    --cc=gentoo-dev@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox