--- a/gcc/testsuite/lib/plugin-support.exp	Mon Nov 22 19:48:47 2010 +0100
+++ b/gcc/testsuite/lib/plugin-support.exp	Thu Nov 25 19:26:52 2010 +0100
@@ -84,7 +84,7 @@
     set gcc_objdir "$objdir/../../.."
     set includes "-I. -I${srcdir} -I${gcc_srcdir}/gcc -I${gcc_objdir}/gcc \
                   -I${gcc_srcdir}/include -I${gcc_srcdir}/libcpp/include \
-                  $GMPINC"
+                  $GMPINC -I${gcc_objdir}/intl"
 
     set optstr "$includes $extra_flags -DIN_GCC -fPIC -shared"
 
diff -r 1b55ce8ede18 gcc/doc/sourcebuild.texi
--- a/gcc/doc/sourcebuild.texi	Mon Nov 22 19:44:14 2010 +0100
+++ b/gcc/doc/sourcebuild.texi	Thu Nov 25 19:41:55 2010 +0100
@@ -1892,6 +1892,9 @@
 @item mips16_attribute
 @code{mips16} function attributes.
 Only MIPS targets support this feature, and only then in certain modes.
+
+@item tls
+Add the target-specific flags needed to use thread-local storage.
 @end table
 
 @node Require Support
diff -r 1b55ce8ede18 gcc/testsuite/g++.dg/tls/static-1.C
--- a/gcc/testsuite/g++.dg/tls/static-1.C	Mon Nov 22 19:44:14 2010 +0100
+++ b/gcc/testsuite/g++.dg/tls/static-1.C	Thu Nov 25 19:41:55 2010 +0100
@@ -1,6 +1,7 @@
 // { dg-do run }
 // { dg-options "-O2" }
 // { dg-require-effective-target tls_runtime }
+// { dg-add-options tls }
 // { dg-additional-sources "static-1a.cc" }
 
 extern "C" void abort ();
diff -r 1b55ce8ede18 gcc/testsuite/g++.dg/tls/static-1a.cc
--- a/gcc/testsuite/g++.dg/tls/static-1a.cc	Mon Nov 22 19:44:14 2010 +0100
+++ b/gcc/testsuite/g++.dg/tls/static-1a.cc	Thu Nov 25 19:41:55 2010 +0100
@@ -1,6 +1,7 @@
 // { dg-do run }
 // { dg-options "-O2" }
 // { dg-require-effective-target tls_runtime }
+// { dg-add-options tls }
 // { dg-additional-sources "static-1a.cc" }
 
 struct A
diff -r 1b55ce8ede18 gcc/testsuite/gcc.dg/tls/emutls-1.c
--- a/gcc/testsuite/gcc.dg/tls/emutls-1.c	Mon Nov 22 19:44:14 2010 +0100
+++ b/gcc/testsuite/gcc.dg/tls/emutls-1.c	Thu Nov 25 19:41:55 2010 +0100
@@ -1,5 +1,6 @@
 /* { dg-do run { target *-wrs-vxworks } } */
 /* { dg-require-effective-target tls } */
+/* { dg-add-options tls } */
 
 /* vxworks' TLS model requires no extra padding on the tls proxy
    objects.  */
diff -r 1b55ce8ede18 gcc/testsuite/gcc.dg/tls/opt-11.c
--- a/gcc/testsuite/gcc.dg/tls/opt-11.c	Mon Nov 22 19:44:14 2010 +0100
+++ b/gcc/testsuite/gcc.dg/tls/opt-11.c	Thu Nov 25 19:41:55 2010 +0100
@@ -1,5 +1,6 @@
 /* { dg-do run } */
 /* { dg-require-effective-target tls_runtime } */
+/* { dg-add-options tls } */
 
 extern void abort (void);
 extern void *memset (void *, int, __SIZE_TYPE__);
diff -r 1b55ce8ede18 gcc/testsuite/gcc.dg/tls/opt-12.c
--- a/gcc/testsuite/gcc.dg/tls/opt-12.c	Mon Nov 22 19:44:14 2010 +0100
+++ b/gcc/testsuite/gcc.dg/tls/opt-12.c	Thu Nov 25 19:41:55 2010 +0100
@@ -2,6 +2,7 @@
 /* { dg-do run } */
 /* { dg-options "-O2 -fpic" } */
 /* { dg-require-effective-target tls_runtime } */
+/* { dg-add-options tls } */
 /* { dg-require-effective-target fpic } */
 
 extern void abort (void);
diff -r 1b55ce8ede18 gcc/testsuite/gcc.dg/tls/pr24428-2.c
--- a/gcc/testsuite/gcc.dg/tls/pr24428-2.c	Mon Nov 22 19:44:14 2010 +0100
+++ b/gcc/testsuite/gcc.dg/tls/pr24428-2.c	Thu Nov 25 19:41:55 2010 +0100
@@ -1,6 +1,7 @@
 /* { dg-do run } */
 /* { dg-options "-O2" } */
 /* { dg-require-effective-target tls_runtime } */
+/* { dg-add-options tls } */
 
 __thread double thrtest[81];
 int main ()
diff -r 1b55ce8ede18 gcc/testsuite/gcc.dg/tls/pr24428.c
--- a/gcc/testsuite/gcc.dg/tls/pr24428.c	Mon Nov 22 19:44:14 2010 +0100
+++ b/gcc/testsuite/gcc.dg/tls/pr24428.c	Thu Nov 25 19:41:55 2010 +0100
@@ -1,6 +1,7 @@
 /* { dg-do run } */
 /* { dg-options "-O2" } */
 /* { dg-require-effective-target tls_runtime } */
+/* { dg-add-options tls } */
 
 __thread double thrtest[81];
 int main ()
diff -r 1b55ce8ede18 gcc/testsuite/lib/target-supports.exp
--- a/gcc/testsuite/lib/target-supports.exp	Mon Nov 22 19:44:14 2010 +0100
+++ b/gcc/testsuite/lib/target-supports.exp	Thu Nov 25 19:41:55 2010 +0100
@@ -569,6 +569,17 @@
     }]
 }
 
+# Add to FLAGS all the target-specific flags needed to use thread-local storage.
+
+proc add_options_for_tls { flags } {
+    # Tru64 UNIX uses emutls, which relies on a couple of pthread functions
+    # which only live in libpthread, so always pass -pthread for TLS.
+    if { [istarget *-*-osf*] } {
+	return "$flags -pthread"
+    }
+    return $flags
+}
+
 # Return 1 if thread local storage (TLS) is supported, 0 otherwise.
 
 proc check_effective_target_tls {} {
