Creating custom kernels seems popuplar but I decided to be a bit different an created my own glibc ebuild instead.
It's currently based on up to date glibc-2.3.6-r2 and 2.3.5.20050722 ebuilds but it also includes this (more details below):
AMD64 performance enhancements:
* AMD64 optimized libm. (included in portage since 2.3.6-r3)
* AMD64 optimized string routines. (included in portage since 2.3.6-r3)
Generic enhancements
* --enable-kernel bumped to 2.6.9 (2.3.6-r2) or 2.6.11 (2.3.90.2005XXXX). (included in portage since 2.3.6-r3)
* Added back the nomalloccheck USE-flag.
* Updated fedora tarball (2.3.90.2005XXXX only).
* Gcc4 ssp/fortify support controlled by a gcc4ssp USE (2.3.90.2005XXXX only).
* Various fixes to make this build and work. (2.3.90.2005XXXX only).
* Binutils -Bdirect support for faster dynamic loading of libraries. (included in portage since 2.3.6-r3 but disabled by default)
* Binutils -Hashvals support (requires patches binutils) (included in portage since 2.3.6-r3 but disabled by default)
You can do a diff betwen my ebuild and the ebuild in portage to see what I've changed. Any suggestions are welcome!
How do I use it?
1. Download the overlay from http://snigel.no-ip.com/~nxsty/linux/gl ... ay.tar.bz2 or http://enderandrew.com/nxsty/glibc-overlay.tar.bz2 or http://www.kriga.net/dl/glibc/glibc-overlay.tar.bz2.
2. Untar it in /usr/local/portage/sys-libs
3. Edit make.conf and make sure you have PORTDIR_OVERLAY="/usr/local/portage"
4. Backup your old glibc with quickpkg
(5.) If you are on x86 you should switch to gcc 3.4 first. Run gcc-config and source /etc/profile to make sure it's used.
(6.) If you are using stable you need to unmask =sys-libs/glibc-2.3.6-r2 and sys-libs/timezone-data in /etc/portage/package.keywords. If you want to try the 2.3.90.2005XXXX ebuild you need to unmask it with -*. Binutils 2.16.1-r1 is also needed if you want to try -Bdirect.
7. emerge glibc
No rebuilding or anything is needed and there should be no problems bootstraping with this glibc.
AMD64 performance enhancements:
These comes from an Mandriva SRPM from their latest 2006 release and they took them from Suse but they origin from AMD in the first place. The progress of getting these patches included in portage can be tracked in bug #100289.
*AMD64 optimized libm.
Contains an updated and optimized math library for AMD64 CPUs. Improvements can be seen in Seti@home and the Gimp for example, or anything that uses libm.
*AMD64 optimized string routines.
Increases memory copy performance for AMD64. The improvements can be seen with a small test-program, memcpy.c, which is attatched to the bug (compile it with -O at least).
With the glibc 2.3.5 currently in gentoo:
isidor ~ # ./memcpy 2200 1000 1048576
Memory to memory copy rate = 1291.600098 MBytes / sec. Block size = 1048576.
With glibc 2.3.5 + amd64 optimized string routines:
isidor ~ # ./memcpy 2200 1000 1048576
Memory to memory copy rate = 2389.321777 MBytes / sec. Block size = 1048576.
That's an improvement of over 1000mb/s! Suse 9.3 and 10 also gives about 2300mb/s out of the box.
Generic enhancements
* --enable-kernel bumped to 2.6.9 or 2.611.
This prevents glibc from compiling in compatibility cruft making it leaner and meaner. Of course you need to be running a 2.6.9 or 2.6.11 kernel at least.
Added back the nomalloccheck USE-flag.
The nomalloccheck USE-flag was removed so I added it back. Having malloccheck on comes with a slight overhead and might prevent some buggy apps from running, a problem for binary only apps which you can't do much about. But there is a good reason it's on by default.
* Updated fedora tarball
Updated fedora add-ons from a Fedora SRPM.
* Gcc4 ssp support controlled by a gcc4ssp USE
The gcc4ssp USE-flag turns on SSP and fortify support. Only set this flag if you have a ssp/fortify capable gcc 4 since build will fail otherwise! It's based on chtephan's work. Works perfectly on x86, untested on other arches.
* Enabled building with binutils --as-needed
Enabled building with binutils --as-needed. This change got merged in glibc 2.3.5-r3 and later but the snapshot ebuilds still doesn't have it.
* Various fixes to make this build and work.
Patches from suse glibc-2.3.90-54.src.rpm.
* Binutils -Bdirect support for faster dynamic loading of libraries.
Adds support for the -Bdirect ld-flag to speed up dynamic loading of libraries (OpenOffice, Gnome, KDE for example). This flag breaks glibc so it's filtered out in the ebuild but I'm not sure if it breaks anything else. Why don't you help find out?
* Binutils -Hashvals support (requires patches binutils)
Adds support for the -Hashvals linker flag (another optimization). To use this you need to create your own overlay for binutils too with the patch from bug #114008. This feature is also experimental!
Questions and answers
Will this break my system?
Probably not, none of the changes are very risky and the amd64 patches are already included in stable releases of mandriva and suse. But you are using it at your own risk so don't blame me if it installs Windows ME or something.
dev-libs/apr fail to build against glibc 2.3.90
Run export ac_cv_func_pthread_mutexattr_setrobust_np=no before you emerge it.
I run modular X and are using -Bdirect and X fails to start
Recompile libXfont without -Bdirect to solve the problem.
I can't connect to snigel.no-ip.com!
Try one of the mirrors instead, they are synced once per day so they might be up to 24 h old:
http://enderandrew.com/nxsty/
http://www.kriga.net/dl/glibc/
What arches does it run on?
AMD64 and x86 are the primary arches because that's what I use but it should run on other arches as well. I tried to not break any of the other arches but I haven't tested it.
Are there any known problems?
A older version of the overlay caused some segfaults with nano and azureus. Make sure you run the latest if you have problems, then whine in this thread if it still doesn't work.
This patch also has problems building with a hardened GCC3 AMD64 toolchain. I don't know any good solutions to this except disabling it.
Is the changelog also included in the overlay?
Yes, check files/changelog.overlay.
Where does the patches come from?
See "AMD64 performance enhancements" above for the AMD64 patches. All patches except 2020 are the work of other people so kudos to them!
Build settings?
Anything should do but I've only tested this with nptl and nptlonly myself. But you might have problems building with the strings patch if you are on hardened or have -fstack-protector(-all) in your CFLAGS.
I recomend that you set the glibc-omitfp USE-flag, it builds all the libs twice, once with extra optimizations and once with the standard settings for debuging purposes. The optimized libraries are used by default. Using this USE-flag on a gcc4 system would normaly make your glibc big and slow but that's fixed in my overlay so now I recomend everyone to set this flag.
If you want to try the -Bdirect patch you need to install binutils 2.16.1-r1 (this exact version). Put -Wl,-Bdirect in your LDFLAGS to use it (after you emerged glibc and binutils with -Bdirect support)
If you want to try the -hashvals patch you need to create your own binutils overlay first. Then put -Wl,-hashvals in yout LDFLAGS. The binutils patch is in bug #114008.
Here is my emerge --info.
Testing
Any performance testing on AMD64 and especially on a nocona system is appreciated. If you see regressions try excluding the string routines patch.
Any testing restults related to the AMD64 patches should also be posted to bug #100289. But you don't need to post your memcpy results in the bug, there is already plenty of those.
Feedback about -Bdirect should go into bug #114008.
Changelog
2006-02-07
*Added a new snapshot. (2.3.90.20060207)
*The -Bdirect and -hashvals flags are supported in this snapshot. (2.3.90.20060207)
*New fedora tarball. (2.3.90.20060207)
*Fixed linuxthreads support. (2.3.90.20060207)
2006-02-02 (3)
*Updated the -Bdirect and -hasvals patches from suse (again
2006-02-02 (2)
*Updated the -Bdirect patch from suse (2.3.6-r2)
*Another new linker optimization from suse: -Wl,hashvals (requires binutils support, not yet in portage) (2.3.6-r2)
2006-02-02
*Synced with portage (2.3.6-r2)
2006-01-21 (2)
*Fixed the segaults problems by removing a broken file, as what's done in recent suse srpms. (2.3.6-r2 and 2.3.90.20060121)
2006-01-21
*New snapshot!
*Added back the -Bdirect patch to the 2.3.90 snapshot, apparently it got lost somwhere. (2.3.90.20060121)
*Removed a patch that clashes with -Bdirect. (2.3.90.20060121)
*Updated the ssp patch from portage. (2.3.6-r2)
2006-01-08 (2)
*Removed some left over digest files.
2006-01-08
*New snapshot, fixes a header problem (2.3.90.2060108)
*Updated the patchset, one of the patches had been partly merged.
*Fixed the ssp patch again.
*Removed the old snapshots.
2006-01-02
*New HEAD snapshot. (2.3.90.2060102)
*Updated fedora tarball. (2.3.90.2060102)
*The 20051211 snapshot is still included since it's known working.
*Synced with portage, now based on 2.3.6-r2 (2.3.6-r2)
2005-12-29 (2)
*Added back the 20051211 snapshot, the new one seems broken.
2005-12-29
*New HEAD snapshot. (2.3.90.20051229)
*Updated patches from suse. (2.3.90.20051229)
*Fixed the ssp patch to apply with the new branch update. (2.3.90.20051229)
*Synced with portage. (2.3.6-r1)
2005-12-13
*Fixed a problem with the ebuild accidently applying a patch that was supposed to be used with gcc4ssp only. (2.3.90.20051211)
2005-12-11 (2)
*Added a depend on dev-util/gperf, apparently it's needed for the build now. (2.3.90.20051211)
2005-12-11
*New HEAD snapshot (2.3.90.20051211)
*Added some linuxthreads updates so it should actually work now. (2.3.90.20051211)
2005-12-06
*Fixed the rejects on the -Bdirect patch and moved it to my patch-tarball (2.3.6-r1 and 2.3.90.20051201).
2005-12-05
*Synced with portage (2.3.6-r1 and 2.3.90.20051201).
*Added filter-flags for -Bdirect from LD- and CFLAGS.
*The -Bdirect patch is inlcuded but not applied since it rejects.
2005-12-01
*New snapshot. (2.3.90.20051201)
*Updated libidn from CVS. (2.3.90.20051201)
*Removed a upstream merged patch. (2.3.90.20051201)
2005-11-23 (2)
*Added a glibc header fix from Tiger683. (2.3.90.20051122)
2005-11-23
*Removed separate ssp patch for gcc4.
*New experimental ebuild: glibc-2.3.90.20051122:
*Based on the glibc-2.3.5.20050722 ebuild.
*Updated snapshot from HEAD.
*Enable kernel bumped to 2.6.11.
*Binutils --as-needed enabled for the build.
*The same AMD64 patches as in 2.3.6.
*Various patches to make this sucker build and work.
*Updated fedora tarball.
*Gcc 4 ssp support based on chtephan's work, controlled by a gcc4ssp USE-flag (Untested currently).
-- / / snip - see the changelog.overlay for the rest / / --
Happy gentooing!








