This is the mail archive of the mailing list for the libc-ports project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] fix building linuxthreads with tls support for i[45]86 hosts (BZ674)

if you try and build glibc-2.3.6 with linuxthreads and with tls support 
enabled for an i486 or i586 target, the build fails

"Nix" investigated the issue in the mentioned bug report and the attached 
patch is the result ... just compile tested and some basic runtime tests in 
The i686 pt-machine.h includes useldt.h so that USE_TLS/HAVE___THREAD are
properly defined.  The generic i386 pt-machine.h header does not pull in
useldt.h however, so when building linuxthreads with TLS support for i586,
the final fails:
linuxthreads/libpthread_pic.a(pthread.os)(.text+0x161): In function `__pthread_initialize':
: undefined reference to `_res'
linuxthreads/libpthread_pic.a(pthread.os)(.text+0x107a): In function `__pthread_reset_main_thread':
: undefined reference to `_h_errno'
linuxthreads/libpthread_pic.a(pthread.os)(.text+0x1089): In function `__pthread_reset_main_thread':
: undefined reference to `_errno'

So, to reiterate, this is due to some parts of linuxthreads being incorrectly
built without the TLS defines.

2006-04-24  Mike Frysinger  <>

	* sysdeps/i386/pt-machine.h: Include kernel-features.h.
	[__ASSUME_LDT_WORKS]: Include useldt.h.

--- linuxthreads/sysdeps/i386/pt-machine.h
+++ linuxthreads/sysdeps/i386/pt-machine.h
@@ -26,6 +26,7 @@
 #ifndef PT_EI
 # define PT_EI extern inline __attribute__ ((always_inline))
+#include "kernel-features.h"
 extern long int testandset (int *spinlock);
 extern int __compare_and_swap (long int *p, long int oldval, long int newval);
@@ -105,4 +106,8 @@ compare_and_swap_is_available (void)
 #endif /* __ASSEMBLER__ */
+#include "useldt.h"
 #endif /* pt-machine.h */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]