return 1;
     }
 
-    if { ![istarget *-*-sysv4*]
-        && ![istarget *-*-unixware*]
+    if {    ![istarget *-*-eabi*]
         && ![istarget *-*-elf*]
-        && ![istarget *-*-eabi*]
-        && ![istarget *-*-rtems*]
-        && ![istarget hppa*64*-*-hpux*]
-        && ![istarget ia64-*-hpux*]
-        && ![istarget *-*-linux*]
+        && ![istarget *-*-freebsd*]
         && ![istarget *-*-gnu*]
-        && ![istarget *-*-nacl*]
-        && ![istarget frv-*-uclinux*]
-        && ![istarget bfin-*-uclinux]
-        && ![istarget sh*-*-uclinux*]
-        && ![istarget tic6x*-*-uclinux*]
         && ![istarget *-*-irix5*]
         && ![istarget *-*-irix6*]
-        && ![istarget *-*-freebsd*]
+        && ![istarget *-*-linux*]
+        && ![istarget *-*-nacl*]
         && ![istarget *-*-netbsd*]
         && ![istarget *-*-openbsd*]
-        && ![istarget *-*-solaris2*] } {
+        && ![istarget *-*-rtems*]
+        && ![istarget *-*-solaris2*]
+        && ![istarget *-*-sysv4*]
+        && ![istarget *-*-unixware*]
+        && ![istarget avr-*-*]
+        && ![istarget bfin-*-uclinux]
+        && ![istarget frv-*-uclinux*]
+        && ![istarget hppa*64*-*-hpux*]
+        && ![istarget ia64-*-hpux*]
+        && ![istarget sh*-*-uclinux*]
+        && ![istarget tic6x*-*-uclinux*] } {
        return 0
     }
 
-    if { [istarget i?86-*-freebsd\[12\].*] } {
-        return 0
-    }
-
-    if { [istarget *-*-linux*aout*]
+    if {    [istarget *-*-linux*aout*]
         || [istarget *-*-linux*ecoff*]
         || [istarget *-*-linux*oldld*]
+        || [istarget *-*-rtemscoff*]
         || [istarget h8500-*-rtems*]
-        || [istarget i960-*-rtems*]
-        || [istarget *-*-rtemscoff*] } {
+        || [istarget i?86-*-freebsd\[12\].*]
+        || [istarget i960-*-rtems*] } {
        return 0
     }
 
     if { ![istarget *-*-netbsdelf*]
-        && ([istarget *-*-netbsd*aout*]
+        && (   [istarget *-*-netbsd*aout*]
             || [istarget *-*-netbsdpe*]
             || [istarget arm*-*-netbsd*]
             || [istarget sparc-*-netbsd*]
        return 0
     }
 
-    if { [istarget arm-*-openbsd*]
+    if {    [istarget arm-*-openbsd*]
         || [istarget i386-*-openbsd\[0-2\].*]
         || [istarget i386-*-openbsd3.\[0-2\]]
         || [istarget m68*-*-openbsd*]
 
     return
 }
 
-# too big for d10v and msp
+# too big for avr, d10v and msp
 # lack of fancy orphan section handling causes overlap on fr30 and iq2000
 if { ![istarget "d10v-*-*"]
+     && ![istarget "avr-*-*"]
      && ![istarget "msp*-*-*"]
      && ![istarget "fr30-*-*"] 
      && ![istarget "iq2000-*-*"] } {
     foreach sfile $sfiles { puts $ofd "#source: $sfile" }
-    if { [istarget "avr-*-*"] } then {
-       puts $ofd "#as: -mmcu=avr6"
-       puts $ofd "#ld: -mavr6"
-    } elseif { [istarget spu*-*-*] } {
+    if { [istarget spu*-*-*] } {
        puts $ofd "#ld: --local-store 0:0"
     } else {
        puts $ofd "#ld:"
 
     $testobjfiles $libs" "" "" "" {{ld plugin-28.d}} "main.x" ] \
     [list "plugin warning" "-plugin $plugin2_path -plugin-opt warning \
     $testobjfiles $libs" "" "" "" {{ld plugin-29.d}} "main.x" ] \
-    [list "PR ld/17973" "-plugin $plugin2_path -shared $regassilent \
-                       -plugin-opt add:tmpdir/pr17973.o \
-    tmpdir/dummy.o" "" "" "" {{readelf -sW pr17973.d}} "main.x" ] \
 ]
 
+if [check_shared_lib_support] {
+    lappend plugin_tests [list "PR ld/17973" "-plugin $plugin2_path -shared $regassilent \
+                       -plugin-opt add:tmpdir/pr17973.o \
+    tmpdir/dummy.o" "" "" "" {{readelf -sW pr17973.d}} "main.x" ]
+}
+
+
 set plugin_lib_tests [list \
     [list "plugin ignore lib" "-plugin $plugin_path $regclm \
                        $regas $regcln -plugin-opt claim:tmpdir/func.o \