Use is_xcoff_format in ld testsuite
authorAlan Modra <amodra@gmail.com>
Tue, 7 Jul 2020 03:11:55 +0000 (12:41 +0930)
committerAlan Modra <amodra@gmail.com>
Tue, 7 Jul 2020 08:56:34 +0000 (18:26 +0930)
* 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.

ld/ChangeLog
ld/testsuite/ld-checks/checks.exp
ld/testsuite/ld-elfvers/vers.exp
ld/testsuite/ld-elfvsb/elfvsb.exp
ld/testsuite/ld-elfweak/elfweak.exp
ld/testsuite/ld-powerpc/powerpc.exp
ld/testsuite/ld-scripts/expr2.d
ld/testsuite/ld-scripts/print-memory-usage.exp
ld/testsuite/ld-scripts/section-match-1.d
ld/testsuite/ld-srec/srec.exp
ld/testsuite/ld-undefined/require-defined.exp

index 762d5a033d50c86c7b1e6ac2ebfb792e539d0db4..67bf035bdaa8893e87a6ab08071025da6a45ed3c 100644 (file)
@@ -1,3 +1,16 @@
+2020-07-07  Alan Modra  <amodra@gmail.com>
+
+       * 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.
+
 2020-07-07  Alan Modra  <amodra@gmail.com>
 
        * emultempl/aix.em (gld${EMULATION_NAME}_find_exp_assignment): Handle
index c351c0000e058cc112b27a29208319430e944ba0..fbda5e7f5e388a02401cdab0e797eee45d86454b 100644 (file)
@@ -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"
index 825b7944d082fbef12d1e80eb685056aedcbf182..82b79adf36dd11e7ea995290d9316413808fb6ed 100644 (file)
@@ -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
index 5e19d32ae619dee6f4a7947796c989c3db2aa195..fda2416c6de4fed3eed3f94e28946fc3ec575bee 100644 (file)
@@ -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
-}
index 1d5c438aa34729a3c2ba8789c1bf81313b69a3ab..d3194796aaa0eddc0d2a25c3bbab6e5f221d58a2 100644 (file)
@@ -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
index 3e458e47e864f2d6f6b773b0e8eb1b276eb3d26b..de676b81765a2961bed666d31f9800e7b480861a 100644 (file)
@@ -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
 }
index b05a5d22386f6012061bfe2a06d51005af128e44..94fb5d3ae70303f183cd0014a6d3980391e7abde 100644 (file)
@@ -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
index 8702c59ee43d1ee6ab287c96626035c201810596..e38a7d5a2d54e11fb913a699413addb0318c3325 100644 (file)
@@ -29,8 +29,7 @@ if { [istarget mips*-*-*]
      || [istarget pdp11*-*-*]
      || [istarget tic30*-*-*]
      || [istarget tic54x*-*-*]
-     || [istarget *-*-aix*]
-     || [istarget *-*-xcoff*] } {
+     || [is_xcoff_format] } {
     return
 }
 
index 5ea3bbb8f6db41a6d3879883707787df42fcd84f..4ee530b4086b9e49678ea9f63cbfcacb93b32b24 100644 (file)
@@ -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
 
index 69570a8a91c958bbff8ba40a59b5d38822301b79..13fc4e1fd7c7363222d97c9e478891709317f457 100644 (file)
@@ -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"
index 10d3408b868c28a0ba7983fc4e4135a1dea4f1fc..dceb6518e5ee6d71d67d1a622b18807a298ee2a8 100644 (file)
@@ -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
 }