Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#1485 - NPTL glibc with 2.4 kernel fallback support

Attached to Project: Arch Linux
Opened by Jan de Groot (JGC) - Monday, 20 September 2004, 21:48 GMT
Last edited by Judd Vinet (judd) - Monday, 20 September 2004, 22:18 GMT
Task Type Feature Request
Category Packages: Current
Status Closed
Assigned To Judd Vinet (judd)
Architecture not specified
Severity High
Priority Normal
Reported Version 0.7 Wombat
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

Currently, we have two glibc packages, each with different kernelheaders included in /usr/include. One comes with linuxthreads, the other with NPTL.

I built a package that contains both glibcs and that uses the NPTL version on 2.6 kernels, while automatically switching to the linuxthreads version for the 2.4 kernel. This support has been included upstream in glibc 2.3.3, and has been in use for a while in Debian, Redhat, Mandrake and SuSE.

The solution is simple: place the linuxthreads glibc in /lib, place the NPTL/TLS glibc in /lib/tls. ldconfig will search in /lib/tls first, and switches to /lib if it can't use the libraries in /lib/tls (when a 2.4 kernel is installed that is).

Here's an example:
[root@lappie ~]# getconf GNU_LIBPTHREAD_VERSION
NPTL 0.60

[root@lappie ~]# LD_ASSUME_KERNEL=2.4.0 getconf GNU_LIBPTHREAD_VERSION
linuxthreads-0.10

[root@lappie ~]# ldd /bin/bash | grep libc.so.6
libc.so.6 => /lib/tls/libc.so.6 (0x4006a000)

[root@lappie ~]# LD_ASSUME_KERNEL=2.4.0 ldd /bin/bash | grep libc.so.6
libc.so.6 => /lib/libc.so.6 (0x4006a000)

These examples shows the libc6 switching for different architectures works.

The updated PKGBUILD and the binary version of this package can be found at ftp://schoolbak.dyndns.org/nptl/

Another thing I found out during this:
the VIA C3 is an i686 CPU without CMOV instructions, which causes them to fail on archlinux. There's a patch around that switches back to i586 when CMOV on a i686 CPU isn't found. Maybe it's also nice to patch this thing into glibc and provide an i586 glibc tarball that gets placed in /lib/i586 and /lib/tls/i586 to support these CPUs (glibc uses CMOV instructions when optimized for i686)
This task depends upon

Closed by  Judd Vinet (judd)
Tuesday, 21 September 2004, 19:21 GMT
Reason for closing:  Implemented
Comment by Judd Vinet (judd) - Monday, 20 September 2004, 22:24 GMT
Ah, that's a nice solution.

What about header files? Do you use headers from the linux-libc-headers tarball, or from the vanilla kernel source? And are the headers usable (ie, you can build with them) on both kernel versions?
Comment by Judd Vinet (judd) - Monday, 20 September 2004, 22:34 GMT
nm, I see you use the linux-libc-headers still.

Can 2.4 users build with them?
Comment by Jan de Groot (JGC) - Tuesday, 21 September 2004, 07:18 GMT
The linux-libc headers project was a project to get some nice sanitized headers in /usr/include. Putting the 2.6 kernelheaders in there breaks many programs because of changes between 2.4 and 2.6 kernels, so I think userspace applications will compile with these headers.

The linux-libc header tarball that gets pulled in the glibc PKGBUILD should match the running kernelversion where glibc is built on. Since my build machine runs 2.6.8.1, I use 2.6.8.1 version of linux-libc-headers. This way, any assumtions made in glibc about kernel versions and its headers will stay in sync (if you build on 2.6.7, you need the linux-libc-headers 2.6.7 to get a good build).

The only problem with these headers is that they decided userspace programs shouldn't include <linux/config.h>. To deny them from including that file, they put ##error in that file. The errormessage points to a FAQ where it states this, it also says package maintainers of distributions may want to empty the file, so that's what I do in the echo "" > $startdir/pkg/usr/include/config.h
Comment by Judd Vinet (judd) - Tuesday, 21 September 2004, 15:59 GMT
Okay. Thanks a lot, Jan. I'll play with it for a bit. Have you tested it on a 2.4.x kernel yet?
Comment by Jan de Groot (JGC) - Tuesday, 21 September 2004, 17:47 GMT
I haven't tested it with 2.4.x, but this is the same system that debian, suse, redhat and mandrake uses. I tested at least one of those with a 2.4 kernel.

Also, try using LD_ASSUME_KERNEL=2.4.0 /bin/bash on the current NPTL glibc: it will complain about not being able to find ld-linux.so
Comment by Judd Vinet (judd) - Tuesday, 21 September 2004, 19:21 GMT
There's a glibc package in Testing now that uses your PKGBUILD.

Loading...