PATCH: Fix TLS build

H . J . Lu hjl@lucon.org
Fri Jun 14 11:09:00 GMT 2002


When your binutils supports TLS, but you don't enable LDT, you
will get

td_thr_tls_get_addr.c: In function `td_thr_tls_get_addr':
td_thr_tls_get_addr.c:46: structure has no member named `l_tls_modid'
td_thr_tls_get_addr.c:35: warning: `modid' might be used uninitialized in this
f

Here is a patch. BTW, thers is no need to include "tls.h". "link.h"
does that already.

H.J.
-------------- next part --------------
2002-06-14  H.J. Lu  <hjl@gnu.org>

	* td_thr_tls_get_addr.c: Don't include "tls.h".
	Return TD_ERR if USE_TLS is not defined.

--- libc/linuxthreads_db/td_thr_tls_get_addr.c.tls	Wed Jun 12 14:00:23 2002
+++ libc/linuxthreads_db/td_thr_tls_get_addr.c	Fri Jun 14 11:00:46 2002
@@ -21,16 +21,17 @@
 
 #include "link.h"
 #include "thread_dbP.h"
-#include "tls.h"
 
 /* Value used for dtv entries for which the allocation is delayed.  */
 # define TLS_DTV_UNALLOCATED	((void *) -1l)
 
 
 td_err_e
-td_thr_tls_get_addr (const td_thrhandle_t *th, struct link_map *map,
-		     size_t offset, void **address)
+td_thr_tls_get_addr (const td_thrhandle_t *th __attribute_used__,
+		     struct link_map *map __attribute_used__,
+		     size_t offset, void **address __attribute_used__)
 {
+#ifdef USE_TLS
   struct _pthread_descr_struct pds;
   size_t modid;
   union dtv pdtv;
@@ -59,4 +60,7 @@ td_thr_tls_get_addr (const td_thrhandle_
   *address = (char *) pdtv.pointer + offset;
 
   return TD_OK;
+#else
+  return TD_ERR;
+#endif
 }


More information about the Libc-alpha mailing list