LFS Tweaks

This is a small web page listing some LFS tweaks that I use. Look at the official LFS home page for more information.

Thanks to Gerard Beekmans for creating a truly awesome project.

I'm using the CVS version of LFS with the main focus on the toolchain (gcc, glibc, binutils etc). If you have anything to say about this page then please mail me.

Availability

The patches mentioned on this page can be found here.

Some of these patches will soon become obsolete as newer versions of the packages are released.

I take no credit for any of these patches apart from making the effort to hack them together from various sources like cvs repositories and mailing lists.

Disclaimer

Use these tweaks at your own risk. I have tested them quite thoroughly and found them to be useful. If you try any of these tweaks and your system breaks, you get to keep both pieces.

Changelog

29 August 2002
24 August 2002
12 August 2002

The Tweaks


glibc-2.2.5 "errlist" fix        (Category - Essential build fix)        (Source - glibc cvs glibc-2-2-branch)
glibc-2.2.5 fails to build with gcc-3.2 unless this patch is applied. Read some background to this issue starting here. Grab the patch here.

glibc-2.2.5 "dns resolver" fix        (Category - Essential security fix)        (Source - glibc cvs glibc-2-2-branch)
There is a dns related security vulnerability in glibc-2.2.5. Read some background to this issue starting here. Grab the patch here.

glibc-2.2.5 "xdr_array" fix        (Category - Essential security fix)        (Source - glibc cvs glibc-2-2-branch)
There is an integer overflow related security vulnerability in glibc-2.2.5. Read some background to this issue starting here. Grab the patch here.

glibc-2.2.5 "calloc" fix        (Category - Essential security fix)        (Source - glibc cvs glibc-2-2-branch)
There is a memory allocation related security vulnerability in glibc-2.2.5. Read some backgound to this issue starting here. Grab the patch here.

glibc-2.2.5 "thread exit" fix        (Category - Recommended bug fix)        (Source - glibc cvs glibc-2-2-branch)
Thread exit handling is broken in glibc-2.2.5. Read some background to this issue starting here. Grab the patch here.

glibc-2.2.5 "udivdi3" fix        (Category - Recommended bug fix)        (Source - glibc cvs glibc-2-2-branch)
Some old binaries won't run (mostly vendor supplied closed source). Read some background to this issue starting here and here. Grab the patch here.

glibc-2.2.5 "math test" fix        (Category - Optional bug fix)        (Source - glibc cvs HEAD)
glibc's "make check" fails 2 math tests. Read some background to this issue starting here. Grab the patch here.

glibc-2.2.5 "restrict_arr" fix        (Category - Optional bug fix)        (Source - glibc cvs HEAD)
Building glibc with gcc-3.2 generates some ugly compiler warnings. Read some backgound to this issue starting here. Grab the patch here.

glibc-2.2.5 "divbyzero" fix        (Category - Optional bug fix)        (Source - glibc cvs HEAD)
Building glibc with gcc-3.2 generates some ugly compiler warnings. Read some backgound to this issue starting here. Grab the patch here.

glibc-2.2.5 "mega" patch
All of the above glibc patches combined into one, nice, easy to download patch. Grab the patch here.

glibc-2.2.5 "enable kernel" tweak        (Category - Optional performance tweak)
glibc contains a lot of compatibility cruft to cope with older kernels. Read some background to this issue starting here. Simply add the following command to your glibc configure line:-
--enable-kernel=current
The result will be a leaner and meaner glibc (but one that won't run on kernels older than what you were running when building glibc).

glibc-2.2.5 "disable profile" tweak        (Category - Optional build tweak)
When was the last time you profiled glibc? Right. You'll know if you need the profiling libs or not. Read some background to this issue starting here. Simply add the following command to your glibc configure line:-
--disable-profile
The result will be a quicker build time and less cruft in /usr/lib.




gcc-3.2 "HAVE_GAS_HIDDEN" workaround        (Category - Essential build fix)
glibc's "make check" fails the "tstcxaatexit" test. Read some background to this issue starting here and here. The cause is due to gcc's configure script failing to detect that our binutils assembler has ".hidden" support. The result is that our chapter 5 gcc is broken and we use this faulty gcc to build our glibc which results in that being broken as well. The fix is to add a simple one-liner to the gcc-3.2 build instructions for chapter 5. Insert the following line after the configure command but before the make command:-
echo "#define HAVE_GAS_HIDDEN 1" >> gcc/auto-host.h &&
You don't need to do this in Chapter 6 as gcc-3.2's configure will now correctly detect our binutils.

gcc-3.2 "copy" fix        (Category - Essential bug fix)        (Source - H. J. Lu)
gcc-3.2 silently mis-compiles code in certain circumstances. Read some background to this issue starting here and here. Grab the patch here.

gcc-3.2 "var" fix        (Category - Recommended bug fix)        (Source - H. J. Lu)
gcc-3.2 silently mis-compiles code in certain circumstances. Read some background to this issue starting here. Grab the patch here.

gcc-3.2 "cxa_atexit" tweak        (Category - Recommended build tweak)
For proper ABI compatibility gcc-3.2 must be built with the correct configure switches. Read some background to this issue starting here. Simply add the following command to your Chapter 6 gcc configure line:-
--enable-__cxa_atexit
This will result in C++ shared libraries and C++ programs that are interoperable with other linux distributions.

WARNING! - gcc-3.1 and above is known to mis-compile some code at -march=i686 and above. Please keep this in mind before trying the 2 tweaks below. You have been warned! But please note, the 2 gcc fixes mentioned above have been proven to correct any known issues at this time.


gcc-3.2 "default arch" hack
       (Category - Optional performance tweak)        (Source - I'd rather not say :-)
gcc-3.2 outputs "i386" instructions by default (ie: when no -march flag is passed). You can easily remedy this less than ideal situation! Read some background to this issue starting here and here. Grab the patch here.

gcc-3.2 "configure defaults" tweak        (Category - Highly experimental build tweak - not recommended)        (Source - Daniel Jacobowitz)
Use this experimental patch to change gcc's defaults for -march= and -mcpu= at configure time. Read some background to this issue starting here. Grab the patch here. For example, you could add the following commands to your gcc configure line:-
--with-arch=pentium2 --with-cpu=pentium3
This will result in your gcc compiling for -march=pentium2 -mpcu=pentium3 by default (ie: when no -march or -mcpu flags are passed).

Last modified by gschafer@zip.com.au on 29 August 2002