diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8d859a4e9c160eb1fa5421839661920c31a15faf..9cf74ee59c222062da7303066ad6a709cb05adf2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2009-12-22  Iain Sandoe  <iain.sandoe@sandoe-acoustics.co.uk>
+
+	PR target/41605
+	* lib/g++.exp: Provide -B options to allow for link spec %s
+	substitutions for static libraries.
+
 2009-12-22  Brian Hackett  <bhackett1024@gmail.com>
 
 	* g++.dg/plugin/attribute_plugin.c: Rename pre-genericize event.
diff --git a/gcc/testsuite/lib/g++.exp b/gcc/testsuite/lib/g++.exp
index df6030b568c556c784f7d4c4be82524cd754913c..9de817b47f405e99e53bb2551efadd8c61b0a1f4 100644
--- a/gcc/testsuite/lib/g++.exp
+++ b/gcc/testsuite/lib/g++.exp
@@ -125,6 +125,9 @@ proc g++_link_flags { paths } {
       }
       if [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.a"] {
           append flags " -L${gccpath}/libstdc++-v3/src/.libs "
+          # Some targets use libstdc++.a%s in their specs, so they need a
+          # -B option for uninstalled testing.
+          append flags " -B${gccpath}/libstdc++-v3/src/.libs "
           append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs"
       }
       # Look for libstdc++.${shlib_ext}.
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 5d2822028e7e64c5119deecf7b4928729e90410f..6644d9d2528cc86d0a0529e937033ced5d5456e4 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,9 @@
+2009-12-22  Iain Sandoe  <iain.sandoe@sandoe-acoustics.co.uk>
+
+	PR target/41605
+	* testsuite/lib/libgomp.exp: Provide -B options to allow for
+	link spec %s substitutions for static libraries.
+
 2009-12-18  Jack Howarth <howarth@bromo.med.uc.edu>
 
 	PR testsuite/42135
diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index 0c8e49f8d85ca3b350b2bcd98a6d8f65ce179da8..0b0b608bf9e53c0fb6a05bc936f5a0a217bb4633 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -130,6 +130,9 @@ proc libgomp_init { args } {
     set ALWAYS_CFLAGS ""
     if { $blddir != "" } {
         lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/"
+        # targets that use libgomp.a%s in their specs need a -B option
+        # for uninstalled testing.
+        lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs"
         lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}"
         lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
     }
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 217b2977a651ae08c4ba3818431048a4afecc656..117b204bb098d1b09105da7feed3d05f2b5091ef 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,10 @@
+2009-12-22  Iain Sandoe  <iain.sandoe@sandoe-acoustics.co.uk>
+
+	PR target/41605
+	* testsuite/libstdc++-abi/abi.exp: Provide -B options to allow for
+	link spec %s substitutions for static libraries.
+	* testsuite/lib/libstdc++.exp: Ditto
+
 2009-12-22  Jonathan Wakely  <jwakely.gcc@gmail.com>
 
 	* include/std/mutex (call_once(once_flag&, _Callable, _Args&&...)):
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 9ae652f7328eba3986284fd1b274f216d6d06c39..ab4ab2434f3e3d51775da1f47b6980d0e5e54d26 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -91,6 +91,8 @@ proc libstdc++_init { testfile } {
     global target_triplet
     global flags_file
     global tool_timeout
+    global DEFAULT_CXXFLAGS
+    global STATIC_LIBCXXFLAGS
 
     # We set LC_ALL and LANG to C so that we get the same error
     # messages as expected.
@@ -106,6 +108,7 @@ proc libstdc++_init { testfile } {
 
     set blddir [lookfor_file [get_multilibs] libstdc++-v3]
     set flags_file "${blddir}/scripts/testsuite_flags"
+    set shlib_ext [get_shlib_extension]
     v3track flags_file 2
 
     # If a test doesn't have special options, use DEFAULT_CXXFLAGS.
@@ -114,7 +117,7 @@ proc libstdc++_init { testfile } {
     #   2) might need to be negated 
     # In particular, some tests have to be run without precompiled
     # headers, or without assertions.
-    global DEFAULT_CXXFLAGS
+
     if ![info exists DEFAULT_CXXFLAGS] then {
 	set DEFAULT_CXXFLAGS ""
 	# Host specific goo here.
@@ -145,7 +148,7 @@ proc libstdc++_init { testfile } {
 
     # Locate libgomp. This is only required for parallel mode.
     set v3-libgomp 0
-    set libgompdir [lookfor_file $blddir/../libgomp .libs/libgomp.so]
+    set libgompdir [lookfor_file $blddir/../libgomp .libs/libgomp.$shlib_ext]
     if {$libgompdir != ""} {
 	set v3-libgomp 1
         set libgompdir [file dirname $libgompdir]
@@ -156,7 +159,7 @@ proc libstdc++_init { testfile } {
 
     # Locate libstdc++ shared library. (ie libstdc++.so.)
     set v3-sharedlib 0
-    set sharedlibdir [lookfor_file $blddir src/.libs/libstdc++.so]
+    set sharedlibdir [lookfor_file $blddir src/.libs/libstdc++.$shlib_ext]
     if {$sharedlibdir != ""} {
 	if { [string match "*-*-linux*" $target_triplet] && [isnative] } {
 	    set v3-sharedlib 1
@@ -165,6 +168,15 @@ proc libstdc++_init { testfile } {
     }
     v3track v3-sharedlib 3
 
+    set STATIC_LIBCXXFLAGS ""
+    set staticlibdir [lookfor_file $blddir src/.libs/libstdc++.a]
+    if {$staticlibdir != ""} {
+	set staticlibdir [file dirname $staticlibdir]
+	# Some targets use libstdc++.a%s in their specs, so they need a
+	# -B option for uninstalled testing.
+	set STATIC_LIBCXXFLAGS " -B${staticlibdir} "
+    }
+
     # Compute what needs to be added to the existing LD_LIBRARY_PATH.
     if {$gccdir != ""} {
 	set compiler ${gccdir}/g++
@@ -403,6 +415,7 @@ proc v3_target_compile { source dest type options } {
     global cxxflags
     global cxxldflags
     global includes
+    global STATIC_LIBCXXFLAGS
 
     if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
         lappend options "libs=${gluefile}"
@@ -412,6 +425,7 @@ proc v3_target_compile { source dest type options } {
     set cxx_final $cxx
     set cxxlibglossflags  [libgloss_link_flags]
     set cxx_final [concat $cxx_final $cxxlibglossflags]
+    set cxx_final [concat $cxx_final $STATIC_LIBCXXFLAGS]
     set cxx_final [concat $cxx_final $cxxflags]
     set cxx_final [concat $cxx_final $includes]
 
@@ -443,6 +457,7 @@ proc v3_target_compile_as_c { source dest type options } {
     global blddir
     global cc
     global cxxflags
+    global STATIC_LIBCXXFLAGS
 
     if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
         lappend options "libs=${gluefile}"
@@ -453,6 +468,7 @@ proc v3_target_compile_as_c { source dest type options } {
     set cc_final $cc
     set cxxlibglossflags [libgloss_link_flags]
     set cc_final [concat $cc_final $cxxlibglossflags]
+    set cc_final [concat $cc_final $STATIC_LIBCXXFLAGS]
     set cc_final [concat $cc_final $cxxflags]
     set cc_final [concat $cc_final $includes]
     regsub -all {\s[-]nostdinc[+][+]} $cc_final "" cc_final
diff --git a/libstdc++-v3/testsuite/libstdc++-abi/abi.exp b/libstdc++-v3/testsuite/libstdc++-abi/abi.exp
index ff1249951283aeaa340432b12efb5a70248ca96a..fd892a0ebd9ae9371e4ecac780ed595b1a50faeb 100644
--- a/libstdc++-v3/testsuite/libstdc++-abi/abi.exp
+++ b/libstdc++-v3/testsuite/libstdc++-abi/abi.exp
@@ -18,7 +18,12 @@
 # this test. Or, hey, if we don't support this kind of symbol
 # versioning test: don't run it.
 
-set lib $blddir/src/.libs/libstdc++.so
+if { [string match "*-*-darwin*" $target_triplet] } {
+    set lib $blddir/src/.libs/libstdc++.dylib
+} else { 
+    set lib $blddir/src/.libs/libstdc++.so
+}
+
 set baseline_subdir "[eval exec $cxx --print-multi-dir]"
 
 # Build the support objects.