Gentoo Archives: gentoo-dev

From: Duncan <1i5t5.duncan@×××.net>
To: gentoo-dev@l.g.o
Cc: gentoo-amd64@l.g.o
Subject: [gentoo-dev] Re: why I do not have /usr/lib/tls on my gentoo?
Date: Fri, 19 Jun 2009 10:15:22
Message-Id: pan.2009.06.19.10.10.21@cox.net
1 David Shen <davidshen84@××××××××××.com> posted
2 53e35fd50906190041j35d95488lbcf3c7eb1efa87fb@××××××××××.com, excerpted
3 below, on Fri, 19 Jun 2009 15:41:30 +0800:
4
5 > I am trying to install Xen VM on my gentoo 2008 x64. According to what
6 > http://en.gentoo-wiki.com/wiki/Xen said, I should run "mv /usr/lib/tls
7 > /usr/lib/tls.disabled" and re-compile glibc and gcc to disable the 'tls'
8 > feature. But I found that my system *DOES NOT* have the /usr/lib/tls
9 > file/directory. Does this changed its place, or this prerequisite does
10 > not apply to x64 system?
11
12 First, note for future reference that "x64" is a rather ambiguous term,
13 as it's (AFAIK) unofficial and could be equally argued to apply to
14 Intel's ia64 aka "itanium" aka "itanic" architecture or to AMD's amd64
15 aka x86_64 architecture. Of course, this list is for the amd64 arch and
16 it can be assumed you are referring to that here, but as I said, for
17 future reference. =:^O
18
19 Meanwhile, to your question: I don't do xen but based on my knowledge of
20 Gentoo and Linux history from the 2004 time frame, that doesn't apply to
21 a modern Gentoo Linux system.
22
23 "tls" refers to "thread local storage".
24
25 I'm somewhat confused on the exact relationships (whether tls was the
26 nptl on or off version, a google produced some hints that it was the nptl
27 on version, but nothing definitive), but tls was related to nptl, "native
28 posix thread library", which was introduced by Red Hat back in 2002 and
29 was just becoming a big thing on Gentoo about the time I switched to
30 Gentoo around May, 2004. Prior to that, Linux had normally used Linux
31 threads for threading. However, Linux-threads was Linux-only and wasn't
32 entirely POSIX compatible, among other issues. NPTL was higher
33 performing, and gradually took over and became the standard, both due to
34 the better performance and because it WAS POSIX compliant and therefore
35 made easier porting between Linux and the BSDs and various UNIX variants.
36
37 NPTL did/does require either a 2.6 kernel or a patched 2.4 kernel, and
38 was supported by glibc. Just checking the older glibc versions still in
39 the tree, thru glibc 2.5*, the Gentoo glibc ebuilds have the nptl and
40 nptlonly USE flags. With glibc 2.6, Gentoo was apparently dropping
41 mainline kernel 2.4 support and nptl (and nptlonly) apparently became the
42 un-USE-flagged default.
43
44 Anyway, back when glibc was built for both nptl and linux-threads,
45 /usr/lib/tls contained one version, while the other was in the standard
46 /lib and /usr/lib locations (where lib means lib64 on amd64, with an
47 equivalent 32-bit version for multilib users).
48
49 BTW, x86(32) and amd64 no-multilib users now build glibc only once, while
50 amd64 multilib users (the default) build it twice, once for 32-bit and
51 once for 64-bit. During the linux-threads/nptl both era, that was
52 doubled, so amd64 multilib users were actually building glibc four times,
53 one each for nptl and linux-threads, for each of 32-bit and 64-bit! No
54 WONDER emerging glibc seemed to take so long back then!
55
56 So assuming you're using a 2.6 kernel and glibc >= 2.6 as well,
57 /usr/lib(64)/tls should not exist, unless for some reason it wasn't
58 removed properly during whatever glibc emerge would have gotten rid of it
59 (the first 2.6 version if users hadn't been running USE=nptl nptlonly,
60 the first glibc emerge after they switched to those USE flags if they did
61 run them). The same should apply to the corresponding 32-bit libdir, for
62 those still running multilib (I'm running no-multilib and don't remember
63 where the 32-bit dir was, anymore).
64
65 Thus, apparently that step of the the xen guide is either still around
66 for the legacy installs still using old glibc versions, or it's there to
67 ensure people remove the dir if it's unused cruft that didn't get cleaned
68 up properly for whatever reason. Since you don't have that dir, you
69 shouldn't have to worry about it.
70
71 Here's some wikipedia links that should serve as beginning points for
72 further research, if you're curious:
73
74 http://en.wikipedia.org/wiki/Thread-local_storage
75 http://en.wikipedia.org/wiki/Nptl
76 http://en.wikipedia.org/wiki/LinuxThreads (stub article)
77
78 --
79 Duncan - List replies preferred. No HTML msgs.
80 "Every nonfree program has a lord, a master --
81 and if you use the program, he is your master." Richard Stallman