Use is_xcoff_format in ld testsuite

Message ID 20200707085357.GL28359@bubble.grove.modra.org
State New
Headers show
Series
  • Use is_xcoff_format in ld testsuite
Related show

Commit Message

David Faust via Binutils July 7, 2020, 8:53 a.m.
* testsuite/ld-checks/checks.exp: Use is_xcoff_format.
	* testsuite/ld-powerpc/powerpc.exp: Likewise.
	* testsuite/ld-scripts/print-memory-usage.exp: Likewise.
	* testsuite/ld-srec/srec.exp: Likewise.
	* testsuite/ld-undefined/require-defined.exp: Likewise.
	* testsuite/ld-scripts/expr2.d: Likewise.
	* testsuite/ld-scripts/section-match-1.d: Only run for ELF.
	* testsuite/ld-elfvers/vers.exp: Delete dead code.
	* testsuite/ld-elfvsb/elfvsb.exp: Likewise.
	* testsuite/ld-elfweak/elfweak.exp: Likewise.


-- 
Alan Modra
Australia Development Lab, IBM

Comments

David Faust via Binutils July 7, 2020, 12:28 p.m. | #1
git commit 7193487fa8 took h8300 out of the notarget list, resulting in
h8300-elf  +FAIL: ld-scripts/section-match-1
h8300-linux  +FAIL: ld-scripts/section-match-1

	* testsuite/ld-scripts/section-match-1.d: xfail h8300.

diff --git a/ld/testsuite/ld-scripts/section-match-1.d b/ld/testsuite/ld-scripts/section-match-1.d
index 4ee530b408..09a00c2d13 100644
--- a/ld/testsuite/ld-scripts/section-match-1.d
+++ b/ld/testsuite/ld-scripts/section-match-1.d
@@ -1,10 +1,11 @@
 #source: section-match-1.s
 #ld: -T section-match-1.t
 #objdump: -s
-#target: [is_elf_format]
 # This test uses arbitrary section names, which are not supported by some
 # file formats.  Also these section names must be present in the
 # output, not translated into some other name, eg .text
+#target: [is_elf_format]
+#xfail: h8300-*-*
 
 .*:     file format .*
 

-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/ld/testsuite/ld-checks/checks.exp b/ld/testsuite/ld-checks/checks.exp
index c351c0000e..fbda5e7f5e 100644
--- a/ld/testsuite/ld-checks/checks.exp
+++ b/ld/testsuite/ld-checks/checks.exp
@@ -27,11 +27,8 @@  proc section_check {} {
     global srcdir
     global subdir
 
-    # The usage of .lcomm in asm.s is incompatible with ia64 and ppc coff.
-    if { [istarget ia64-*-*]
-	 || [istarget powerpc*-*-aix*]
-	 || [istarget powerpc-*-beos*]
-	 || [istarget rs6000-*-*] } {
+    # The usage of .lcomm in asm.s is incompatible with ia64 and ppc xcoff.
+    if { [istarget ia64-*-*] || [is_xcoff_format] } {
 	return
     }
     set test "check sections 1"
diff --git a/ld/testsuite/ld-elfvers/vers.exp b/ld/testsuite/ld-elfvers/vers.exp
index 825b7944d0..82b79adf36 100644
--- a/ld/testsuite/ld-elfvers/vers.exp
+++ b/ld/testsuite/ld-elfvers/vers.exp
@@ -57,10 +57,6 @@  if { ![istarget hppa*64*-*-hpux*]
     return
 }
 
-if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
-    return
-}
-
 set diff diff
 set tmpdir tmpdir
 set VOBJDUMP_FLAGS --private-headers
diff --git a/ld/testsuite/ld-elfvsb/elfvsb.exp b/ld/testsuite/ld-elfvsb/elfvsb.exp
index 5e19d32ae6..fda2416c6d 100644
--- a/ld/testsuite/ld-elfvsb/elfvsb.exp
+++ b/ld/testsuite/ld-elfvsb/elfvsb.exp
@@ -61,36 +61,6 @@  set SHCFLAG ""
 set shared_needs_pic "no"
 set COMPRESS_LDFLAG "-Wl,--compress-debug-sections=zlib-gabi"
 
-if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
-
-    # AIX shared libraries do not seem to support useful features,
-    # like overriding the shared library function or letting the
-    # shared library refer to objects defined in the main program.  We
-    # avoid testing those features.
-    set SHCFLAG "-DXCOFF_TEST"
-
-    # The AIX 3.2.5 loader appears to randomly fail when loading
-    # shared libraries from NSF mounted partitions, so we avoid any
-    # potential problems by using a local directory.
-    catch {exec /bin/sh -c "echo $$"} pid
-    set tmpdir /usr/tmp/ld.$pid
-    catch "exec mkdir $tmpdir" exec_status
-
-    # On AIX, we need to explicitly export the symbols the shared
-    # library is going to provide, and need.
-    set file [open $tmpdir/xcoff.exp w]
-    puts $file shlibvar1
-    puts $file shlibvar2
-    puts $file shlib_shlibvar1
-    puts $file shlib_shlibvar2
-    puts $file shlib_shlibcall
-    puts $file shlib_shlibcalled
-    puts $file shlib_checkfunptr1
-    puts $file shlib_getfunptr1
-    puts $file shlib_check
-    close $file
-}
-
 if [istarget arm*-*-linux*] {
     # On ARM section anchors can change the symbol pre-emptability for
     # non-PIC shared libraries, causing these tests to fail.  Turn section
@@ -137,11 +107,7 @@  proc visibility_test { visibility progname testname main sh1 sh2 dat args } {
     if [llength $args] { set shldflags [lindex $args 0] } else { set shldflags "" }
 
     # Build the shared library.
-    # On AIX, we need to use an export file.
     set shared -shared
-    if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
-	set shared "-bM:SRE -bE:$tmpdir/xcoff.exp"
-    }
     if { [is_elf_format] && [check_shared_lib_support] } {
 	append shared " -Wl,-z,notext"
     }
@@ -162,12 +128,7 @@  proc visibility_test { visibility progname testname main sh1 sh2 dat args } {
 
     # Link against the shared library.  Use -rpath so that the
     # dynamic linker can locate the shared library at runtime.
-    # On AIX, we must include /lib in -rpath, as otherwise the loader
-    # can not find -lc.
     set rpath $tmpdir
-    if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
-	set rpath /lib:$tmpdir
-    }
     if ![ld_link $CC $tmpdir/$progname "-Wl,-rpath,$rpath $tmpdir/$main $tmpdir/$progname.so"] {
 	if { [ string match $visibility "hidden" ]
 	     && [regexp "undefined reference to \`\.?visibility\'" $link_output]
@@ -287,8 +248,6 @@  proc visibility_run {visibility} {
 	if { ![ld_compile "$CC -g $NOPIE_CFLAGS $PLT_CFLAGS $CFLAGS $SHCFLAG $VSBCFLAG" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o]
 	     || ![ld_compile "$CC -g $NOPIE_CFLAGS $PLT_CFLAGS $CFLAGS $SHCFLAG $VSBCFLAG" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } {
 	    unresolved "visibility ($visibility) (non PIC)"
-	} else { if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
-	    visibility_test $visibility vnp "visibility ($visibility) (non PIC)" mainnp.o sh1np.o sh2np.o xcoff
 	} else {
 	    # SunOS non PIC shared libraries don't permit some cases of
 	    # overriding.
@@ -371,7 +330,7 @@  proc visibility_run {visibility} {
 	    visibility_test $visibility vnp "visibility ($visibility) (non PIC, load offset)" \
 		mainnp.o sh1np.o sh2np.o elfvsb \
 		"-Wl,-T,$srcdir/$subdir/elf-offset.ld,--hash-style=sysv"
-	} }
+	}
 
 	# Now compile the code using -fpic.
 
@@ -385,11 +344,7 @@  proc visibility_run {visibility} {
 		    setup_xfail $target_triplet
 		}
 	    }
-	    if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
-		visibility_test $visibility vp "visibility ($visibility)" mainnp.o sh1p.o sh2p.o xcoff
-	    } else {
-		visibility_test $visibility vp "visibility ($visibility)" mainnp.o sh1p.o sh2p.o elfvsb $COMPRESS_LDFLAG
-	    }
+	    visibility_test $visibility vp "visibility ($visibility)" mainnp.o sh1p.o sh2p.o elfvsb $COMPRESS_LDFLAG
 	}
     }}
 
@@ -403,44 +358,40 @@  proc visibility_run {visibility} {
     } else {
 	if { [ remote_file host exists $tmpdir/sh1np.o ]
 	     && [ remote_file host exists $tmpdir/sh2np.o ] } {
-	    if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
-		visibility_test $visibility vmpnp "visibility ($visibility) (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o xcoff
-	    } else {
-		# SunOS non PIC shared libraries don't permit some cases of
-		# overriding.
-		if { [ string match $visibility "protected" ]
-		     || [ string match $visibility "protected_undef_def" ] } {
-		    if [ string match $support_protected "no" ] {
-			setup_xfail $target_triplet
-		    }
-		}
-		if { ![ string match $visibility "hidden_undef" ]
-		     && ![ string match $visibility "protected_undef" ] } {
-		    setup_xfail "ia64-*-linux*"
-		    setup_xfail "alpha*-*-linux*"
-		}
-		if { ![ string match $visibility "hidden" ]
-		     && ![ string match $visibility "hidden_undef" ]
-		     && ![ string match $visibility "hidden_undef_def" ]
-		     && ![ string match $visibility "protected_undef" ] } {
-		    setup_xfail "s390x-*-linux*"
-		    if { [istarget sparc*-*-linux*] && [is_elf64 $tmpdir/mainp.o] } {
-			setup_xfail "sparc*-*-linux*"
-		    }
-		}
-		if { [is_elf64 $tmpdir/mainp.o] } {
-		    setup_xfail "x86_64-*-linux*"
-		}
-		setup_xfail "x86_64-*-linux-gnux32"
-		if { ![istarget hppa*64*-*-linux*] } {
-		    setup_xfail "hppa*-*-linux*"
+	    # SunOS non PIC shared libraries don't permit some cases of
+	    # overriding.
+	    if { [ string match $visibility "protected" ]
+		 || [ string match $visibility "protected_undef_def" ] } {
+		if [ string match $support_protected "no" ] {
+		    setup_xfail $target_triplet
 		}
-		if [ string match $shared_needs_pic "yes" ] {
-		    setup_xfail "arm*-*-linux*"
+	    }
+	    if { ![ string match $visibility "hidden_undef" ]
+		 && ![ string match $visibility "protected_undef" ] } {
+		setup_xfail "ia64-*-linux*"
+		setup_xfail "alpha*-*-linux*"
+	    }
+	    if { ![ string match $visibility "hidden" ]
+		 && ![ string match $visibility "hidden_undef" ]
+		 && ![ string match $visibility "hidden_undef_def" ]
+		 && ![ string match $visibility "protected_undef" ] } {
+		setup_xfail "s390x-*-linux*"
+		if { [istarget sparc*-*-linux*] && [is_elf64 $tmpdir/mainp.o] } {
+		    setup_xfail "sparc*-*-linux*"
 		}
-
-		visibility_test $visibility vmpnp "visibility ($visibility) (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o elfvsb
 	    }
+	    if { [is_elf64 $tmpdir/mainp.o] } {
+		setup_xfail "x86_64-*-linux*"
+	    }
+	    setup_xfail "x86_64-*-linux-gnux32"
+	    if { ![istarget hppa*64*-*-linux*] } {
+		setup_xfail "hppa*-*-linux*"
+	    }
+	    if [ string match $shared_needs_pic "yes" ] {
+		setup_xfail "arm*-*-linux*"
+	    }
+
+	    visibility_test $visibility vmpnp "visibility ($visibility) (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o elfvsb
 	} else {
 	    unresolved "visibility (PIC main, non PIC so)"
 	}
@@ -453,11 +404,7 @@  proc visibility_run {visibility} {
 		    setup_xfail $target_triplet
 		}
 	    }
-	    if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
-		visibility_test $visibility vmpp "visibility ($visibility) (PIC main)" mainp.o sh1p.o sh2p.o xcoff
-	    } else {
-		visibility_test $visibility vmpp "visibility ($visibility) (PIC main)" mainp.o sh1p.o sh2p.o elfvsb
-	    }
+	    visibility_test $visibility vmpp "visibility ($visibility) (PIC main)" mainp.o sh1p.o sh2p.o elfvsb
 	} else {
 	    unresolved "visibility ($visibility) (PIC main)"
 	}
@@ -529,8 +476,3 @@  if { ![ld_compile "$CC -g $CFLAGS" $srcdir/$subdir/test.c tmpdir/test.o] } {
 	}
     }
 }
-
-if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
-    # Remove the temporary directory.
-    catch "exec rm -rf $tmpdir" exec_status
-}
diff --git a/ld/testsuite/ld-elfweak/elfweak.exp b/ld/testsuite/ld-elfweak/elfweak.exp
index 1d5c438aa3..d3194796aa 100644
--- a/ld/testsuite/ld-elfweak/elfweak.exp
+++ b/ld/testsuite/ld-elfweak/elfweak.exp
@@ -55,9 +55,6 @@  if {    ![istarget alpha*-*-linux*]
      && ![istarget *-*-nacl*] } {
     return
 }
-if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
-    return
-}
 
 set diff diff
 set tmpdir tmpdir
diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
index 3e458e47e8..de676b8176 100644
--- a/ld/testsuite/ld-powerpc/powerpc.exp
+++ b/ld/testsuite/ld-powerpc/powerpc.exp
@@ -70,10 +70,10 @@  if {[istarget "*-*-vxworks"]} {
 # is ELF, because we pass -melf32ppc to ld and powerpc-nto-ld wants
 # -melf32ppcnto.
 
-if { [istarget "*-*-macos*"]
+if { [is_xcoff_format]
      || [istarget "*-*-pe"] || [istarget "*-*-winnt*"]
-     || [istarget "*-*-cygwin*"] || [istarget "*-*-aix*"]
-     || [istarget "*-*-beos*"] || [istarget "*-*-lynxos*"]
+     || [istarget "*-*-cygwin*"]
+     || [istarget "*-*-lynxos*"]
      || [istarget "*-*-nto*"] } {
     return
 }
diff --git a/ld/testsuite/ld-scripts/expr2.d b/ld/testsuite/ld-scripts/expr2.d
index b05a5d2238..94fb5d3ae7 100644
--- a/ld/testsuite/ld-scripts/expr2.d
+++ b/ld/testsuite/ld-scripts/expr2.d
@@ -1,6 +1,6 @@ 
 # ld: -T expr2.t
 #nm: -B
-#xfail: arm-*-*aout powerpc*-*-aix* rs6000-*-aix*
+#xfail: arm-*-*aout [is_xcoff_format]
 
 #...
 .* D defined
diff --git a/ld/testsuite/ld-scripts/print-memory-usage.exp b/ld/testsuite/ld-scripts/print-memory-usage.exp
index 8702c59ee4..e38a7d5a2d 100644
--- a/ld/testsuite/ld-scripts/print-memory-usage.exp
+++ b/ld/testsuite/ld-scripts/print-memory-usage.exp
@@ -29,8 +29,7 @@  if { [istarget mips*-*-*]
      || [istarget pdp11*-*-*]
      || [istarget tic30*-*-*]
      || [istarget tic54x*-*-*]
-     || [istarget *-*-aix*]
-     || [istarget *-*-xcoff*] } {
+     || [is_xcoff_format] } {
     return
 }
 
diff --git a/ld/testsuite/ld-scripts/section-match-1.d b/ld/testsuite/ld-scripts/section-match-1.d
index 5ea3bbb8f6..4ee530b408 100644
--- a/ld/testsuite/ld-scripts/section-match-1.d
+++ b/ld/testsuite/ld-scripts/section-match-1.d
@@ -1,8 +1,8 @@ 
 #source: section-match-1.s
 #ld: -T section-match-1.t
 #objdump: -s
-#notarget: *-*-osf* *-*-aix* *-*-pe *-*-*aout *-*-ecoff *-*-netbsd *-*-vms h8300-*-* ns32k-*-* tic30-*-*
-# This test uses arbitrary section names, which are not support by some
+#target: [is_elf_format]
+# This test uses arbitrary section names, which are not supported by some
 # file formats.  Also these section names must be present in the
 # output, not translated into some other name, eg .text
 
diff --git a/ld/testsuite/ld-srec/srec.exp b/ld/testsuite/ld-srec/srec.exp
index 69570a8a91..13fc4e1fd7 100644
--- a/ld/testsuite/ld-srec/srec.exp
+++ b/ld/testsuite/ld-srec/srec.exp
@@ -384,7 +384,9 @@  setup_xfail "mips*-*-irix5*" "mips*-*-irix6*" "mips*-*-linux*"
 
 # The S-record linker doesn't do the magic TOC handling that XCOFF
 # linkers do.
-setup_xfail "*-*-aix*" "*-*-xcoff*"
+if [is_xcoff_format] {
+    setup_xfail *-*-*
+}
 
 # The S-record linker is not supported for ARC.
 setup_xfail "arc*-*-*"
@@ -454,7 +456,9 @@  if ![ld_compile "$CXX $CXXFLAGS -fno-exceptions" $srcdir/$subdir/sr3.cc tmpdir/s
 # See above.
 setup_xfail "i*86-*-aout*"
 setup_xfail "mips*-*-irix5*" "mips*-*-irix6*" "mips*-*-linux*"
-setup_xfail "*-*-aix*" "*-*-xcoff*"
+if [is_xcoff_format] {
+    setup_xfail *-*-*
+}
 setup_xfail "arc*-*-*"
 setup_xfail "arm*-*-*"
 setup_xfail "v850*-*-elf"
diff --git a/ld/testsuite/ld-undefined/require-defined.exp b/ld/testsuite/ld-undefined/require-defined.exp
index 10d3408b86..dceb6518e5 100644
--- a/ld/testsuite/ld-undefined/require-defined.exp
+++ b/ld/testsuite/ld-undefined/require-defined.exp
@@ -35,9 +35,8 @@  if { [istarget "powerpcle-*-*"] \
      || [istarget "cris-axis-elf"] \
      || [istarget "ns32k-*-*"] \
      || [istarget "*-*-coff"] \
-     || [istarget "*-*-xcoff"] \
      || [istarget "*-*-*aout*"] \
-     || [istarget "*-*-*aix*"] } {
+     || [is_xcoff_format] } {
     unsupported "require-defined testing"
     return
 }