r948 - in trunk: . MAINTAINER OLD PREVIOUS_FORMAT

tushar at linuxfromscratch.org tushar at linuxfromscratch.org
Sat Mar 26 21:05:28 PST 2005


Author: tushar
Date: 2005-03-26 22:05:27 -0700 (Sat, 26 Mar 2005)
New Revision: 948

Added:
   trunk/OLD/prelink.txt
   trunk/prelink.txt
Removed:
   trunk/PREVIOUS_FORMAT/prelink.txt
Modified:
   trunk/MAINTAINER/STATUS
Log:
Added Hint: prelink

Modified: trunk/MAINTAINER/STATUS
===================================================================
--- trunk/MAINTAINER/STATUS	2005-03-26 00:00:24 UTC (rev 947)
+++ trunk/MAINTAINER/STATUS	2005-03-27 05:05:27 UTC (rev 948)
@@ -52,7 +52,6 @@
    * pcmcia: Conversion in progress.
    * portscan: Could not contact author.
    * ppp: No response from author.
-   * prelink: Conversion in progress.
    * pth: No response from author.
    * qmail_cyrus_imap: No response from author.
    * redhat_style_logon: Could not contact author.

Added: trunk/OLD/prelink.txt
===================================================================
--- trunk/OLD/prelink.txt	2005-03-26 00:00:24 UTC (rev 947)
+++ trunk/OLD/prelink.txt	2005-03-27 05:05:27 UTC (rev 948)
@@ -0,0 +1,151 @@
+TITLE:		Prelinking
+
+LFS VERSION:	glibc-2.3+ based LFS
+
+AUTHOR:         Tushar Teredesai <Tushar at LinuxFromScratch.Org>
+
+SYNOPSIS:
+	Use prelinking - the official way to optimize!
+
+HINT:
+
+Primary Location of this hint:
+        http://www.linuxfromscratch.org/~tushar/
+The latest version of the hint and any relevant patches are available at that
+site. Please refer to the primary location before submitting
+bug-reports/enhancements to this hint.
+
+You may freely copy this document or create derivate works or distribute the
+document in any format. At your discretion, you may give credit to the original
+author:)
+
+Use the hint at your own risk. Neither the author, nor the Linux From Scratch
+project accept any responsibility for anything that happens when using these
+documents or associated files.
+
+An appropriate place to discuss this hint is blfs-support MailingList/NewsGroup
+at LinuxFromScratch.Org. I welcome bug reports but for support requests, please
+use the support list.
+
+Change Log:
+[2003-03-05]
+	* Added explaination for objprelink (which many confuse with prelink).
+	* Added a cron script to run prelink periodically.
+	* Added note that making a backup is optional.
+[2003-03-02]
+	* Added -f flag to force prelink.
+[2002-12-25]
+        * Changed primary location and e-mail address.
+[2002-10-24]
+	* First public version.
+
+Pre-requisites (post LFS):
+	* libelf - 0.8.2
+		<http://freshmeat.net/projects/libelf/>
+
+Packages to download:
+	* prelink - 20021002
+		<http://freshmeat.net/projects/prelink/>
+
+WARNING:
+* I have tested the hint on a glibc-2.3.1 system. Check out the lfs-dev archives
+  since October 2002 for how to upgrade to glibc-2.3.1.
+* Prelinking *can* mess up your system. So make appropriate backups.
+* Don't try to prelink during the chroot phase.
+
+What is prelinking? (From the horse's mouth - the man page)
+
+prelink is a program which modifies ELF shared libraries and ELF dynamically
+linked binaries, so that the time which dynamic linker needs for their
+relocation at startup significantly decreases and also due to fewer relocations
+the run-time memory consumption decreases too (especially number of unshareable
+pages). Such prelinking information is only used if all its dependant libraries
+have not changed since prelinking, otherwise programs are relocated normally.
+
+prelink first collects ELF binaries which should be prelinked and all the ELF
+shared libraries they depend on. Then it assigns a unique virtual address space
+slot for each library and relinks the shared library to that base address. When
+the dynamic linker attempts to load such a library, unless that virtual address
+space slot is already occupied, it will  map it into the given slot. After this
+is done, prelink with the help of dynamic linker resolves all relocations in the
+binary or library against its dependant libraries and stores the relocations
+into the ELF object. It also stores a list of all dependant libraries together
+with their checksums into the binary or library. For binaries, it also computes
+a list of conflicts (relocations which resolve differently in the binary's
+symbol search scope than in the smaller search scope in which the dependant
+library was resolved) and stores it into a special ELF section.
+
+At runtime, the dynamic linker first checks whether all dependant libraries were
+successfully mapped into their designated address space slots and whether they
+have not changed since the prelinking was done. If all checks are successful,
+the dynamic linker just replays the list of conflicts (which is usually
+significantly shorter than total number of relocations) instead of relocating
+each library.
+
+Previous prelinking efforts:
+
+Many people confuse prelink with a previous (and now obsolete) technique
+objprelink <http://freshmeat.net/projects/objprelink/>. Objprelink1 was first
+used as an optimization technique for KDE, but is now obsolete with the newer
+version of binutils that use combreloc. combreloc is now enabled by default in
+binutils. There is a newer version of objprelink (objprelink2) but according to
+the authors of objprelink, the technique does not provide any significant speed
+improvements over combreloc. Also objprelink2 does not work with gcc-3.x based
+compilers.
+
+Installing libelf:
+
+	./configure --prefix=/usr --enable-shared
+	make all install
+
+Installing prelink:
+
+	./configure --prefix=/usr
+	make all install
+
+Creating /etc/prelink.conf:
+
+The configuration file used by prelink is /etc/prelink.conf. It is to be
+populated by directories where your binaries and applications are located. In
+the following, replace DIRS by the list of directories you want prelink to
+search automatically.
+	DIRS="/bin /lib /sbin /usr /opt"
+	for i in $DIRS; do echo "-l $i"; done > /etc/prelink.conf
+
+Prelinking, the real deal:
+
+Check out the man page for prelink to get familiar with the various options that
+prelink accepts.
+
+I use the following steps for prelinking.
+
+Prelink has an undo option to revert the system back to a pre-prelink stage. But
+if you are paranoid, make a backup of the files that will be modified by prelink
+by performing a dry run. For the record, I don't:-)
+	cd /var/tmp
+	prelink -vnamRf 2>/dev/null > dry-run
+	cat dry-run | grep "Would prelink" | sed -e "s:Would prelink ::" > bkup
+	for f in `cat bkup`
+	do
+		d=`dirname ${f}`
+		install -d /var/tmp${d}
+		cp -Lv $f /var/tmp${f}
+	done
+
+Now do the actual prelinking.
+	prelink -vamRf 2>&1 > log
+
+Remember that you need to re-prelink the binaries on every upgrade. I use the
+following script which is run by cron:
+	if [ -f /var/lib/misc/runPrelink ]
+	then
+		prelink -au
+		prelink -vamRf --ld-library-path=/usr/lib/mozilla
+		rm -f /var/lib/misc/runPrelink
+	fi
+The /var/lib/misc/runPrelink file is created each time a package is upgraded on
+my system.
+
+
+Don't forget to send me bug reports and enhancements so that I can keep the hint
+updated.

Deleted: trunk/PREVIOUS_FORMAT/prelink.txt
===================================================================
--- trunk/PREVIOUS_FORMAT/prelink.txt	2005-03-26 00:00:24 UTC (rev 947)
+++ trunk/PREVIOUS_FORMAT/prelink.txt	2005-03-27 05:05:27 UTC (rev 948)
@@ -1,151 +0,0 @@
-TITLE:		Prelinking
-
-LFS VERSION:	glibc-2.3+ based LFS
-
-AUTHOR:         Tushar Teredesai <Tushar at LinuxFromScratch.Org>
-
-SYNOPSIS:
-	Use prelinking - the official way to optimize!
-
-HINT:
-
-Primary Location of this hint:
-        http://www.linuxfromscratch.org/~tushar/
-The latest version of the hint and any relevant patches are available at that
-site. Please refer to the primary location before submitting
-bug-reports/enhancements to this hint.
-
-You may freely copy this document or create derivate works or distribute the
-document in any format. At your discretion, you may give credit to the original
-author:)
-
-Use the hint at your own risk. Neither the author, nor the Linux From Scratch
-project accept any responsibility for anything that happens when using these
-documents or associated files.
-
-An appropriate place to discuss this hint is blfs-support MailingList/NewsGroup
-at LinuxFromScratch.Org. I welcome bug reports but for support requests, please
-use the support list.
-
-Change Log:
-[2003-03-05]
-	* Added explaination for objprelink (which many confuse with prelink).
-	* Added a cron script to run prelink periodically.
-	* Added note that making a backup is optional.
-[2003-03-02]
-	* Added -f flag to force prelink.
-[2002-12-25]
-        * Changed primary location and e-mail address.
-[2002-10-24]
-	* First public version.
-
-Pre-requisites (post LFS):
-	* libelf - 0.8.2
-		<http://freshmeat.net/projects/libelf/>
-
-Packages to download:
-	* prelink - 20021002
-		<http://freshmeat.net/projects/prelink/>
-
-WARNING:
-* I have tested the hint on a glibc-2.3.1 system. Check out the lfs-dev archives
-  since October 2002 for how to upgrade to glibc-2.3.1.
-* Prelinking *can* mess up your system. So make appropriate backups.
-* Don't try to prelink during the chroot phase.
-
-What is prelinking? (From the horse's mouth - the man page)
-
-prelink is a program which modifies ELF shared libraries and ELF dynamically
-linked binaries, so that the time which dynamic linker needs for their
-relocation at startup significantly decreases and also due to fewer relocations
-the run-time memory consumption decreases too (especially number of unshareable
-pages). Such prelinking information is only used if all its dependant libraries
-have not changed since prelinking, otherwise programs are relocated normally.
-
-prelink first collects ELF binaries which should be prelinked and all the ELF
-shared libraries they depend on. Then it assigns a unique virtual address space
-slot for each library and relinks the shared library to that base address. When
-the dynamic linker attempts to load such a library, unless that virtual address
-space slot is already occupied, it will  map it into the given slot. After this
-is done, prelink with the help of dynamic linker resolves all relocations in the
-binary or library against its dependant libraries and stores the relocations
-into the ELF object. It also stores a list of all dependant libraries together
-with their checksums into the binary or library. For binaries, it also computes
-a list of conflicts (relocations which resolve differently in the binary's
-symbol search scope than in the smaller search scope in which the dependant
-library was resolved) and stores it into a special ELF section.
-
-At runtime, the dynamic linker first checks whether all dependant libraries were
-successfully mapped into their designated address space slots and whether they
-have not changed since the prelinking was done. If all checks are successful,
-the dynamic linker just replays the list of conflicts (which is usually
-significantly shorter than total number of relocations) instead of relocating
-each library.
-
-Previous prelinking efforts:
-
-Many people confuse prelink with a previous (and now obsolete) technique
-objprelink <http://freshmeat.net/projects/objprelink/>. Objprelink1 was first
-used as an optimization technique for KDE, but is now obsolete with the newer
-version of binutils that use combreloc. combreloc is now enabled by default in
-binutils. There is a newer version of objprelink (objprelink2) but according to
-the authors of objprelink, the technique does not provide any significant speed
-improvements over combreloc. Also objprelink2 does not work with gcc-3.x based
-compilers.
-
-Installing libelf:
-
-	./configure --prefix=/usr --enable-shared
-	make all install
-
-Installing prelink:
-
-	./configure --prefix=/usr
-	make all install
-
-Creating /etc/prelink.conf:
-
-The configuration file used by prelink is /etc/prelink.conf. It is to be
-populated by directories where your binaries and applications are located. In
-the following, replace DIRS by the list of directories you want prelink to
-search automatically.
-	DIRS="/bin /lib /sbin /usr /opt"
-	for i in $DIRS; do echo "-l $i"; done > /etc/prelink.conf
-
-Prelinking, the real deal:
-
-Check out the man page for prelink to get familiar with the various options that
-prelink accepts.
-
-I use the following steps for prelinking.
-
-Prelink has an undo option to revert the system back to a pre-prelink stage. But
-if you are paranoid, make a backup of the files that will be modified by prelink
-by performing a dry run. For the record, I don't:-)
-	cd /var/tmp
-	prelink -vnamRf 2>/dev/null > dry-run
-	cat dry-run | grep "Would prelink" | sed -e "s:Would prelink ::" > bkup
-	for f in `cat bkup`
-	do
-		d=`dirname ${f}`
-		install -d /var/tmp${d}
-		cp -Lv $f /var/tmp${f}
-	done
-
-Now do the actual prelinking.
-	prelink -vamRf 2>&1 > log
-
-Remember that you need to re-prelink the binaries on every upgrade. I use the
-following script which is run by cron:
-	if [ -f /var/lib/misc/runPrelink ]
-	then
-		prelink -au
-		prelink -vamRf --ld-library-path=/usr/lib/mozilla
-		rm -f /var/lib/misc/runPrelink
-	fi
-The /var/lib/misc/runPrelink file is created each time a package is upgraded on
-my system.
-
-
-Don't forget to send me bug reports and enhancements so that I can keep the hint
-updated.

Added: trunk/prelink.txt
===================================================================
--- trunk/prelink.txt	2005-03-26 00:00:24 UTC (rev 947)
+++ trunk/prelink.txt	2005-03-27 05:05:27 UTC (rev 948)
@@ -0,0 +1,130 @@
+AUTHOR:	Robert Connolly <robert at linuxfromscratch.org>
+	Tushar Teredesai <Tushar at LinuxFromScratch.Org>
+
+DATE: 2005-03-26
+
+LICENSE: GNU Free Documentation License version 1.2
+
+SYNOPSIS: ELF shared library prelinking.
+
+DESCRIPTION:
+>From 'man 8 prelink':
+Prelink is a program which modifies ELF shared libraries and ELF dynamically linked
+binaries, so that the time which dynamic linker needs for their relocation at startup
+significantly decreases and also due to fewer relocations the run-time memory
+consumption decreases too (especially number of unshareable pages). Such prelinking
+information is only used if all its dependant libraries have not changed since
+prelinking, otherwise programs are relocated normally.
+
+PREREQUISITES: LFS-6.0
+This should be alright with HLFS Glibc too.
+
+HINT:
+
+Homepage: http://freshmeat.net/projects/prelink/
+
+- First of all, never strip (or otherwise modify) programs or libraries after they are
+prelinked. If you strip a prelinked program, the prelink application will not undo it
+because it has been modified. Even if a program is already stripped and you strip it
+again this will change the timestamp on the ELF header sections. If you want to strip
+all your programs after they are prelinked, first undo the prelinking with 'prelink -au'.
+
+- Secondly you need at least 50 megabytes of freespace to prelink the whole system. If
+you do not have that much free space then only do a few programs at a time.
+
+- Thirdly, if you plan to use the X11 windowing system with prelinking you should install
+a position independent version of libGL.so. By default the libGL.so library that is
+included with X11 is not a true shared object, it does not use shared memory, and can
+not be prelinked (so nothing linked to it can be prelinked either). It is suggested
+that you install a patch to make libGL.so use position independent assembly code:
+
+http://www.linuxfromscratch.org/patches/downloads/xorg/xorg-6.8.2-libGL_PIC-1.patch
+
+And use these command in the xc/ directory to use -fPIC on libGL.so:
+
+echo "#undef BuildLibGlxWithoutPIC" >> config/cf/linux.cf &&
+echo "#define BuildLibGlxWithoutPIC NO" >> config/cf/linux.cf
+
+libOSMesa.so is also not position independent, but there is no strait forward way to
+remedy this. Nothing I know of links to this library, so it shouldn't cause a problem.
+
+If you use a binary version of libGL.so, like the ones shipped by ATI for their 3D
+driver, then you are screwed. You can however still use prelink for everything else.
+
+- Finally install the software. Prelink depends on libelf, so fetch:
+
+ftp://people.redhat.com/jakub/prelink/prelink-20041123.tar.bz2
+and
+http://www.mr511.de/software/libelf-0.8.5.tar.gz
+
+Install libelf like this:
+
+./configure --prefix=/usr --enable-shared &&
+make &&
+make install
+
+Install prelink like this:
+
+./configure --prefix=/usr --sysconfdir=/etc &&
+make &&
+make install &&
+install -m644 doc/prelink.conf /etc/prelink.conf
+
+If you use /opt you should add it to the config file like this:
+
+echo "-l /opt/bin" >> /etc/prelink.conf
+
+You might want to edit the /etc/prelink.conf file.
+
+Prelink has an undo option to revert the system back to a pre-prelink stage. But
+if you are paranoid, make a backup of the files that will be modified by prelink
+by performing a dry run. For the record, I don't:-)
+	cd /var/tmp
+	prelink -vnamRf 2>/dev/null > dry-run
+	cat dry-run | grep "Would prelink" | sed -e "s:Would prelink ::" > bkup
+	for f in `cat bkup`
+	do
+		d=`dirname ${f}`
+		install -d /var/tmp${d}
+		cp -Lv $f /var/tmp${f}
+	done
+
+Then actually prelink everything. If you want random addresses use -R too:
+
+prelink -am
+
+If you get errors about libz.so make sure to use -fPIC in your CFLAGS and install
+zlib again (like the LFS book says). Then rerun 'prelink -am'.
+
+KDE knows about prelinking and it'll start faster if you tell it you have it. It's best
+to stick this in where all the users can use it. X.sh is a good place if you use the
+BLFS shell scripts, or else use /etc/profile or something:
+
+echo "export KDE_IS_PRELINKED=1" >> /etc/profile.d/X.sh
+
+You should read 'man 8 prelink' too.
+
+If you want to read the Gentoo stuff go here:
+
+http://www.gentoo.org/doc/en/prelink-howto.xml
+
+- Previous prelinking efforts:
+http://objprelink.sourceforge.net/
+
+Many people confuse prelink with a previous (and now obsolete) technique objprelink.
+Objprelink1 was first used as an optimization technique for KDE, but is now obsolete
+with the newer version of binutils that use combreloc. combreloc is now enabled by
+default in binutils. There is a newer version of objprelink (objprelink2) but according
+to the authors of objprelink, the technique does not provide any significant speed
+improvements over combreloc. Also objprelink2 does not work with gcc-3.x based compilers.
+
+ACKNOWLEDGMENTS:
+  * Thanks to Jakub Jelinek for making the prelink(8) program.
+  * Thanks to Google and Debian for helping me figure out how to fix X11.
+  * Thanks to Gentoo for pointers on setting up prelink.
+
+CHANGELOG:
+[2005-03-23]
+  * Initial hint.
+[2005-03-26]
+  * Adopted prelink.txt from Tushar, merged the two.




More information about the hints mailing list